store

package
v1.0.35 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

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"
	// KubeContextType is the endpoint key in the context endpoints for a new
	// kube backend
	KubeContextType = "kube"
)

Variables

This section is empty.

Functions

func WithContextStore

func WithContextStore(store Store)

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 {
	CredentialsFromEnv bool   `json:",omitempty"`
	Profile            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 KubeContext

type KubeContext struct {
	ContextName     string `json:",omitempty"`
	KubeconfigPath  string `json:",omitempty"`
	FromEnvironment bool
}

KubeContext is the context for a kube 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 Instance added in v1.0.10

func Instance() Store

Instance 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