mq

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 25 Imported by: 0

README

Amazon MQ

Parity grade: A · SDK aws-sdk-go-v2/service/mq@v1.39.4 · last audited 2026-08-29 (92bc04738b4b8e24fcc4a0800b2ff62be0eed47a)

Coverage

Metric Value
PARITY entries audited 25 (24 ok, 1 partial)
Feature families 2 (2 ok)
Known gaps 3
Deferred items 1
Resource leaks clean
Known gaps
  • 2026-08-29 sweep: go run ./cmd/acceptguard flagged handler_configurations.go's createConfigurationInput reading a 'Description' JSON field on CreateConfiguration -- confirmed against serializers.go's awsRestjson1_serializeOpDocumentCreateConfigurationInput that the real CreateConfigurationInput NEVER serializes a description key (only authenticationStrategy/engineType/engineVersion/name/tags). Verdict: harmless, not fixed -- a real SDK client can never populate this field on Create (it will always decode as ""), which exactly matches real AWS's own behavior (Configuration.Description starts empty on Create and is set via UpdateConfiguration, which gopherstack already supports correctly). Pre-existing, not introduced this pass; left as-is rather than removed since gopherstack's own internal Go backend API and non-SDK/raw test callers use the same positional description parameter for convenience.
  • DescribeSharedResources (now callable via aws-sdk-go-v2/service/mq@v1.39.4, the pinned version) always returns an empty sharedResources list: this backend does not model AWS RAM cross-account resource sharing, so there is no real state to report against. This is an honest empty result, not a stub -- BrokerId is still validated against real broker state. UpdateBrokerInput/Output.resourceShareArns (2026-08-29) is accept-and-echo only for the same reason -- there is no real resource-share state for it to affect.
  • 2026-08-29: DescribeBrokerOutput.pendingStorageSize/UpdateBrokerOutput.storageSize semantics assume storage size behaves like EngineVersion/HostInstanceType (stage-then-promote-on-reboot); the pinned SDK's doc text for these fields is terse enough that this is a best-effort interpretation, not a confirmed AWS behavior (real EBS/EFS volume resize is likely asynchronous and NOT reboot-gated in the live service). Flagged for a future pass with access to real AWS behavior to confirm or correct.
Deferred
  • Full CRDR (cross-region data replication) simulation: Promote/DataReplicationMetadata population when dataReplicationMode=CRDR is not modeled beyond accepting/echoing the mode string, seeding DataReplicationMetadata.DataReplicationCounterpart from CreateBroker's dataReplicationPrimaryBrokerArn, and (2026-09-12) requiring/flipping DataReplicationRole REPLICA->PRIMARY on Promote -- no data actually moves between a simulated pair, and the counterpart broker's own role is not updated in tandem (this backend has no bidirectional pairing state to update it through). Considered explicitly this pass (gopherstack-7wz5) and ruled out of scope: a half-modelled cross-region replication state machine (pairing brokers, propagating data, promote semantics) would report a state no client could rely on, which is worse than the current honest non-implementation. User.ReplicationUser is now accepted/echoed (see CreateUser/UpdateUser/DescribeUser above) but its CRDR effects (actual replication) remain part of this same deferred surface. 2026-08-20 wrapper-key sweep fixed the WIRE SHAPE of what is emitted (DataReplicationCounterpart is now the real nested {brokerId, region} object, parsed best-effort from the given ARN since there is no real cross-region broker to look up) without expanding the deferred simulation itself -- see CreateBroker's note.

More

Documentation

Overview

Package mq provides an in-memory stub of Amazon MQ.

Index

Constants

View Source
const (
	// BrokerStateRunning indicates an active broker.
	BrokerStateRunning = "RUNNING"
	// BrokerStateCreating indicates a broker being provisioned.
	BrokerStateCreating = "CREATION_IN_PROGRESS"
	// BrokerStateDeleting indicates a broker being removed.
	BrokerStateDeleting = "DELETION_IN_PROGRESS"
	// BrokerStateRebooting indicates a broker reboot in progress.
	BrokerStateRebooting = "REBOOT_IN_PROGRESS"

	// EngineTypeActiveMQ is the ActiveMQ engine type.
	EngineTypeActiveMQ = "ACTIVEMQ"
	// EngineTypeRabbitMQ is the RabbitMQ engine type.
	EngineTypeRabbitMQ = "RABBITMQ"

	// DeploymentModeSingleInstance is the single-instance deployment mode.
	DeploymentModeSingleInstance = "SINGLE_INSTANCE"
	// DeploymentModeActiveStandby is the active/standby multi-AZ deployment mode.
	DeploymentModeActiveStandby = "ACTIVE_STANDBY_MULTI_AZ"
	// DeploymentModeCluster is the cluster multi-AZ deployment mode (RabbitMQ).
	DeploymentModeCluster = "CLUSTER_MULTI_AZ"

	// StorageTypeEFS is the EFS storage type (ActiveMQ). AWS MQ's
	// BrokerStorageType enum uses the uppercase form on the wire (see
	// aws-sdk-go-v2/service/mq/types.BrokerStorageTypeEfs); a lowercase value
	// here would round-trip through JSON fine but silently fail any
	// client-side comparison against the SDK's typed enum constants.
	StorageTypeEFS = "EFS"
	// StorageTypeEBS is the EBS storage type (RabbitMQ). See StorageTypeEFS
	// for why this must match the SDK's uppercase enum value.
	StorageTypeEBS = "EBS"

	// PromoteModeFailover is the failover promote mode.
	PromoteModeFailover = "FAILOVER"
	// PromoteModeSwitchover is the switchover promote mode.
	PromoteModeSwitchover = "SWITCHOVER"

	// ChangeTypeCreate marks a broker user create that is pending a broker
	// reboot. Mirrors aws-sdk-go-v2/service/mq/types.ChangeTypeCreate.
	ChangeTypeCreate = "CREATE"
	// ChangeTypeUpdate marks a broker user update that is pending a broker
	// reboot. Mirrors aws-sdk-go-v2/service/mq/types.ChangeTypeUpdate.
	ChangeTypeUpdate = "UPDATE"
	// ChangeTypeDelete marks a broker user delete that is pending a broker
	// reboot. Mirrors aws-sdk-go-v2/service/mq/types.ChangeTypeDelete.
	ChangeTypeDelete = "DELETE"

	// DataReplicationRoleReplica marks a broker created with a
	// dataReplicationPrimaryBrokerArn as the replica side of a CRDR pair.
	// aws-sdk-go-v2/service/mq/types.DataReplicationMetadataOutput.DataReplicationRole
	// is a free string field (no generated enum), but types.BrokerStateReplica
	// ("REPLICA") confirms this is the real spelling AWS uses.
	DataReplicationRoleReplica = "REPLICA"
	// DataReplicationRolePrimary is the role a replica broker takes on after
	// Promote -- the counterpart to DataReplicationRoleReplica ("When a
	// replica broker is promoted to primary, this role is interchanged",
	// aws-sdk-go-v2/service/mq/types.DataReplicationMetadataOutput doc).
	DataReplicationRolePrimary = "PRIMARY"
)

Variables

View Source
var (
	// ErrNotFound is returned when a requested resource does not exist.
	ErrNotFound = awserr.New("NotFoundException", awserr.ErrNotFound)
	// ErrAlreadyExists is returned when a resource already exists.
	ErrAlreadyExists = awserr.New("ConflictException", awserr.ErrAlreadyExists)
	// ErrValidation is returned when a request contains an invalid parameter.
	ErrValidation = awserr.New("BadRequestException", awserr.ErrInvalidParameter)
	// ErrInUse is returned when a resource cannot be deleted because another
	// resource still references it.
	ErrInUse = awserr.New("ConflictException", awserr.ErrConflict)
)
View Source
var ErrNilAppContext = errors.New("mq: nil AppContext")

ErrNilAppContext is returned when the AppContext passed to Init is nil.

Functions

This section is empty.

Types

type ActionRequired

type ActionRequired struct {
	ActionRequiredCode string `json:"actionRequiredCode,omitempty"`
	ActionRequiredInfo string `json:"actionRequiredInfo,omitempty"`
}

ActionRequired describes a service-side action required on the broker.

type AvailabilityZone

type AvailabilityZone struct {
	Name string `json:"name"`
}

AvailabilityZone describes a single availability zone.

type Broker

type Broker struct {
	EncryptionOptions          *EncryptionOptions       `json:"encryptionOptions,omitempty"`
	Users                      map[string]*User         `json:"users,omitempty"`
	Configurations             *Configurations          `json:"configurations,omitempty"`
	PendingDataReplicationMeta *DataReplicationMetadata `json:"pendingDataReplicationMetadata,omitempty"`
	PendingLdapServerMetadata  *LdapServerMetadata      `json:"pendingLdapServerMetadata,omitempty"`
	DataReplicationMetadata    *DataReplicationMetadata `json:"dataReplicationMetadata,omitempty"`
	Tags                       map[string]string        `json:"-"`
	LogsSummary                *LogsSummary             `json:"logsSummary,omitempty"`
	Logs                       *Logs                    `json:"logs,omitempty"`
	LdapServerMetadata         *LdapServerMetadata      `json:"ldapServerMetadata,omitempty"`
	MaintenanceWindowStartTime *WeeklyStartTime         `json:"maintenanceWindowStartTime,omitempty"`
	DataReplicationMode        string                   `json:"dataReplicationMode,omitempty"`
	PendingEngineVersion       string                   `json:"pendingEngineVersion,omitempty"`
	AuthenticationStrategy     string                   `json:"authenticationStrategy,omitempty"`
	CreatorRequestID           string                   `json:"creatorRequestId,omitempty"`
	EngineVersion              string                   `json:"engineVersion"`
	PendingDataReplicationMode string                   `json:"pendingDataReplicationMode,omitempty"`
	BrokerArn                  string                   `json:"brokerArn"`
	PendingHostInstanceType    string                   `json:"pendingHostInstanceType,omitempty"`
	Created                    string                   `json:"created"`
	BrokerName                 string                   `json:"brokerName"`
	HostInstanceType           string                   `json:"hostInstanceType"`
	BrokerID                   string                   `json:"brokerId"`
	EngineType                 string                   `json:"engineType"`
	DeploymentMode             string                   `json:"deploymentMode"`
	BrokerState                string                   `json:"brokerState"`
	PendingAuthStrategy        string                   `json:"pendingAuthenticationStrategy,omitempty"`
	StorageType                string                   `json:"storageType,omitempty"`
	ActionsRequired            []ActionRequired         `json:"actionsRequired,omitempty"`
	PendingSecurityGroups      []string                 `json:"pendingSecurityGroups,omitempty"`
	BrokerInstances            []BrokerInstance         `json:"brokerInstances,omitempty"`
	SecurityGroups             []string                 `json:"securityGroups,omitempty"`
	SubnetIDs                  []string                 `json:"subnetIds,omitempty"`
	PendingResourceShareArns   []string                 `json:"pendingResourceShareArns,omitempty"`
	PubliclyAccessible         bool                     `json:"publiclyAccessible"`
	AutoMinorVersionUpgrade    bool                     `json:"autoMinorVersionUpgrade"`
	StorageSize                int32                    `json:"storageSize,omitempty"`
	PendingStorageSize         int32                    `json:"pendingStorageSize,omitempty"`
}

Broker represents an Amazon MQ broker.

type BrokerEngineType

type BrokerEngineType struct {
	EngineType     string          `json:"engineType"`
	EngineVersions []EngineVersion `json:"engineVersions"`
}

BrokerEngineType describes an engine type and its available versions.

type BrokerInstance

type BrokerInstance struct {
	ConsoleURL string   `json:"consoleURL"`
	IPAddress  string   `json:"ipAddress,omitempty"`
	Endpoints  []string `json:"endpoints"`
}

BrokerInstance holds endpoint information for a broker instance.

type BrokerInstanceOption

type BrokerInstanceOption struct {
	EngineType               string             `json:"engineType"`
	HostInstanceType         string             `json:"hostInstanceType"`
	StorageType              string             `json:"storageType"`
	AvailabilityZones        []AvailabilityZone `json:"availabilityZones"`
	SupportedEngineVersions  []string           `json:"supportedEngineVersions"`
	SupportedDeploymentModes []string           `json:"supportedDeploymentModes"`
}

BrokerInstanceOption describes a broker host instance type and its options.

type Configuration

type Configuration struct {
	Tags                   map[string]string       `json:"-"`
	Data                   map[int32]string        `json:"data,omitempty"`
	LatestRevision         *ConfigurationRevision  `json:"latestRevision"`
	Arn                    string                  `json:"arn"`
	ID                     string                  `json:"id"`
	Name                   string                  `json:"name"`
	Description            string                  `json:"description"`
	EngineType             string                  `json:"engineType"`
	EngineVersion          string                  `json:"engineVersion"`
	Created                string                  `json:"created"`
	AuthenticationStrategy string                  `json:"authenticationStrategy,omitempty"`
	Revisions              []ConfigurationRevision `json:"revisions,omitempty"`
}

Configuration represents an Amazon MQ configuration. Data and Revisions carry real json tags (rather than "-") so they round-trip through Snapshot/Restore -- see store_setup.go for why store.Table marshals this type directly. Tags keeps "-" deliberately: it is persisted separately via backendSnapshot.Tags and re-linked by reestablishTagPointers so the b.tags[arn]/cfg.Tags shared-pointer invariant survives a restore.

type ConfigurationID

type ConfigurationID struct {
	ID       string `json:"id"`
	Revision int32  `json:"revision"`
}

ConfigurationID holds a reference to a broker configuration.

type ConfigurationRevision

type ConfigurationRevision struct {
	Created     string `json:"created"`
	Description string `json:"description,omitempty"`
	Revision    int32  `json:"revision"`
}

ConfigurationRevision holds revision metadata for a configuration.

type Configurations

type Configurations struct {
	Current *ConfigurationID  `json:"current,omitempty"`
	Pending *ConfigurationID  `json:"pending,omitempty"`
	History []ConfigurationID `json:"history,omitempty"`
}

Configurations holds pending and current configuration references.

type CreateBrokerOptions

type CreateBrokerOptions struct {
	Configuration              *ConfigurationID
	EncryptionOptions          *EncryptionOptions
	MaintenanceWindowStartTime *WeeklyStartTime
	LdapServerMetadata         *LdapServerMetadata
	Logs                       *Logs
	StorageType                string
	AuthenticationStrategy     string
	CreatorRequestID           string
	// DataReplicationMode and DataReplicationPrimaryBrokerArn accept and echo
	// CreateBrokerInput's CRDR fields (CreateBrokerInput.DataReplicationMode /
	// DataReplicationPrimaryBrokerArn in aws-sdk-go-v2/service/mq). Full CRDR
	// simulation (actually pairing brokers, propagating data) is out of
	// scope -- see PARITY.md's deferred CRDR note -- but the fields must not
	// be silently dropped: DataReplicationMode is stored verbatim and
	// DataReplicationPrimaryBrokerArn seeds DataReplicationMetadata so a
	// client reading DescribeBroker back sees its own request echoed.
	DataReplicationMode             string
	DataReplicationPrimaryBrokerArn string
	// StorageSize is CreateBrokerInput.StorageSize (the broker's storage
	// size in GB). Zero means "not specified".
	StorageSize int32
}

CreateBrokerOptions carries optional configuration for CreateBrokerWithOptions. Zero values are ignored and treated as "not specified".

type DataReplicationCounterpart added in v1.5.0

type DataReplicationCounterpart struct {
	BrokerID string `json:"brokerId"`
	Region   string `json:"region"`
}

DataReplicationCounterpart identifies the paired broker in a CRDR data replication relationship. Mirrors aws-sdk-go-v2/service/mq/types.DataReplicationCounterpart (brokerId/region, both required on the wire).

type DataReplicationMetadata

type DataReplicationMetadata struct {
	DataReplicationCounterpart *DataReplicationCounterpart `json:"dataReplicationCounterpart,omitempty"`
	DataReplicationRole        string                      `json:"dataReplicationRole,omitempty"`
}

DataReplicationMetadata describes an active CRDR (cross-region disaster recovery) link. DataReplicationCounterpart is a nested object in the real wire shape (aws-sdk-go-v2/service/mq/types.DataReplicationMetadataOutput), not a bare ARN string -- see DataReplicationCounterpart below.

type EncryptionOptions

type EncryptionOptions struct {
	KMSKeyID       string `json:"kmsKeyId,omitempty"`
	UseAWSOwnedKey bool   `json:"useAwsOwnedKey"`
}

EncryptionOptions configures KMS encryption for an Amazon MQ broker.

type EngineVersion

type EngineVersion struct {
	Name string `json:"name"`
}

EngineVersion holds a single engine version entry.

type Handler

type Handler struct {
	Backend StorageBackend
}

Handler is the Echo HTTP handler for Amazon MQ REST operations.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a new Amazon MQ handler.

func (*Handler) ChaosOperations

func (h *Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*Handler) ChaosRegions

func (h *Handler) ChaosRegions() []string

ChaosRegions returns all regions this handler instance handles.

func (*Handler) ChaosServiceName

func (h *Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name from the request.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts a resource ID from the request path.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears the handler's backend state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher returns a function that matches Amazon MQ REST API requests. MQ uses /v1/brokers, and MQ-signed /v1/configurations and /v1/tags paths.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

type InMemoryBackend

type InMemoryBackend struct {
	// contains filtered or unexported fields
}

InMemoryBackend stores Amazon MQ state in memory.

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory Amazon MQ backend.

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the account ID configured for this backend.

func (*InMemoryBackend) CreateBroker

func (b *InMemoryBackend) CreateBroker(
	name, deploymentMode, engineType, engineVersion, hostInstanceType string,
	publiclyAccessible, autoMinorVersionUpgrade bool,
	securityGroups, subnetIDs []string,
	users []*User,
	tags map[string]string,
) (*Broker, error)

CreateBroker creates a new Amazon MQ broker (compatibility wrapper).

func (*InMemoryBackend) CreateBrokerWithOptions

func (b *InMemoryBackend) CreateBrokerWithOptions(
	name, deploymentMode, engineType, engineVersion, hostInstanceType string,
	publiclyAccessible, autoMinorVersionUpgrade bool,
	securityGroups, subnetIDs []string,
	users []*User,
	tags map[string]string,
	opts *CreateBrokerOptions,
) (*Broker, error)

func (*InMemoryBackend) CreateConfiguration

func (b *InMemoryBackend) CreateConfiguration(
	name, description, engineType, engineVersion, authenticationStrategy string,
	tags map[string]string,
) (*Configuration, error)

CreateConfiguration creates a new Amazon MQ configuration.

func (*InMemoryBackend) CreateTags

func (b *InMemoryBackend) CreateTags(resourceARN string, tags map[string]string) error

CreateTags adds or updates tags for a resource ARN. Real Amazon MQ returns NotFoundException for an ARN that names no broker or configuration (same SDK error-list evidence as ListTags). Note: b.tags[arn] and the corresponding broker/config Tags field share the same map pointer, so a single write here updates both automatically.

func (*InMemoryBackend) CreateUser

func (b *InMemoryBackend) CreateUser(
	brokerID, username, password string, groups []string, console, replicationUser bool,
) error

CreateUser creates a user on a broker. Real Amazon MQ only activates a new ActiveMQ broker user on the next reboot (see aws-sdk-go-v2/service/mq/types.UserPendingChanges); the user is inserted immediately with the requested attributes but marked Pending.PendingChange = CREATE, exactly as DescribeUser/ListUsers would show it, until promoteBrokerReboot clears the marker.

func (*InMemoryBackend) DeleteBroker

func (b *InMemoryBackend) DeleteBroker(brokerID string) (*Broker, error)

DeleteBroker transitions a broker to DELETION_IN_PROGRESS and returns its identifiers. The broker is fully removed from the map on the next DescribeBroker / ListBrokers call via promoteDeletingToDeleted.

func (*InMemoryBackend) DeleteConfiguration

func (b *InMemoryBackend) DeleteConfiguration(configID string) error

DeleteConfiguration removes a configuration by ID. Real Amazon MQ rejects this with ConflictException while a broker still references the configuration (confirmed from the pinned SDK: DeleteConfiguration is the only Delete* op in aws-sdk-go-v2/service/mq/deserializers.go whose error list includes ConflictException; DeleteBroker/DeleteUser do not).

func (*InMemoryBackend) DeleteTags

func (b *InMemoryBackend) DeleteTags(resourceARN string, tagKeys []string) error

DeleteTags removes the specified tag keys from a resource ARN. Real Amazon MQ returns NotFoundException for an ARN that names no broker or configuration (same SDK error-list evidence as ListTags). Note: b.tags[arn] and the corresponding broker/config Tags field share the same map pointer, so a single delete here updates both automatically.

func (*InMemoryBackend) DeleteUser

func (b *InMemoryBackend) DeleteUser(brokerID, username string) error

DeleteUser stages a broker user for removal. Real Amazon MQ only removes an ActiveMQ broker user on the next reboot: the user stays visible via DescribeUser/ListUsers with pendingChange=DELETE until then (see promoteBrokerReboot), matching how the create/update paths stage into User.Pending.

func (*InMemoryBackend) DescribeBroker

func (b *InMemoryBackend) DescribeBroker(brokerID string) (*Broker, error)

DescribeBroker returns a broker by ID or name.

func (*InMemoryBackend) DescribeBrokerEngineTypes

func (b *InMemoryBackend) DescribeBrokerEngineTypes(engineType string) []BrokerEngineType

DescribeBrokerEngineTypes returns supported broker engine types and versions. If engineType is non-empty, the result is filtered to that engine type.

func (*InMemoryBackend) DescribeBrokerInstanceOptions

func (b *InMemoryBackend) DescribeBrokerInstanceOptions(
	engineType, hostInstanceType, storageType string,
) []BrokerInstanceOption

DescribeBrokerInstanceOptions returns broker instance options. Filters are optional; empty string means no filter applied.

func (*InMemoryBackend) DescribeConfiguration

func (b *InMemoryBackend) DescribeConfiguration(configID string) (*Configuration, error)

DescribeConfiguration returns a configuration by ID.

func (*InMemoryBackend) DescribeConfigurationRevision

func (b *InMemoryBackend) DescribeConfigurationRevision(
	configID string,
	revision int32,
) (*ConfigurationRevision, string, error)

DescribeConfigurationRevision returns a specific revision of a configuration.

func (*InMemoryBackend) DescribeSharedResources added in v1.2.0

func (b *InMemoryBackend) DescribeSharedResources(brokerID string) ([]SharedResource, error)

DescribeSharedResources returns the resources shared to a broker via AWS Resource Access Manager (e.g. cross-account VPC subnets or configurations shared through a RAM resource share). This backend does not model RAM resource sharing, so it never fabricates a shared resource entry: the broker ID is validated against real backend state exactly like DescribeBroker, and a valid broker honestly reports zero shared resources.

func (*InMemoryBackend) DescribeUser

func (b *InMemoryBackend) DescribeUser(brokerID, username string) (*User, error)

DescribeUser returns a user from a broker.

func (*InMemoryBackend) ListBrokers

func (b *InMemoryBackend) ListBrokers() []*Broker

ListBrokers returns all brokers sorted by name.

func (*InMemoryBackend) ListConfigurationRevisions

func (b *InMemoryBackend) ListConfigurationRevisions(configID string) ([]ConfigurationRevision, error)

ListConfigurationRevisions returns all revisions for a configuration.

func (*InMemoryBackend) ListConfigurations

func (b *InMemoryBackend) ListConfigurations() []*Configuration

ListConfigurations returns all configurations sorted by name.

func (*InMemoryBackend) ListTags

func (b *InMemoryBackend) ListTags(resourceARN string) (map[string]string, error)

ListTags returns tags for a resource ARN. Real Amazon MQ returns NotFoundException for an ARN that names no broker or configuration (confirmed from the pinned SDK: ListTags's error list in aws-sdk-go-v2/service/mq/deserializers.go includes NotFoundException).

func (*InMemoryBackend) ListUsers

func (b *InMemoryBackend) ListUsers(brokerID string) ([]UserSummary, error)

ListUsers returns all users for a broker.

func (*InMemoryBackend) Promote

func (b *InMemoryBackend) Promote(brokerID, mode string) (*Broker, error)

Promote promotes a data-replication replica broker to the primary role, interchanging its DataReplicationRole from REPLICA to PRIMARY (mq@v1.39.4 api_op_Promote.go: "Promotes a data replication replica broker to the primary broker role"; types.DataReplicationMetadataOutput.DataReplicationRole doc: "When a replica broker is promoted to primary, this role is interchanged"). A broker with no active CRDR replica role is rejected -- Promote is documented as operating only on a replica, not any broker.

func (*InMemoryBackend) RebootBroker

func (b *InMemoryBackend) RebootBroker(brokerID string) error

RebootBroker simulates a broker reboot. The broker transitions to REBOOT_IN_PROGRESS once, then is restored to RUNNING on the next DescribeBroker / ListBrokers call so callers can observe the transition.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the region configured for this backend.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all backend state, preserving only the account ID and region.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state to JSON.

func (*InMemoryBackend) TaggedResources added in v1.2.0

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every MQ resource ARN that currently has at least one tag.

func (*InMemoryBackend) UpdateBroker

func (b *InMemoryBackend) UpdateBroker(
	brokerID, engineVersion, hostInstanceType string,
	autoMinorVersionUpgrade *bool,
	securityGroups []string,
) (*Broker, error)

UpdateBroker updates mutable broker fields (compatibility wrapper).

func (*InMemoryBackend) UpdateBrokerWithOptions

func (b *InMemoryBackend) UpdateBrokerWithOptions(
	brokerID, engineVersion, hostInstanceType string,
	autoMinorVersionUpgrade *bool,
	securityGroups []string,
	opts *UpdateBrokerOptions,
) (*Broker, error)

UpdateBrokerWithOptions updates mutable broker fields including optional extended fields.

func (*InMemoryBackend) UpdateConfiguration

func (b *InMemoryBackend) UpdateConfiguration(configID, description, data string) (*Configuration, error)

UpdateConfiguration updates a configuration (creates a new revision).

func (*InMemoryBackend) UpdateUser

func (b *InMemoryBackend) UpdateUser(
	brokerID, username, password string, groups []string, console, replicationUser *bool,
) error

UpdateUser updates a broker user. Console/Groups changes are staged into the user's Pending block (see CreateUser) since real Amazon MQ only applies them on the next reboot -- DescribeUser's top-level consoleAccess/groups keep showing the pre-update values until then. The password is applied immediately: it is never echoed back on any wire response (DescribeUser/ListUsers never include it), so there is no observable "staged vs. live" distinction to model, and aws-sdk-go-v2/service/mq/types.UserPendingChanges has no password field to stage it into. replicationUser applies immediately for the same reason -- UserPendingChanges has no replicationUser field either.

type LdapServerMetadata

type LdapServerMetadata struct {
	RoleBase               string   `json:"roleBase"`
	RoleName               string   `json:"roleName,omitempty"`
	RoleSearchMatching     string   `json:"roleSearchMatching"`
	UserBase               string   `json:"userBase"`
	UserRoleName           string   `json:"userRoleName,omitempty"`
	UserSearchMatching     string   `json:"userSearchMatching"`
	ServiceAccountUsername string   `json:"serviceAccountUsername"`
	ServiceAccountPassword string   `json:"serviceAccountPassword,omitempty"`
	Hosts                  []string `json:"hosts"`
	RoleSearchSubtree      bool     `json:"roleSearchSubtree"`
	UserSearchSubtree      bool     `json:"userSearchSubtree"`
}

LdapServerMetadata configures LDAP authentication for a broker.

ServiceAccountPassword uses a real json tag (not "-") so it decodes from CreateBroker/UpdateBroker request bodies (handler_brokers.go reuses this struct as the wire input shape); MarshalJSON below redacts it from every encode, matching AWS's split between LdapServerMetadataInput (has the password) and LdapServerMetadataOutput (does not) in aws-sdk-go-v2/service/mq/types/types.go. RoleBase/RoleSearchMatching/UserBase/UserSearchMatching/ ServiceAccountUsername/Hosts have no omitempty: all six are LdapServerMetadataOutput's "This member is required" fields (mq@v1.39.4 types/types.go:381-425), but as *string/[]string on the real wire the client-side required check (validators.go:564-589) only rejects nil, not empty -- and this struct is reused directly as the CreateBroker/UpdateBroker wire input shape, so a legitimate empty value must round-trip, not vanish. RoleName/UserRoleName stay optional (genuinely not required).

func (LdapServerMetadata) MarshalJSON added in v1.5.0

func (l LdapServerMetadata) MarshalJSON() ([]byte, error)

MarshalJSON redacts ServiceAccountPassword: it must decode from request bodies but never appear in a response or a persistence snapshot.

type Logs

type Logs struct {
	Audit   bool `json:"audit"`
	General bool `json:"general"`
}

Logs configures CloudWatch Logs export for an Amazon MQ broker.

type LogsSummary

type LogsSummary struct {
	Pending         *Logs  `json:"pending,omitempty"`
	GeneralLogGroup string `json:"generalLogGroup,omitempty"`
	AuditLogGroup   string `json:"auditLogGroup,omitempty"`
	General         bool   `json:"general"`
	Audit           bool   `json:"audit"`
}

LogsSummary holds the configured logs plus their resolved log group ARNs.

type Provider

type Provider struct{}

Provider implements service.Provider for Amazon MQ.

func (*Provider) Init

Init initializes the Amazon MQ backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type SharedResource added in v1.2.0

type SharedResource struct {
	Error             *SharedResourceError `json:"error,omitempty"`
	ResourceArn       string               `json:"resourceArn"`
	Status            string               `json:"status"`
	Type              string               `json:"type"`
	DNSNames          []string             `json:"dnsNames,omitempty"`
	ResourceShareArns []string             `json:"resourceShareArns,omitempty"`
}

SharedResource describes a single resource shared to a broker via AWS Resource Access Manager (cross-account VPC subnets/configurations shared through a RAM resource share). This backend does not model RAM resource sharing, so DescribeSharedResources never populates one -- the type exists only to document the real DescribeSharedResourcesOutput wire shape.

type SharedResourceError added in v1.2.0

type SharedResourceError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

SharedResourceError describes an error encountered provisioning a shared resource.

type StorageBackend

type StorageBackend interface {
	// Broker operations
	CreateBroker(
		name, deploymentMode, engineType, engineVersion, hostInstanceType string,
		publiclyAccessible, autoMinorVersionUpgrade bool,
		securityGroups, subnetIDs []string,
		users []*User,
		tags map[string]string,
	) (*Broker, error)
	CreateBrokerWithOptions(
		name, deploymentMode, engineType, engineVersion, hostInstanceType string,
		publiclyAccessible, autoMinorVersionUpgrade bool,
		securityGroups, subnetIDs []string,
		users []*User,
		tags map[string]string,
		opts *CreateBrokerOptions,
	) (*Broker, error)
	DescribeBroker(brokerID string) (*Broker, error)
	ListBrokers() []*Broker
	UpdateBroker(
		brokerID, engineVersion, hostInstanceType string,
		autoMinorVersionUpgrade *bool,
		securityGroups []string,
	) (*Broker, error)
	UpdateBrokerWithOptions(
		brokerID, engineVersion, hostInstanceType string,
		autoMinorVersionUpgrade *bool,
		securityGroups []string,
		opts *UpdateBrokerOptions,
	) (*Broker, error)
	DeleteBroker(brokerID string) (*Broker, error)
	RebootBroker(brokerID string) error
	Promote(brokerID, mode string) (*Broker, error)
	DescribeSharedResources(brokerID string) ([]SharedResource, error)

	// User operations
	CreateUser(brokerID, username, password string, groups []string, console, replicationUser bool) error
	DescribeUser(brokerID, username string) (*User, error)
	UpdateUser(brokerID, username, password string, groups []string, console, replicationUser *bool) error
	DeleteUser(brokerID, username string) error
	ListUsers(brokerID string) ([]UserSummary, error)

	// Configuration operations
	CreateConfiguration(
		name, description, engineType, engineVersion, authenticationStrategy string,
		tags map[string]string,
	) (*Configuration, error)
	DescribeConfiguration(configID string) (*Configuration, error)
	ListConfigurations() []*Configuration
	UpdateConfiguration(configID, description, data string) (*Configuration, error)
	DeleteConfiguration(configID string) error

	// Configuration revision operations
	DescribeConfigurationRevision(configID string, revision int32) (*ConfigurationRevision, string, error)
	ListConfigurationRevisions(configID string) ([]ConfigurationRevision, error)

	// Broker metadata operations
	DescribeBrokerEngineTypes(engineType string) []BrokerEngineType
	DescribeBrokerInstanceOptions(engineType, hostInstanceType, storageType string) []BrokerInstanceOption

	// Tag operations
	ListTags(resourceARN string) (map[string]string, error)
	CreateTags(resourceARN string, tags map[string]string) error
	DeleteTags(resourceARN string, tagKeys []string) error

	// Lifecycle
	Reset()
	Region() string
	AccountID() string
	Snapshot(ctx context.Context) []byte
	Restore(ctx context.Context, data []byte) error
}

StorageBackend defines the interface for the Amazon MQ in-memory backend. All mutating methods must be safe for concurrent use.

type TaggedEntry added in v1.2.0

type TaggedEntry struct {
	Tags map[string]string
	ARN  string
}

TaggedEntry pairs a resource ARN with its tag map, for cross-service tag enumeration by the Resource Groups Tagging API (see cli.go's wireTaggingMQ). MQ keeps tags for both resource kinds it supports (brokers and configurations) in one flat ARN-keyed map, so this is a direct walk of that map instead of one per-kind loop.

type UpdateBrokerOptions

type UpdateBrokerOptions struct {
	Logs                       *Logs
	LdapServerMetadata         *LdapServerMetadata
	MaintenanceWindowStartTime *WeeklyStartTime
	Configuration              *ConfigurationID
	AuthenticationStrategy     string
	DataReplicationMode        string
	// ResourceShareArns is UpdateBrokerInput.ResourceShareArns ("The list
	// of resource shares to update on the broker"). This backend does not
	// model AWS RAM resource sharing (see DescribeSharedResources), so the
	// list is accepted and echoed back on UpdateBrokerOutput.ResourceShareArns
	// without any real sharing behavior -- the same accept-and-echo
	// treatment already given to DataReplicationMode/CRDR.
	ResourceShareArns []string
	// StorageSize is UpdateBrokerInput.StorageSize. Like EngineVersion/
	// HostInstanceType, it stages into Broker.PendingStorageSize and only
	// takes effect on the next reboot (DescribeBrokerOutput.PendingStorageSize).
	StorageSize int32
}

UpdateBrokerOptions carries optional fields for UpdateBrokerWithOptions. Zero values are ignored and treated as "not specified".

type User

type User struct {
	Pending         *UserPendingChanges `json:"pending,omitempty"`
	Username        string              `json:"username"`
	Password        string              `json:"-"`
	Groups          []string            `json:"groups,omitempty"`
	Console         bool                `json:"consoleAccess"`
	ReplicationUser bool                `json:"replicationUser,omitempty"`
}

User represents an Amazon MQ broker user.

Pending holds a not-yet-applied create/update/delete: real Amazon MQ only applies ActiveMQ broker-user changes on the next broker reboot (see aws-sdk-go-v2/service/mq/types.UserPendingChanges). Password intentionally keeps the json:"-" tag even though the rest of User now persists across Snapshot/Restore (see store_setup.go) -- matching the same secrets-out-of- the-persisted-blob precedent already used for LdapServerMetadata.ServiceAccountPassword, a restored user's password is always blank and must be reset via UpdateUser.

type UserPendingChanges added in v1.2.0

type UserPendingChanges struct {
	Console       *bool    `json:"consoleAccess,omitempty"`
	PendingChange string   `json:"pendingChange"`
	Groups        []string `json:"groups,omitempty"`
}

UserPendingChanges mirrors aws-sdk-go-v2/service/mq/types.UserPendingChanges: the not-yet-applied create/update/delete staged for a broker user, applied atomically when the broker next reboots.

type UserSummary

type UserSummary struct {
	Username      string `json:"username"`
	PendingChange string `json:"pendingChange,omitempty"`
}

UserSummary is a summary of a broker user (returned in lists). Real aws-sdk-go-v2/service/mq/types.UserSummary carries only username and pendingChange -- no consoleAccess -- see ListUsersOutput/DescribeBrokerOutput.Users.

type WeeklyStartTime

type WeeklyStartTime struct {
	DayOfWeek string `json:"dayOfWeek,omitempty"`
	TimeOfDay string `json:"timeOfDay"`
	TimeZone  string `json:"timeZone,omitempty"`
}

WeeklyStartTime defines the broker maintenance window start time. TimeOfDay has no omitempty: it's *string on the real wire (mq@v1.39.4 types/types.go:677), so the client-side required check (validators.go:623-625) only rejects nil, not an empty string, and this struct is reused directly as the CreateBroker/UpdateBroker wire input shape -- a legitimate empty value must round-trip, not vanish.

Jump to

Keyboard shortcuts

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