Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AwsFacade ¶ added in v0.1.1
type AwsFacade interface { // ListNamespaces provides ServiceDiscovery ListNamespaces wrapper interface for paginator. ListNamespaces(context.Context, *sd.ListNamespacesInput, ...func(*sd.Options)) (*sd.ListNamespacesOutput, error) // ListServices provides ServiceDiscovery ListServices wrapper interface for paginator. ListServices(context.Context, *sd.ListServicesInput, ...func(options *sd.Options)) (*sd.ListServicesOutput, error) // ListInstances provides ServiceDiscovery ListInstances wrapper interface for paginator. ListInstances(context.Context, *sd.ListInstancesInput, ...func(*sd.Options)) (*sd.ListInstancesOutput, error) // ListOperations provides ServiceDiscovery ListOperations wrapper interface for paginator. ListOperations(context.Context, *sd.ListOperationsInput, ...func(*sd.Options)) (*sd.ListOperationsOutput, error) // GetOperation provides ServiceDiscovery GetOperation wrapper interface. GetOperation(context.Context, *sd.GetOperationInput, ...func(*sd.Options)) (*sd.GetOperationOutput, error) // CreateHttpNamespace provides ServiceDiscovery CreateHttpNamespace wrapper interface. CreateHttpNamespace(context.Context, *sd.CreateHttpNamespaceInput, ...func(*sd.Options)) (*sd.CreateHttpNamespaceOutput, error) // CreateService provides ServiceDiscovery CreateService wrapper interface. CreateService(context.Context, *sd.CreateServiceInput, ...func(*sd.Options)) (*sd.CreateServiceOutput, error) // RegisterInstance provides ServiceDiscovery RegisterInstance wrapper interface. RegisterInstance(context.Context, *sd.RegisterInstanceInput, ...func(*sd.Options)) (*sd.RegisterInstanceOutput, error) // DeregisterInstance provides ServiceDiscovery DeregisterInstance wrapper interface. DeregisterInstance(context.Context, *sd.DeregisterInstanceInput, ...func(*sd.Options)) (*sd.DeregisterInstanceOutput, error) }
AwsFacade wraps the minimal surface area of ServiceDiscovery API calls for the AWS SDK required by the AWS Cloud Map client. This enables mock generation for unit testing.
func NewAwsFacadeFromConfig ¶ added in v0.1.1
NewAwsFacadeFromConfig creates a new AWS facade from an AWS client config.
type OperationCollector ¶ added in v0.1.1
type OperationCollector interface { // Add calls an operation provider function to asynchronously collect operations to poll. Add(operationProvider func() (operationId string, err error)) // Collect waits for all create operation results to be provided and returns a list of the successfully created operation IDs. Collect() []string // GetStartTime returns the start time range to poll the collected operations. GetStartTime() int64 // IsAllOperationsCreated returns true if all operations were created successfully. IsAllOperationsCreated() bool }
OperationCollector collects a list of operation IDs asynchronously with thread safety.
func NewOperationCollector ¶ added in v0.1.1
func NewOperationCollector() OperationCollector
type OperationPoller ¶ added in v0.1.1
type OperationPoller interface { // Poll monitors operations until they reach terminal state. Poll(ctx context.Context) error }
OperationPoller polls a list operations for a terminal status.
func NewDeregisterInstancePoller ¶ added in v0.1.1
func NewDeregisterInstancePoller(sdApi ServiceDiscoveryApi, serviceId string, opIds []string, startTime int64) OperationPoller
NewDeregisterInstancePoller creates a new operation poller for de-register instance operations.
func NewRegisterInstancePoller ¶ added in v0.1.1
func NewRegisterInstancePoller(sdApi ServiceDiscoveryApi, serviceId string, opIds []string, startTime int64) OperationPoller
NewRegisterInstancePoller creates a new operation poller for register instance operations.
type ServiceDiscoveryApi ¶ added in v0.1.1
type ServiceDiscoveryApi interface { // ListNamespaces returns a list of all namespaces. ListNamespaces(ctx context.Context) (namespaces []*model.Namespace, err error) // ListServices returns a list of services for a given namespace. ListServices(ctx context.Context, namespaceId string) (services []*model.Resource, err error) // ListInstances returns a list of service instances registered to a given service. ListInstances(ctx context.Context, serviceId string) ([]types.InstanceSummary, error) // ListOperations returns a map of operations to their status matching a list of filters. ListOperations(ctx context.Context, opFilters []types.OperationFilter) (operationStatusMap map[string]types.OperationStatus, err error) // GetOperation returns an operation. GetOperation(ctx context.Context, operationId string) (operation *types.Operation, err error) // CreateHttpNamespace creates a HTTP namespace in AWS Cloud Map for a given name. CreateHttpNamespace(ctx context.Context, namespaceName string) (operationId string, err error) // CreateService creates a named service in AWS Cloud Map under the given namespace. CreateService(ctx context.Context, namespace model.Namespace, serviceName string) (serviceId string, err error) // RegisterInstance registers a service instance in AWS Cloud Map. RegisterInstance(ctx context.Context, serviceId string, instanceId string, instanceAttrs map[string]string) (operationId string, err error) // DeregisterInstance de-registers a service instance in Cloud Map. DeregisterInstance(ctx context.Context, serviceId string, instanceId string) (operationId string, err error) // PollNamespaceOperation polls a namespace operation, and returns the namespace ID. PollNamespaceOperation(ctx context.Context, operationId string) (namespaceId string, err error) }
ServiceDiscoveryApi handles the AWS Cloud Map API request and response processing logic, and converts results to internal data structures. It manages all interactions with the AWS SDK.
func NewServiceDiscoveryApiFromConfig ¶ added in v0.1.1
func NewServiceDiscoveryApiFromConfig(cfg *aws.Config) ServiceDiscoveryApi
NewServiceDiscoveryApiFromConfig creates a new AWS Cloud Map API connection manager from an AWS client config.
type ServiceDiscoveryClient ¶
type ServiceDiscoveryClient interface { // ListServices returns all services and their endpoints for a given namespace. ListServices(ctx context.Context, namespaceName string) ([]*model.Service, error) // CreateService creates a Cloud Map service resource, and namespace if necessary. CreateService(ctx context.Context, namespaceName string, serviceName string) error // GetService returns a service resource fetched from AWS Cloud Map or nil if not found. GetService(ctx context.Context, namespaceName string, serviceName string) (*model.Service, error) // RegisterEndpoints registers all endpoints for given service. RegisterEndpoints(ctx context.Context, namespaceName string, serviceName string, endpoints []*model.Endpoint) error // DeleteEndpoints de-registers all endpoints for given service. DeleteEndpoints(ctx context.Context, namespaceName string, serviceName string, endpoints []*model.Endpoint) error }
ServiceDiscoveryClient provides the service endpoint management functionality required by the AWS Cloud Map multi-cluster service discovery for Kubernetes controller. It maintains local caches for all AWS Cloud Map resources.
func NewServiceDiscoveryClient ¶
func NewServiceDiscoveryClient(cfg *aws.Config) ServiceDiscoveryClient
NewServiceDiscoveryClient creates a new service discovery client for AWS Cloud Map from a given AWS client config.