store

package
v0.1.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2020 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultContextName is an automatically generated local context
	DefaultContextName = "default"
	// DefaultContextType is the type for all moby contexts (not associated with cli backend)
	DefaultContextType = "moby"

	// AwsContextType is the type for aws contexts (currently a CLI plugin, not associated with cli backend)
	// to be removed with the cli plugin
	AwsContextType = "aws"

	// EcsContextType is the endpoint key in the context endpoints for an ECS
	// backend
	EcsContextType = "ecs"

	// EcsLocalSimulationContextType is the endpoint key in the context endpoints for an ECS backend
	// running local simulation endpoints
	EcsLocalSimulationContextType = "ecs-local"

	// AciContextType is the endpoint key in the context endpoints for an ACI
	// backend
	AciContextType = "aci"
	// LocalContextType is the endpoint key in the context endpoints for a new
	// local backend
	LocalContextType = "local"
	// ExampleContextType is the endpoint key in the context endpoints for an
	// example backend
	ExampleContextType = "example"
)

Variables

This section is empty.

Functions

func WithContextStore

func WithContextStore(ctx context.Context, store Store) context.Context

WithContextStore adds the store to the context

Types

type AciContext

type AciContext struct {
	SubscriptionID string `json:",omitempty"`
	Location       string `json:",omitempty"`
	ResourceGroup  string `json:",omitempty"`
}

AciContext is the context for the ACI backend

type AwsContext

type AwsContext EcsContext

AwsContext is the context for the ecs plugin

type ContextMetadata

type ContextMetadata struct {
	Type              string
	Description       string
	StackOrchestrator string
	AdditionalFields  map[string]interface{}
}

ContextMetadata is represtentation of the data we put in a context metadata

func (ContextMetadata) MarshalJSON

func (dc ContextMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshalling

func (*ContextMetadata) UnmarshalJSON

func (dc *ContextMetadata) UnmarshalJSON(payload []byte) error

UnmarshalJSON implements custom JSON marshalling

type DockerContext

type DockerContext struct {
	Name      string                 `json:",omitempty"`
	Metadata  ContextMetadata        `json:",omitempty"`
	Endpoints map[string]interface{} `json:",omitempty"`
}

DockerContext represents the docker context metadata

func (*DockerContext) Type

func (m *DockerContext) Type() string

Type the context type

type EcsContext

type EcsContext struct {
	Profile string `json:",omitempty"`
	Region  string `json:",omitempty"`
}

EcsContext is the context for the AWS backend

type Endpoint

type Endpoint struct {
	Host             string `json:",omitempty"`
	DefaultNamespace string `json:",omitempty"`
}

Endpoint holds the Docker or the Kubernetes endpoint, they both have the `Host` property, only kubernetes will have the `DefaultNamespace`

type ExampleContext

type ExampleContext struct{}

ExampleContext is the context for the example backend

type LocalContext

type LocalContext struct{}

LocalContext is the context for the local backend

type Store

type Store interface {
	// Get returns the context with name, it returns an error if the  context
	// doesn't exist
	Get(name string) (*DockerContext, error)
	// GetEndpoint sets the `v` parameter to the value of the endpoint for a
	// particular context type
	GetEndpoint(name string, v interface{}) error
	// Create creates a new context, it returns an error if a context with the
	// same name exists already.
	Create(name string, contextType string, description string, data interface{}) error
	// List returns the list of created contexts
	List() ([]*DockerContext, error)
	// Remove removes a context by name from the context store
	Remove(name string) error
	// ContextExists checks if a context already exists
	ContextExists(name string) bool
}

Store is the context store

func ContextStore

func ContextStore(ctx context.Context) Store

ContextStore returns the store from the context

func New

func New(rootDir string) (Store, error)

New returns a configured context store with specified root dir (eg. $HOME/.docker) as root

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL