Documentation
¶
Index ¶
- Variables
- type ApacheKafkaCluster
- type AutoScaling
- type Capacity
- type CloudWatchLogsDelivery
- type Connector
- type ConnectorOperation
- type ConnectorOperationStep
- type ConnectorSpec
- type ConnectorUpdate
- type CustomPlugin
- type FirehoseDelivery
- type Handler
- func (h *Handler) BackendFor(region string) StorageBackend
- func (h *Handler) ChaosOperations() []string
- func (h *Handler) ChaosRegions() []string
- func (h *Handler) ChaosServiceName() string
- func (h *Handler) EnableRegions()
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) RegionBackends() []StorageBackend
- func (h *Handler) RegionHandler(region string) *Handler
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Snapshot(ctx context.Context) []byte
- type InMemoryBackend
- func (b *InMemoryBackend) CreateConnector(accountID, region string, spec ConnectorSpec) (*Connector, error)
- func (b *InMemoryBackend) CreateCustomPlugin(...) (*CustomPlugin, error)
- func (b *InMemoryBackend) CreateWorkerConfiguration(accountID, region, name, description, propertiesFileContent string, ...) (*WorkerConfiguration, error)
- func (b *InMemoryBackend) DeleteConnector(connectorArn, currentVersion string) (*Connector, error)
- func (b *InMemoryBackend) DeleteCustomPlugin(customPluginArn string) (*CustomPlugin, error)
- func (b *InMemoryBackend) DeleteWorkerConfiguration(workerConfigurationArn string) (*WorkerConfiguration, error)
- func (b *InMemoryBackend) DescribeConnector(connectorArn string) (*Connector, error)
- func (b *InMemoryBackend) DescribeConnectorOperation(operationArn string) (*ConnectorOperation, error)
- func (b *InMemoryBackend) DescribeCustomPlugin(customPluginArn string) (*CustomPlugin, error)
- func (b *InMemoryBackend) DescribeWorkerConfiguration(workerConfigurationArn string) (*WorkerConfiguration, error)
- func (b *InMemoryBackend) ListConnectorOperations(connectorArn, nextToken string, maxResults int) ([]*ConnectorOperation, string, error)
- func (b *InMemoryBackend) ListConnectors(namePrefix, nextToken string, maxResults int) ([]*Connector, string, error)
- func (b *InMemoryBackend) ListCustomPlugins(namePrefix, nextToken string, maxResults int) ([]*CustomPlugin, string, error)
- func (b *InMemoryBackend) ListTagsForResource(resourceArn string) (map[string]string, error)
- func (b *InMemoryBackend) ListWorkerConfigurations(namePrefix, nextToken string, maxResults int) ([]*WorkerConfiguration, string, error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) RestartConnector(connectorArn string, _ bool) (*Connector, *ConnectorOperation, error)
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) SetAppConfig(cfg any)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) TagResource(resourceArn string, tags map[string]string) error
- func (b *InMemoryBackend) UntagResource(resourceArn string, tagKeys []string) error
- func (b *InMemoryBackend) UpdateConnector(connectorArn, currentVersion string, update ConnectorUpdate) (*Connector, *ConnectorOperation, error)
- type PluginRef
- type Provider
- type ProvisionedCapacity
- type S3LogDelivery
- type Snapshottable
- type StorageBackend
- type Vpc
- type WorkerConfigRef
- type WorkerConfigRevision
- type WorkerConfiguration
- type WorkerLogDelivery
Constants ¶
This section is empty.
Variables ¶
var ( // ErrConnectorNotFound is returned when a connector ARN does not resolve. ErrConnectorNotFound = awserr.New("connector not found", awserr.ErrNotFound) // ErrConnectorNameInUse is returned when a connector name is already in use. ErrConnectorNameInUse = awserr.New("a connector with this name already exists", awserr.ErrAlreadyExists) // ErrCustomPluginNotFound is returned when a custom plugin ARN does not resolve. ErrCustomPluginNotFound = awserr.New("custom plugin not found", awserr.ErrNotFound) // ErrCustomPluginNameInUse is returned when a custom plugin name is already in use. ErrCustomPluginNameInUse = awserr.New("a custom plugin with this name already exists", awserr.ErrAlreadyExists) // ErrWorkerConfigNotFound is returned when a worker configuration ARN does not resolve. ErrWorkerConfigNotFound = awserr.New("worker configuration not found", awserr.ErrNotFound) // ErrWorkerConfigNameInUse is returned when a worker configuration name is already in use. ErrWorkerConfigNameInUse = awserr.New( "a worker configuration with this name already exists", awserr.ErrAlreadyExists, ) // ErrConnectorOperationNotFound is returned when a connector operation ARN does not resolve. ErrConnectorOperationNotFound = awserr.New("connector operation not found", awserr.ErrNotFound) // ErrResourceNotFound is returned by the generic tag operations when resourceArn resolves to nothing. ErrResourceNotFound = awserr.New("resource not found", awserr.ErrNotFound) // ErrVersionMismatch is returned when currentVersion does not match a connector's actual version. ErrVersionMismatch = awserr.New( "the current version specified does not match the connector's actual current version", awserr.ErrConflict, ) // ErrConnectorDeleting is returned when mutating a connector that is already DELETING. ErrConnectorDeleting = awserr.New("the connector is being deleted", awserr.ErrConflict) // ErrValidation is returned when request input fails validation. ErrValidation = awserr.New("invalid request", awserr.ErrInvalidParameter) )
var ErrNoSnapshot = errors.New("backend does not support restore")
ErrNoSnapshot is returned when a backend does not support snapshot/restore.
Functions ¶
This section is empty.
Types ¶
type ApacheKafkaCluster ¶
ApacheKafkaCluster mirrors types.ApacheKafkaClusterDescription.
type AutoScaling ¶
type AutoScaling struct {
MinWorkerCount int32
MaxWorkerCount int32
McuCount int32
MaxAutoscalingTaskCount int32
ScaleInCPUPercent int32
ScaleOutCPUPercent int32
}
AutoScaling mirrors types.AutoScalingDescription.
type Capacity ¶
type Capacity struct {
AutoScaling *AutoScaling
Provisioned *ProvisionedCapacity
}
Capacity mirrors types.CapacityDescription: exactly one of the two is set.
type CloudWatchLogsDelivery ¶
CloudWatchLogsDelivery mirrors types.CloudWatchLogsLogDeliveryDescription.
type Connector ¶
type Connector struct {
CreationTime time.Time
PendingUntil time.Time
Capacity Capacity
WorkerConfiguration *WorkerConfigRef
WorkerLogDelivery *WorkerLogDelivery
ConnectorConfiguration map[string]string
Tags map[string]string
State string
Description string
ARN string
CurrentVersion string
KafkaConnectVersion string
KafkaClusterClientAuthentication string
KafkaClusterEncryptionInTransit string
ServiceExecutionRoleArn string
NetworkType string
Name string
ApacheKafkaCluster ApacheKafkaCluster
Plugins []PluginRef
}
Connector is the persisted representation of an MSK Connect connector.
type ConnectorOperation ¶
type ConnectorOperation struct {
CreationTime time.Time
EndTime time.Time
OriginConnectorConfiguration map[string]string
TargetConnectorConfiguration map[string]string
OriginCapacity *Capacity
TargetCapacity *Capacity
ARN string
ConnectorArn string
State string
Type string
Steps []ConnectorOperationStep
}
ConnectorOperation is the persisted representation of an UpdateConnector operation, returned by DescribeConnectorOperation/ListConnectorOperations.
type ConnectorOperationStep ¶
ConnectorOperationStep mirrors types.ConnectorOperationStep.
type ConnectorSpec ¶
type ConnectorSpec struct {
Capacity Capacity
ConnectorConfiguration map[string]string
Tags map[string]string
WorkerConfiguration *WorkerConfigRef
WorkerLogDelivery *WorkerLogDelivery
Description string
Name string
KafkaConnectVersion string
KafkaClusterClientAuthentication string
KafkaClusterEncryptionInTransit string
ServiceExecutionRoleArn string
NetworkType string
ApacheKafkaCluster ApacheKafkaCluster
Plugins []PluginRef
}
ConnectorSpec carries every CreateConnector input field except the account/region needed to mint the ARN.
type ConnectorUpdate ¶
ConnectorUpdate carries UpdateConnector's mutually exclusive target fields; exactly one of Capacity or ConnectorConfiguration is non-nil.
type CustomPlugin ¶
type CustomPlugin struct {
CreationTime time.Time
PendingUntil time.Time
Tags map[string]string
Name string
ARN string
Description string
State string
FailureMessage string
ContentType string
BucketArn string
FileKey string
ObjectVersion string
FileMD5 string
FileSizeBytes int64
Revision int64
}
CustomPlugin is the persisted representation of an MSK Connect custom plugin.
type FirehoseDelivery ¶
FirehoseDelivery mirrors types.FirehoseLogDeliveryDescription.
type Handler ¶
type Handler struct {
Backend StorageBackend
AccountID string
DefaultRegion string
// contains filtered or unexported fields
}
Handler is the HTTP handler for the MSK Connect REST API.
func NewHandler ¶
func NewHandler(backend StorageBackend) *Handler
NewHandler creates a new MSK Connect handler.
func (*Handler) BackendFor ¶
func (h *Handler) BackendFor(region string) StorageBackend
BackendFor returns the backend serving region: the home backend, or the sibling built on first use.
func (*Handler) ChaosOperations ¶
ChaosOperations returns all operations that can be fault-injected.
func (*Handler) ChaosRegions ¶
ChaosRegions returns all regions this handler handles.
func (*Handler) ChaosServiceName ¶
ChaosServiceName returns the lowercase AWS service name for fault rule matching.
func (*Handler) EnableRegions ¶
func (h *Handler) EnableRegions()
EnableRegions makes h serve every other region through lazily built per-region siblings.
func (*Handler) ExtractOperation ¶
ExtractOperation extracts the MSK Connect operation name from the request.
func (*Handler) ExtractResource ¶
ExtractResource extracts the resource ARN from the request path.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations returns the list of supported operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler serves each request from the handler of its region.
func (*Handler) MatchPriority ¶
MatchPriority returns the routing priority.
func (*Handler) RegionBackends ¶
func (h *Handler) RegionBackends() []StorageBackend
RegionBackends returns the home backend followed by every sibling built so far.
func (*Handler) RegionHandler ¶
RegionHandler returns the handler serving region: h itself for the home region, else its sibling.
func (*Handler) RouteMatcher ¶
RouteMatcher returns a function that matches MSK Connect REST API requests.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
InMemoryBackend is the in-memory implementation of StorageBackend.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates a new in-memory MSK Connect backend.
func (*InMemoryBackend) CreateConnector ¶
func (b *InMemoryBackend) CreateConnector(accountID, region string, spec ConnectorSpec) (*Connector, error)
CreateConnector creates a connector in CREATING; it settles to RUNNING after provisionDelay.
func (*InMemoryBackend) CreateCustomPlugin ¶
func (b *InMemoryBackend) CreateCustomPlugin( accountID, region, name, description, contentType, bucketArn, fileKey, objectVersion string, tags map[string]string, ) (*CustomPlugin, error)
CreateCustomPlugin creates a plugin in CREATING that settles to ACTIVE, or CREATE_FAILED without its S3 object; FileMd5/FileSize come from S3 when wired, else are derived.
func (*InMemoryBackend) CreateWorkerConfiguration ¶
func (b *InMemoryBackend) CreateWorkerConfiguration( accountID, region, name, description, propertiesFileContent string, tags map[string]string, ) (*WorkerConfiguration, error)
CreateWorkerConfiguration creates a worker configuration, always at revision 1 and ACTIVE immediately -- UpdateWorkerConfiguration (which would create later revisions) is not part of the AWS API surface this backend implements; see PARITY.md.
func (*InMemoryBackend) DeleteConnector ¶
func (b *InMemoryBackend) DeleteConnector(connectorArn, currentVersion string) (*Connector, error)
DeleteConnector marks a connector DELETING under optimistic lock (currentVersion, when supplied); it is removed once deletionDelay elapses.
func (*InMemoryBackend) DeleteCustomPlugin ¶
func (b *InMemoryBackend) DeleteCustomPlugin(customPluginArn string) (*CustomPlugin, error)
DeleteCustomPlugin marks a custom plugin DELETING; it is removed once deletionDelay elapses.
func (*InMemoryBackend) DeleteWorkerConfiguration ¶
func (b *InMemoryBackend) DeleteWorkerConfiguration(workerConfigurationArn string) (*WorkerConfiguration, error)
DeleteWorkerConfiguration marks a worker configuration DELETING; it is removed once deletionDelay elapses.
func (*InMemoryBackend) DescribeConnector ¶
func (b *InMemoryBackend) DescribeConnector(connectorArn string) (*Connector, error)
DescribeConnector returns the current information about a connector.
func (*InMemoryBackend) DescribeConnectorOperation ¶
func (b *InMemoryBackend) DescribeConnectorOperation(operationArn string) (*ConnectorOperation, error)
DescribeConnectorOperation returns the details of a single connector operation.
func (*InMemoryBackend) DescribeCustomPlugin ¶
func (b *InMemoryBackend) DescribeCustomPlugin(customPluginArn string) (*CustomPlugin, error)
DescribeCustomPlugin returns the current information about a custom plugin.
func (*InMemoryBackend) DescribeWorkerConfiguration ¶
func (b *InMemoryBackend) DescribeWorkerConfiguration(workerConfigurationArn string) (*WorkerConfiguration, error)
DescribeWorkerConfiguration returns the current information about a worker configuration.
func (*InMemoryBackend) ListConnectorOperations ¶
func (b *InMemoryBackend) ListConnectorOperations( connectorArn, nextToken string, maxResults int, ) ([]*ConnectorOperation, string, error)
ListConnectorOperations returns operations for a connector, paginated by nextToken/maxResults.
func (*InMemoryBackend) ListConnectors ¶
func (b *InMemoryBackend) ListConnectors(namePrefix, nextToken string, maxResults int) ([]*Connector, string, error)
ListConnectors returns connectors matching namePrefix, paginated by nextToken/maxResults.
func (*InMemoryBackend) ListCustomPlugins ¶
func (b *InMemoryBackend) ListCustomPlugins( namePrefix, nextToken string, maxResults int, ) ([]*CustomPlugin, string, error)
ListCustomPlugins returns custom plugins matching namePrefix, paginated by nextToken/maxResults.
func (*InMemoryBackend) ListTagsForResource ¶
func (b *InMemoryBackend) ListTagsForResource(resourceArn string) (map[string]string, error)
ListTagsForResource returns all tags on a connector, custom plugin, or worker configuration by ARN.
func (*InMemoryBackend) ListWorkerConfigurations ¶
func (b *InMemoryBackend) ListWorkerConfigurations( namePrefix, nextToken string, maxResults int, ) ([]*WorkerConfiguration, string, error)
ListWorkerConfigurations returns worker configurations matching namePrefix, paginated by nextToken/maxResults.
func (*InMemoryBackend) RestartConnector ¶
func (b *InMemoryBackend) RestartConnector(connectorArn string, _ bool) (*Connector, *ConnectorOperation, error)
RestartConnector moves a connector to RESTARTING and records a RESTART_IN_PROGRESS operation that completes after provisionDelay.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore deserializes backend state from a JSON snapshot.
func (*InMemoryBackend) SetAppConfig ¶
func (b *InMemoryBackend) SetAppConfig(cfg any)
SetAppConfig records the service.AppContext.Config for lazy sibling lookup.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serializes backend state to JSON.
func (*InMemoryBackend) TagResource ¶
func (b *InMemoryBackend) TagResource(resourceArn string, tags map[string]string) error
TagResource adds or replaces tags on a connector, custom plugin, or worker configuration by ARN.
func (*InMemoryBackend) UntagResource ¶
func (b *InMemoryBackend) UntagResource(resourceArn string, tagKeys []string) error
UntagResource removes tags from a connector, custom plugin, or worker configuration by ARN.
func (*InMemoryBackend) UpdateConnector ¶
func (b *InMemoryBackend) UpdateConnector( connectorArn, currentVersion string, update ConnectorUpdate, ) (*Connector, *ConnectorOperation, error)
UpdateConnector updates a connector's capacity or configuration under optimistic lock (currentVersion). Exactly one of update.Capacity or update.ConnectorConfiguration must be set. The connector goes UPDATING and the returned operation UPDATE_IN_PROGRESS until provisionDelay elapses.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Amazon MSK Connect.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init initializes the MSK Connect service backend and handler.
type ProvisionedCapacity ¶
ProvisionedCapacity mirrors types.ProvisionedCapacityDescription.
type S3LogDelivery ¶
S3LogDelivery mirrors types.S3LogDeliveryDescription.
type Snapshottable ¶
type Snapshottable interface {
Snapshot(ctx context.Context) []byte
Restore(context.Context, []byte) error
}
Snapshottable is an optional interface a StorageBackend may implement to support snapshot/restore for persistence or test isolation.
type StorageBackend ¶
type StorageBackend interface {
CreateConnector(accountID, region string, spec ConnectorSpec) (*Connector, error)
DescribeConnector(connectorArn string) (*Connector, error)
ListConnectors(namePrefix, nextToken string, maxResults int) ([]*Connector, string, error)
UpdateConnector(
connectorArn, currentVersion string,
update ConnectorUpdate,
) (*Connector, *ConnectorOperation, error)
DeleteConnector(connectorArn, currentVersion string) (*Connector, error)
RestartConnector(connectorArn string, onlyFailedTasks bool) (*Connector, *ConnectorOperation, error)
DescribeConnectorOperation(operationArn string) (*ConnectorOperation, error)
ListConnectorOperations(connectorArn, nextToken string, maxResults int) ([]*ConnectorOperation, string, error)
CreateCustomPlugin(
accountID, region, name, description, contentType, bucketArn, fileKey, objectVersion string,
tags map[string]string,
) (*CustomPlugin, error)
DescribeCustomPlugin(customPluginArn string) (*CustomPlugin, error)
ListCustomPlugins(namePrefix, nextToken string, maxResults int) ([]*CustomPlugin, string, error)
DeleteCustomPlugin(customPluginArn string) (*CustomPlugin, error)
CreateWorkerConfiguration(
accountID, region, name, description, propertiesFileContent string,
tags map[string]string,
) (*WorkerConfiguration, error)
DescribeWorkerConfiguration(workerConfigurationArn string) (*WorkerConfiguration, error)
ListWorkerConfigurations(namePrefix, nextToken string, maxResults int) ([]*WorkerConfiguration, string, error)
DeleteWorkerConfiguration(workerConfigurationArn string) (*WorkerConfiguration, error)
TagResource(resourceArn string, tags map[string]string) error
UntagResource(resourceArn string, tagKeys []string) error
ListTagsForResource(resourceArn string) (map[string]string, error)
Reset()
}
StorageBackend is the interface for the MSK Connect backend.
type WorkerConfigRef ¶
WorkerConfigRef mirrors types.WorkerConfigurationDescription.
type WorkerConfigRevision ¶
type WorkerConfigRevision struct {
CreationTime time.Time
Description string
PropertiesFileContent string
Revision int64
}
WorkerConfigRevision is the persisted representation of a worker configuration revision. This backend only ever creates revision 1 -- UpdateWorkerConfiguration (which would create new revisions) is not part of the AWS API surface this backend implements.
type WorkerConfiguration ¶
type WorkerConfiguration struct {
CreationTime time.Time
PendingUntil time.Time
Tags map[string]string
Name string
ARN string
Description string
State string
LatestRevision WorkerConfigRevision
}
WorkerConfiguration is the persisted representation of an MSK Connect worker configuration.
type WorkerLogDelivery ¶
type WorkerLogDelivery struct {
CloudWatchLogs *CloudWatchLogsDelivery
Firehose *FirehoseDelivery
S3 *S3LogDelivery
}
WorkerLogDelivery mirrors types.WorkerLogDeliveryDescription.