Documentation
¶
Overview ¶
Package msk provides emulation of Amazon MSK (Managed Streaming for Kafka).
Implemented operations: CreateCluster, DescribeCluster, ListClusters, DeleteCluster, GetBootstrapBrokers, CreateConfiguration, DescribeConfiguration, ListConfigurations, DeleteConfiguration, ListKafkaVersions, TagResource, UntagResource, ListTagsForResource.
On CreateCluster, a real Redpanda container is started (same pattern as ElastiCache). The cluster reaches "ACTIVE" state once the TCP health check succeeds.
Index ¶
- type BrokerNodeGroupInfo
- type Cluster
- type ClusterConfiguration
- type Handler
- type Revision
- type Service
- func (s *Service) Dispatch(w http.ResponseWriter, r *http.Request)
- func (s *Service) InitBus(bus *events.Bus)
- func (s *Service) Name() string
- func (s *Service) Operations() []op.Operation
- func (s *Service) ReconcileContainers(ctx context.Context, containers []docker.ContainerSummary)
- func (s *Service) RegisterRoutes(r chi.Router)
- func (s *Service) SetDocker(dc *docker.Client)
- func (s *Service) Stop(ctx context.Context)
- func (s *Service) SupportedProtocols() []codec.Codec
- func (s *Service) TagsRouter() chi.Router
- func (s *Service) TargetPrefix() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrokerNodeGroupInfo ¶
type BrokerNodeGroupInfo struct {
InstanceType string `json:"instanceType,omitempty"`
ClientSubnets []string `json:"clientSubnets,omitempty"`
SecurityGroups []string `json:"securityGroups,omitempty"`
BrokerAZDistribution string `json:"brokerAZDistribution,omitempty"`
}
BrokerNodeGroupInfo describes broker node configuration.
type Cluster ¶
type Cluster struct {
ClusterArn string `json:"clusterArn"`
ClusterName string `json:"clusterName"`
ClusterType string `json:"clusterType,omitempty"`
State string `json:"state"`
CreationTime time.Time `json:"creationTime"`
CurrentVersion string `json:"currentVersion"`
BrokerNodeGroupInfo BrokerNodeGroupInfo `json:"brokerNodeGroupInfo"`
NumberOfBrokerNodes int `json:"numberOfBrokerNodes"`
KafkaVersion string `json:"kafkaVersion"`
Tags map[string]string `json:"tags,omitempty"`
// Internal — not in API responses.
DockerContainerID string `json:"_dockerContainerID,omitempty"`
HostPort int `json:"_hostPort,omitempty"`
}
Cluster represents an MSK cluster.
type ClusterConfiguration ¶
type ClusterConfiguration struct {
Arn string `json:"arn"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
KafkaVersions []string `json:"kafkaVersions,omitempty"`
CreationTime time.Time `json:"creationTime"`
LatestRevision Revision `json:"latestRevision"`
State string `json:"state"`
}
ClusterConfiguration represents an MSK configuration.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles MSK REST JSON requests.
type Revision ¶
type Revision struct {
CreationTime time.Time `json:"creationTime"`
Revision int64 `json:"revision"`
}
Revision represents a configuration revision.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements router.Service for MSK.
func (*Service) Dispatch ¶
func (s *Service) Dispatch(w http.ResponseWriter, r *http.Request)
Dispatch satisfies router.TargetDispatcher.
func (*Service) Operations ¶
func (*Service) ReconcileContainers ¶
func (s *Service) ReconcileContainers(ctx context.Context, containers []docker.ContainerSummary)
ReconcileContainers satisfies router.ContainerReconciler.
func (*Service) RegisterRoutes ¶
RegisterRoutes satisfies router.Service.
ARNs in path parameters contain forward slashes. We use chi wildcard catch-all routes (/*) and dispatch to specific handlers based on the path suffix.
func (*Service) SetDocker ¶
SetDocker wires the Docker client for MSK container management and starts the DockerGC background remove loop.
func (*Service) Stop ¶
Stop cancels pending lifecycle transitions, waits for in-flight Docker goroutines, then cleans up all containers via the GC.
func (*Service) SupportedProtocols ¶
func (*Service) TagsRouter ¶
TagsRouter returns a chi.Router for the MSK tagging routes that live under /v1/tags. This is mounted by the main router alongside other taggable services' tag routers and dispatched by the resourceArn's service segment, since /v1/tags/{resourceArn} is shared across services (e.g. AppSync) that each own tagging for their own ARNs.
func (*Service) TargetPrefix ¶
TargetPrefix satisfies router.TargetDispatcher.