mq

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 24 Imported by: 0

README

Amazon MQ

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

Coverage

Metric Value
Operations audited 25 (23 ok, 2 partial)
Feature families 2 (2 ok)
Known gaps 2
Deferred items 1
Resource leaks clean
Known gaps
  • 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.
  • cli.go's wireTaggingMQ (resourcegroupstaggingapi wiring) discards the error DeleteTags now returns, always reporting success to the Resource Groups Tagging API even for an unknown ARN. Needs a cli.go change out of scope for this pass -- see DeleteTags's op note.
Deferred
  • Full CRDR (cross-region data replication) simulation: Promote/DataReplicationMetadata population when dataReplicationMode=CRDR is not modeled beyond accepting/echoing the mode string and (as of this pass) seeding DataReplicationMetadata.DataReplicationCounterpart from CreateBroker's dataReplicationPrimaryBrokerArn. 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.

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"
)

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"`
	PubliclyAccessible         bool                     `json:"publiclyAccessible"`
	AutoMinorVersionUpgrade    bool                     `json:"autoMinorVersionUpgrade"`
}

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"`
	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"`
	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
}

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

type DataReplicationMetadata

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

DataReplicationMetadata describes an active CRDR (cross-region disaster recovery) link.

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 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 standby broker to the primary role. In the in-memory stub this is a no-op that validates the broker exists.

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,omitempty"`
	RoleName               string   `json:"roleName,omitempty"`
	RoleSearchMatching     string   `json:"roleSearchMatching,omitempty"`
	UserBase               string   `json:"userBase,omitempty"`
	UserRoleName           string   `json:"userRoleName,omitempty"`
	UserSearchMatching     string   `json:"userSearchMatching,omitempty"`
	ServiceAccountUsername string   `json:"serviceAccountUsername,omitempty"`
	ServiceAccountPassword string   `json:"-"`
	Hosts                  []string `json:"hosts,omitempty"`
	RoleSearchSubtree      bool     `json:"roleSearchSubtree"`
	UserSearchSubtree      bool     `json:"userSearchSubtree"`
}

LdapServerMetadata configures LDAP authentication for a broker.

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 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
}

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"`
	Console       bool   `json:"consoleAccess"`
}

UserSummary is a summary of a broker user (returned in lists).

type WeeklyStartTime

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

WeeklyStartTime defines the broker maintenance window start time.

Jump to

Keyboard shortcuts

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