directconnect

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package directconnect emulates the AWS Direct Connect control-plane API (aws-sdk-go-v2/service/directconnect, protocol awsjson1.1 -- a single POST / dispatched by X-Amz-Target: OvertureService.<Op>, not REST). See PARITY.md for the full pre-implementation audit this package was built from, including the honest-gap list for the partner/reseller flow, LOA-CFA PDF content, the static Locations/RouterType reference catalogs, and DescribeCustomerMetadata's empty-by-default agreement list.

Index

Constants

View Source
const (
	ConnectionStateOrdering  = "ordering"
	ConnectionStateRequested = "requested"
	ConnectionStatePending   = "pending"
	ConnectionStateAvailable = "available"
	ConnectionStateDown      = "down"
	ConnectionStateDeleting  = "deleting"
	ConnectionStateDeleted   = "deleted"
	ConnectionStateRejected  = "rejected"
	ConnectionStateUnknown   = "unknown"
)

ConnectionState wire values (types.ConnectionState). ordering is specific to a hosted connection (see AllocateHostedConnection/ AllocateConnectionOnInterconnect); requested is the initial state of a standard connection created via CreateConnection.

View Source
const (
	LagStateRequested = "requested"
	LagStatePending   = "pending"
	LagStateAvailable = "available"
	LagStateDown      = "down"
	LagStateDeleting  = "deleting"
	LagStateDeleted   = "deleted"
	LagStateUnknown   = "unknown"
)

LagState / InterconnectState wire values -- both 7-value enums, identical shape, no "ordering" (neither is ever a hosted sub-resource).

View Source
const (
	InterconnectStateRequested = "requested"
	InterconnectStatePending   = "pending"
	InterconnectStateAvailable = "available"
	InterconnectStateDown      = "down"
	InterconnectStateDeleting  = "deleting"
	InterconnectStateDeleted   = "deleted"
	InterconnectStateUnknown   = "unknown"
)
View Source
const (
	VifStateConfirming = "confirming"
	VifStateVerifying  = "verifying"
	VifStatePending    = "pending"
	VifStateAvailable  = "available"
	VifStateDown       = "down"
	VifStateTesting    = "testing"
	VifStateDeleting   = "deleting"
	VifStateDeleted    = "deleted"
	VifStateRejected   = "rejected"
	VifStateUnknown    = "unknown"
)

VirtualInterfaceState wire values (types.VirtualInterfaceState) -- the richest, 10-value enum in this service.

View Source
const (
	GatewayStatePending   = "pending"
	GatewayStateAvailable = "available"
	GatewayStateDeleting  = "deleting"
	GatewayStateDeleted   = "deleted"
)

DirectConnectGatewayState wire values.

View Source
const (
	AssociationStateAssociating    = "associating"
	AssociationStateAssociated     = "associated"
	AssociationStateDisassociating = "disassociating"
	AssociationStateDisassociated  = "disassociated"
	AssociationStateUpdating       = "updating"
)

DirectConnectGatewayAssociationState wire values -- the only state enum in this service with a mid-lifecycle "updating" value.

View Source
const (
	ProposalStateRequested = "requested"
	ProposalStateAccepted  = "accepted"
	ProposalStateDeleted   = "deleted"
)

DirectConnectGatewayAssociationProposalState wire values -- only 3 values, no "rejected" (declining is: never accept, then the proposer deletes it).

View Source
const (
	AttachmentStateAttaching = "attaching"
	AttachmentStateAttached  = "attached"
	AttachmentStateDetaching = "detaching"
	AttachmentStateDetached  = "detached"
)

DirectConnectGatewayAttachmentState wire values (derived, computed from a VIF's own state -- see gateways.go's attachmentFromVIF).

View Source
const (
	AttachmentTypeTransit = "TransitVirtualInterface"
	AttachmentTypePrivate = "PrivateVirtualInterface"
)

DirectConnectGatewayAttachmentType wire values -- only TransitVirtualInterface/PrivateVirtualInterface exist; public VIFs structurally cannot attach to a gateway.

View Source
const (
	GatewayTypeVirtualPrivateGateway = "virtualPrivateGateway"
	GatewayTypeTransitGateway        = "transitGateway"
)

GatewayType wire values (types.GatewayType).

View Source
const (
	VifTypePrivate = "private"
	VifTypePublic  = "public"
	VifTypeTransit = "transit"
)

VirtualInterfaceType wire values -- a bare *string on the wire (types.go confirms no typed enum exists), not one of this service's generated enum types.

View Source
const (
	MacSecStateAssociating    = "associating"
	MacSecStateAssociated     = "associated"
	MacSecStateDisassociating = "disassociating"
	MacSecStateDisassociated  = "disassociated"
)

MacSecKey.State wire values -- bare string, not a typed enum (PARITY.md wire-trap #6).

View Source
const (
	HasLogicalRedundancyUnknown = "unknown"
	HasLogicalRedundancyYes     = "yes"
	HasLogicalRedundancyNo      = "no"
)

HasLogicalRedundancy wire values.

View Source
const (
	EncryptionModeNoEncrypt     = "no_encrypt"
	EncryptionModeShouldEncrypt = "should_encrypt"
	EncryptionModeMustEncrypt   = "must_encrypt"
)

Connection/Lag/Interconnect EncryptionMode wire values -- bare *string, not a typed enum.

View Source
const (
	PortEncryptionUp   = "Encryption Up"
	PortEncryptionDown = "Encryption Down"
)

Connection/Lag/Interconnect PortEncryptionStatus wire values -- bare *string, not a typed enum.

View Source
const (
	BGPPeerStateVerifying = "verifying"
	BGPPeerStatePending   = "pending"
	BGPPeerStateAvailable = "available"
	BGPPeerStateDeleting  = "deleting"
	BGPPeerStateDeleted   = "deleted"
)

BGPPeerState wire values (the peer's lifecycle, distinct from BgpStatus's operational up/down axis).

View Source
const (
	BGPStatusUp      = "up"
	BGPStatusDown    = "down"
	BGPStatusUnknown = "unknown"
)

BGPStatus wire values (the peer's operational up/down state).

View Source
const (
	AddressFamilyIPv4 = "ipv4"
	AddressFamilyIPv6 = "ipv6"
)

AddressFamily wire values.

View Source
const (
	NniPartnerTypeV1         = "v1"
	NniPartnerTypeV2         = "v2"
	NniPartnerTypeNonPartner = "nonPartner"
)

NniPartnerType wire values -- DescribeCustomerMetadata always returns nonPartner (see PARITY.md's honest-gap section: no real agreement workflow modeled).

View Source
const LoaContentTypePdf = "application/pdf"

LoaContentTypePdf is the only LoaContentType value this SDK models.

Variables

View Source
var ErrNilAppContext = errors.New("AppContext is required")

ErrNilAppContext is returned by Provider.Init when appCtx is nil.

Functions

This section is empty.

Types

type BGPPeer

type BGPPeer struct {
	BgpPeerID          string
	BgpPeerState       string
	BgpStatus          string
	AddressFamily      string
	AmazonAddress      string
	CustomerAddress    string
	AuthKey            string
	AwsDeviceV2        string
	AwsLogicalDeviceID string
	AsnValue           int64
	AsnProvided        bool
}

BGPPeer mirrors types.BGPPeer. AsnProvided/AsnValue back the dual Asn/AsnLong zero-out rule from PARITY.md wire-trap #5 -- see wire_convert.go's asnWireFields.

Stored as []*BGPPeer (not []BGPPeer) on VirtualInterface for the same stable-pointer reason MacSecKey is -- StartBgpFailoverTest schedules a timer against one peer's BgpStatus field, and CreateBGPPeer/DeleteBGPPeer append/remove elements of the same slice.

type Connection

type Connection struct {
	Tags              *tags.Tags
	LoaIssueTime      *time.Time
	RateLimiterStatus *RateLimiterStatus
	ConnectionID      string
	ConnectionName    string
	ConnectionState   string
	Bandwidth         string
	Location          string
	Region            string
	// LagID is set when this connection is a member of a LAG (via CreateLag
	// or AssociateConnectionWithLag).
	LagID                string
	OwnerAccount         string
	ProviderName         string
	PartnerName          string
	AwsDeviceV2          string
	AwsLogicalDeviceID   string
	HasLogicalRedundancy string
	EncryptionMode       string
	PortEncryptionStatus string
	// InterconnectID is set for a connection allocated via
	// AllocateConnectionOnInterconnect -- the parent Interconnect it rides
	// on. Empty for a standard connection.
	InterconnectID string
	// ParentConnectionID is set for a connection allocated via
	// AllocateHostedConnection onto an existing standard Connection (as
	// opposed to a LAG, tracked via LagID, or an Interconnect, tracked via
	// InterconnectID) and reassignable via AssociateHostedConnection.
	ParentConnectionID               string
	MacSecKeys                       []*MacSecKey
	Vlan                             int32
	JumboFrameCapable                bool
	MacSecCapable                    bool
	PartnerInterconnectMacSecCapable bool
}

Connection is the internal state of one Direct Connect connection (a standard, hosted, or partner-allocated connection -- see PARITY.md's "Hosted connections, interconnects, and the partner/reseller flow" section for the honest bookkeeping-only scope of the latter two).

type DirectConnectGateway

type DirectConnectGateway struct {
	Tags                      *tags.Tags
	DirectConnectGatewayID    string
	DirectConnectGatewayName  string
	DirectConnectGatewayState string
	OwnerAccount              string
	StateChangeError          string
	AmazonSideAsn             int64
}

DirectConnectGateway is the internal state of one Direct Connect gateway -- a GLOBAL (non-regional) resource, see PARITY.md's ARN section and store.go's GatewayARN. The name deliberately mirrors the real SDK type types.DirectConnectGateway rather than shortening to "Gateway": a shorter name would collide in meaning with this package's existing GatewayAssociation/GatewayAssociationProposal.GatewayID, which names the ASSOCIATED VGW/TGW -- a different concept entirely.

type EC2GatewayResolver

type EC2GatewayResolver interface {
	// ResolveVpnGateway reports whether id names a real EC2 VpnGateway.
	ResolveVpnGateway(id string) bool
	// ResolveTransitGateway reports whether id names a real EC2
	// TransitGateway.
	ResolveTransitGateway(id string) bool
	// VirtualGateways returns every VGW id known to EC2, for
	// DescribeVirtualGateways to proxy from rather than maintaining a
	// second, duplicate VGW store (see PARITY.md).
	VirtualGateways() []string
}

EC2GatewayResolver lets this backend validate/resolve a virtual private gateway or transit gateway id against the real services/ec2 backend, rather than accepting any string unchecked -- see PARITY.md's "EC2 VPN/Transit Gateway binding" section. Both methods return ok=false when the id does not resolve to a real EC2 resource. Optional: a nil resolver (the default) means every GatewayId/VirtualGatewayId is accepted unvalidated, which is still honest (this service's own SDK does not require a specific VGW/TGW to exist either) but forgoes the cross-service check when EC2 isn't wired in (e.g. isolated unit tests).

type GatewayAssociation

type GatewayAssociation struct {
	AssociationID                    string
	DirectConnectGatewayID           string
	DirectConnectGatewayOwnerAccount string
	AssociationState                 string
	StateChangeError                 string
	GatewayID                        string
	GatewayOwnerAccount              string
	GatewayRegion                    string
	GatewayType                      string
	AllowedPrefixes                  []RouteFilterPrefix
}

GatewayAssociation is the internal state of one association between a DirectConnectGateway and a virtual private gateway or transit gateway. GatewayType/GatewayID/GatewayOwnerAccount/GatewayRegion back the modern AssociatedGateway wire shape; VirtualGatewayID/VirtualGatewayOwnerAccount (the legacy fields) are kept in sync whenever GatewayType is virtualPrivateGateway -- see PARITY.md's note that both must stay populated in parallel, not just one or the other.

type GatewayAssociationProposal

type GatewayAssociationProposal struct {
	ProposalID                       string
	DirectConnectGatewayID           string
	DirectConnectGatewayOwnerAccount string
	ProposalState                    string
	GatewayID                        string
	GatewayOwnerAccount              string
	GatewayRegion                    string
	GatewayType                      string
	ExistingAllowedPrefixes          []RouteFilterPrefix
	RequestedAllowedPrefixes         []RouteFilterPrefix
}

GatewayAssociationProposal is the internal state of one cross-account association proposal -- see PARITY.md's "cross-account proposal flow" section for the proposer/accepter directionality this backend assumes.

type Handler

type Handler struct {
	Backend *InMemoryBackend
}

Handler is the HTTP handler for the AWS Direct Connect API.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a new Direct Connect 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 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 extracts the operation name from the X-Amz-Target header.

func (*Handler) ExtractResource

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

ExtractResource extracts the primary resource identifier from the request body -- whichever of this service's common id/ARN field names is present, matching services/acmpca's extractFirstResourceByKeys pattern.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations returns every operation this handler routes -- all 63 operations on the aws-sdk-go-v2/service/directconnect client, per sdk_completeness_test.go's empty exception list.

func (*Handler) Handler

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

Handler returns the Echo handler function for Direct Connect requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority. This service is matched by an exact X-Amz-Target prefix (every op carries the literal "OvertureService." prefix), the same tier DynamoDB/Kinesis-style header-exact services use.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all stored state in the backend.

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 matcher that reports true iff the request carries this service's exact X-Amz-Target prefix.

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 is the in-memory store for AWS Direct Connect.

A single coarse lock guards every collection below: operations routinely cross resource boundaries (AssociateConnectionWithLag reads+writes both a Connection and its new Lag; DeleteResiliencyPolicy-style FK checks scan one table while mutating another), so the invariant boundary is the whole backend -- see .claude/memories/pkgs-catalog.md's locking rule.

func NewInMemoryBackend

func NewInMemoryBackend(ctx context.Context, accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory AWS Direct Connect backend.

func (*InMemoryBackend) AcceptDirectConnectGatewayAssociationProposal

func (b *InMemoryBackend) AcceptDirectConnectGatewayAssociationProposal(
	req *acceptGatewayAssociationProposalRequest,
) (*GatewayAssociation, error)

AcceptDirectConnectGatewayAssociationProposal accepts a pending proposal, creating the resulting association. ASSUMPTION, documented per PARITY.md: AssociatedGatewayOwnerAccount is treated as the accepter's confirmation of who owns the associated (VGW/TGW) gateway -- i.e. it should match the proposal's own GatewayOwnerAccount -- rather than the accepter's own account identity. This backend simulates only one AWS account at a time, so it cannot cross-validate this against a second, real caller identity; it is recorded and required to be non-empty, not strictly checked against a second account. This is a defensible reading of the field names, NOT a verified AWS behavior (see PARITY.md's top-5-hardest-things section).

func (*InMemoryBackend) AccountID

func (b *InMemoryBackend) AccountID() string

AccountID returns the account ID for this backend.

func (*InMemoryBackend) AllocateConnectionOnInterconnect

func (b *InMemoryBackend) AllocateConnectionOnInterconnect(
	req *allocateConnectionOnInterconnectRequest,
) (*Connection, error)

AllocateConnectionOnInterconnect creates a Connection hosted on an existing Interconnect for a named end-customer OwnerAccount -- the partner/reseller flow, real bookkeeping only (see PARITY.md).

func (*InMemoryBackend) AllocateHostedConnection

func (b *InMemoryBackend) AllocateHostedConnection(req *allocateHostedConnectionRequest) (*Connection, error)

AllocateHostedConnection creates a Connection hosted on an existing Connection or LAG for a named end-customer OwnerAccount.

func (*InMemoryBackend) AllocatePrivateVirtualInterface

func (b *InMemoryBackend) AllocatePrivateVirtualInterface(
	connectionID, ownerAccount string, n *newPrivateVifAllocationWire,
) (*VirtualInterface, error)

AllocatePrivateVirtualInterface allocates a cross-account private VIF.

func (*InMemoryBackend) AllocatePublicVirtualInterface

func (b *InMemoryBackend) AllocatePublicVirtualInterface(
	connectionID, ownerAccount string, n *newPublicVifAllocationWire,
) (*VirtualInterface, error)

AllocatePublicVirtualInterface allocates a cross-account public VIF.

func (*InMemoryBackend) AllocateTransitVirtualInterface

func (b *InMemoryBackend) AllocateTransitVirtualInterface(
	connectionID, ownerAccount string, n *newTransitVifAllocationWire,
) (*VirtualInterface, error)

AllocateTransitVirtualInterface allocates a cross-account transit VIF.

func (*InMemoryBackend) AssociateConnectionWithLag

func (b *InMemoryBackend) AssociateConnectionWithLag(connectionID, lagID string) (*Connection, error)

AssociateConnectionWithLag moves an existing standalone connection into lagID, enforcing the LAG's own bandwidth-derived capacity (see lagMaxConnections) -- the one op in this service where LimitExceededException is reachable without any Tags input (PARITY.md wire-trap #8).

func (*InMemoryBackend) AssociateHostedConnection

func (b *InMemoryBackend) AssociateHostedConnection(req *associateHostedConnectionRequest) (*Connection, error)

AssociateHostedConnection reassigns an already-hosted connection to a different parent connection or LAG.

func (*InMemoryBackend) AssociateMacSecKey

func (b *InMemoryBackend) AssociateMacSecKey(req *associateMacSecKeyRequest) (string, []*MacSecKey, error)

AssociateMacSecKey associates a MACsec key (either a raw Cak/Ckn pair or a pre-existing SecretARN) with a Connection.

func (*InMemoryBackend) AssociateVirtualInterface

func (b *InMemoryBackend) AssociateVirtualInterface(vifID, targetID string) (*VirtualInterface, error)

AssociateVirtualInterface moves an already-provisioned VIF onto a different connection or LAG.

func (*InMemoryBackend) Close

func (b *InMemoryBackend) Close()

Close stops all scheduled state-transition timers so none outlives the backend. Safe to call multiple times.

func (*InMemoryBackend) ConfirmConnection

func (b *InMemoryBackend) ConfirmConnection(connectionID string) (string, error)

ConfirmConnection confirms a hosted connection (in "ordering") into "pending"/"available".

func (*InMemoryBackend) ConfirmPrivateVirtualInterface

func (b *InMemoryBackend) ConfirmPrivateVirtualInterface(
	vifID, directConnectGatewayID, virtualGatewayID string,
) (string, error)

ConfirmPrivateVirtualInterface confirms a cross-account private VIF.

func (*InMemoryBackend) ConfirmPublicVirtualInterface

func (b *InMemoryBackend) ConfirmPublicVirtualInterface(vifID string) (string, error)

ConfirmPublicVirtualInterface confirms a cross-account public VIF.

func (*InMemoryBackend) ConfirmTransitVirtualInterface

func (b *InMemoryBackend) ConfirmTransitVirtualInterface(vifID, directConnectGatewayID string) (string, error)

ConfirmTransitVirtualInterface confirms a cross-account transit VIF, binding it to directConnectGatewayID (required at confirm time even though optional at create time -- PARITY.md).

func (*InMemoryBackend) ConnectionARN

func (b *InMemoryBackend) ConnectionARN(id string) string

ConnectionARN builds the ARN for a Connection ID. Confirmed shape (real Terraform AWS provider source, internal/service/directconnect/connection.go): "arn:{partition}:directconnect:{region}:{account}:dxcon/{id}".

func (*InMemoryBackend) CreateBGPPeer

func (b *InMemoryBackend) CreateBGPPeer(vifID string, n *newBGPPeerWire) (*VirtualInterface, error)

CreateBGPPeer adds a new BGP peer to the named VirtualInterface's BgpPeers list. VirtualInterfaceId is not marked required at the Go struct level (PARITY.md), but this backend cannot honor the op without it.

func (*InMemoryBackend) CreateConnection

func (b *InMemoryBackend) CreateConnection(req *createConnectionRequest) (*Connection, error)

CreateConnection creates a new standard (non-hosted) Connection, starting in the "requested" state and auto-progressing to "pending" then "available" -- see PARITY.md's ConnectionState notes.

func (*InMemoryBackend) CreateDirectConnectGateway

func (b *InMemoryBackend) CreateDirectConnectGateway(
	req *createDirectConnectGatewayRequest,
) (*DirectConnectGateway, error)

CreateDirectConnectGateway creates a new, GLOBAL DirectConnectGateway (see store.go's GatewayARN). No tag-exceptions are modeled for this op despite it accepting Tags (confirmed by direct per-op grep -- PARITY.md), so unlike every other Tags-accepting Create* op in this service, this one does NOT call validateNewTags.

func (*InMemoryBackend) CreateDirectConnectGatewayAssociation

func (b *InMemoryBackend) CreateDirectConnectGatewayAssociation(
	req *createGatewayAssociationRequest,
) (*GatewayAssociation, error)

CreateDirectConnectGatewayAssociation associates a DirectConnectGateway (same-account) with a virtual private gateway or transit gateway. Accepts either GatewayId (generic, either kind) or the older VirtualGatewayId (VGW-only) -- neither required at the struct level (PARITY.md wire-trap #3); this checks whichever field is actually present rather than assuming one canonical addressing mode.

func (*InMemoryBackend) CreateDirectConnectGatewayAssociationProposal

func (b *InMemoryBackend) CreateDirectConnectGatewayAssociationProposal(
	req *createGatewayAssociationProposalRequest,
) (*GatewayAssociationProposal, error)

CreateDirectConnectGatewayAssociationProposal creates a cross-account proposal from the (implicit, single-account-simulated) VGW/TGW owner to the named DirectConnectGatewayOwnerAccount -- see PARITY.md's cross-account proposal flow notes.

func (*InMemoryBackend) CreateInterconnect

func (b *InMemoryBackend) CreateInterconnect(req *createInterconnectRequest) (*Interconnect, error)

CreateInterconnect creates a new interconnect -- an AWS-internal/ partner-only resource in real life (interconnects are provisioned by Direct Connect Partners). See PARITY.md: honest state bookkeeping only, no physical cross-connect is simulated.

func (*InMemoryBackend) CreateLag

func (b *InMemoryBackend) CreateLag(req *createLagRequest) (*Lag, error)

CreateLag creates a new link aggregation group, provisioning NumberOfConnections fresh child connections (or converting an existing standalone ConnectionId into the LAG's first member, per PARITY.md).

func (*InMemoryBackend) CreatePrivateVirtualInterface

func (b *InMemoryBackend) CreatePrivateVirtualInterface(
	connectionID string, n *newPrivateVifWire,
) (*VirtualInterface, error)

CreatePrivateVirtualInterface creates a same-account private VIF.

func (*InMemoryBackend) CreatePublicVirtualInterface

func (b *InMemoryBackend) CreatePublicVirtualInterface(
	connectionID string, n *newPublicVifWire,
) (*VirtualInterface, error)

CreatePublicVirtualInterface creates a same-account public VIF.

func (*InMemoryBackend) CreateTransitVirtualInterface

func (b *InMemoryBackend) CreateTransitVirtualInterface(
	connectionID string, n *newTransitVifWire,
) (*VirtualInterface, error)

CreateTransitVirtualInterface creates a same-account transit VIF.

func (*InMemoryBackend) DeleteBGPPeer

func (b *InMemoryBackend) DeleteBGPPeer(req *deleteBGPPeerRequest) (*VirtualInterface, error)

DeleteBGPPeer removes the BGP peer identified by the given combination of Asn/AsnLong/BgpPeerId/CustomerAddress from vifID's BgpPeers list.

func (*InMemoryBackend) DeleteConnection

func (b *InMemoryBackend) DeleteConnection(connectionID string) (*Connection, error)

DeleteConnection transitions a Connection to "deleting" then "deleted" (or "rejected" for a hosted connection still in "ordering", per PARITY.md's ConnectionState notes -- customer-initiated deletion of an unconfirmed hosted connection).

func (*InMemoryBackend) DeleteDirectConnectGateway

func (b *InMemoryBackend) DeleteDirectConnectGateway(gatewayID string) (*DirectConnectGateway, error)

DeleteDirectConnectGateway transitions a gateway to "deleting" then "deleted". Real AWS rejects deletion while associations/attachments exist; this backend enforces the same FK-integrity check.

func (*InMemoryBackend) DeleteDirectConnectGatewayAssociation

func (b *InMemoryBackend) DeleteDirectConnectGatewayAssociation(
	req *deleteGatewayAssociationRequest,
) (*GatewayAssociation, error)

DeleteDirectConnectGatewayAssociation disassociates gateway from its VGW/ TGW, addressed either by AssociationId alone or the (DirectConnectGatewayId, VirtualGatewayId) pair.

func (*InMemoryBackend) DeleteDirectConnectGatewayAssociationProposal

func (b *InMemoryBackend) DeleteDirectConnectGatewayAssociationProposal(
	proposalID string,
) (*GatewayAssociationProposal, error)

DeleteDirectConnectGatewayAssociationProposal withdraws a pending proposal.

func (*InMemoryBackend) DeleteInterconnect

func (b *InMemoryBackend) DeleteInterconnect(interconnectID string) (string, error)

DeleteInterconnect transitions an interconnect to "deleting" then "deleted".

func (*InMemoryBackend) DeleteLag

func (b *InMemoryBackend) DeleteLag(lagID string) (*Lag, error)

DeleteLag transitions a LAG to "deleting" then "deleted".

func (*InMemoryBackend) DeleteVirtualInterface

func (b *InMemoryBackend) DeleteVirtualInterface(vifID string) (string, error)

DeleteVirtualInterface transitions a VIF to "deleting" then "deleted", or straight to the terminal "rejected" state if the owner declines it while still awaiting cross-account confirmation (PARITY.md).

func (*InMemoryBackend) DescribeConnectionLoa

func (b *InMemoryBackend) DescribeConnectionLoa(connectionID string) ([]byte, error)

DescribeConnectionLoa returns the current, nested LOA-CFA shape for a Connection, and records LoaIssueTime.

func (*InMemoryBackend) DescribeConnections

func (b *InMemoryBackend) DescribeConnections(connectionID string) []*Connection

DescribeConnections returns standard (non-hosted) connections, optionally filtered by a single ConnectionId.

func (*InMemoryBackend) DescribeConnectionsOnInterconnect

func (b *InMemoryBackend) DescribeConnectionsOnInterconnect(interconnectID string) []*Connection

DescribeConnectionsOnInterconnect returns the connections allocated on the given interconnect.

func (*InMemoryBackend) DescribeCustomerMetadata

func (b *InMemoryBackend) DescribeCustomerMetadata() describeCustomerMetadataResponse

DescribeCustomerMetadata always returns an empty Agreements list and NniPartnerType "nonPartner" -- see PARITY.md's honest-gap section: no real Direct Connect partner-agreement workflow is modeled.

func (*InMemoryBackend) DescribeDirectConnectGatewayAssociationProposals

func (b *InMemoryBackend) DescribeDirectConnectGatewayAssociationProposals(
	associatedGatewayID, gatewayID, proposalID string,
) []*GatewayAssociationProposal

DescribeDirectConnectGatewayAssociationProposals returns proposals, filtered independently by AssociatedGatewayId/DirectConnectGatewayId/ ProposalId when non-empty.

func (*InMemoryBackend) DescribeDirectConnectGatewayAssociations

func (b *InMemoryBackend) DescribeDirectConnectGatewayAssociations(
	associatedGatewayID, associationID, gatewayID, virtualGatewayID string,
) []*GatewayAssociation

DescribeDirectConnectGatewayAssociations returns associations, filtered independently by AssociatedGatewayId/AssociationId/DirectConnectGatewayId/ VirtualGatewayId when non-empty (PARITY.md: four independent optional filters, any combination).

func (*InMemoryBackend) DescribeDirectConnectGatewayAttachments

func (b *InMemoryBackend) DescribeDirectConnectGatewayAttachments(gatewayID, vifID string) []gatewayAttachmentWire

DescribeDirectConnectGatewayAttachments returns the derived attachment list, filtered independently by gatewayID and/or vifID when non-empty.

func (*InMemoryBackend) DescribeDirectConnectGateways

func (b *InMemoryBackend) DescribeDirectConnectGateways(gatewayID string) []*DirectConnectGateway

DescribeDirectConnectGateways returns gateways, optionally filtered by a single DirectConnectGatewayId.

func (*InMemoryBackend) DescribeHostedConnections

func (b *InMemoryBackend) DescribeHostedConnections(hostID string) []*Connection

DescribeHostedConnections returns the hosted (child) connections riding on the given hosting connection or LAG.

func (*InMemoryBackend) DescribeInterconnectLoa

func (b *InMemoryBackend) DescribeInterconnectLoa(interconnectID string) ([]byte, error)

DescribeInterconnectLoa returns the LOA-CFA for an Interconnect.

func (*InMemoryBackend) DescribeInterconnects

func (b *InMemoryBackend) DescribeInterconnects(interconnectID string) []*Interconnect

DescribeInterconnects returns interconnects, optionally filtered by a single InterconnectId.

func (*InMemoryBackend) DescribeLags

func (b *InMemoryBackend) DescribeLags(lagID string) []*Lag

DescribeLags returns LAGs, optionally filtered by a single LagId.

func (*InMemoryBackend) DescribeLoa

func (b *InMemoryBackend) DescribeLoa(connectionID string) ([]byte, error)

DescribeLoa returns the deprecated, flattened LOA-CFA shape for a Connection (PARITY.md wire-trap #7).

func (*InMemoryBackend) DescribeLocations

func (b *InMemoryBackend) DescribeLocations() []locationWire

DescribeLocations returns the static Location seed catalog.

func (*InMemoryBackend) DescribeRouterConfiguration

func (b *InMemoryBackend) DescribeRouterConfiguration(
	vifID, routerTypeIdentifier string,
) (*routerConfigurationResponse, error)

DescribeRouterConfiguration returns a placeholder customer router config for the named VIF and (optional) router type. See PARITY.md.

func (*InMemoryBackend) DescribeTags

func (b *InMemoryBackend) DescribeTags(resourceArns []string) []resourceTagWire

DescribeTags is this service's own native, BATCH-shaped tag-read op -- unlike the single-ARN ListTagsForResource pattern used by outposts/ resiliencehub, it takes a list of ARNs in one call (PARITY.md).

func (*InMemoryBackend) DescribeVirtualGateways

func (b *InMemoryBackend) DescribeVirtualGateways() []VirtualGatewayInfo

DescribeVirtualGateways returns every VGW usable for private VIF attachment. PARITY.md: this almost certainly maps 1:1 onto EC2's own VpnGateway records -- when an EC2GatewayResolver is wired in (see cli.go's wireDirectConnectEC2), this proxies from services/ec2's real VpnGateway list instead of maintaining a duplicate store; with no resolver wired (e.g. isolated unit tests), it returns an empty list rather than fabricating VGW ids with no backing resource.

func (*InMemoryBackend) DescribeVirtualInterfaces

func (b *InMemoryBackend) DescribeVirtualInterfaces(connectionID, vifID string) []*VirtualInterface

DescribeVirtualInterfaces returns VIFs, filtered independently by connectionID and/or vifID when non-empty (PARITY.md: both filters are independently optional, any combination).

func (*InMemoryBackend) DisassociateConnectionFromLag

func (b *InMemoryBackend) DisassociateConnectionFromLag(connectionID, lagID string) (*Connection, error)

DisassociateConnectionFromLag removes connectionID from lagID.

func (*InMemoryBackend) DisassociateMacSecKey

func (b *InMemoryBackend) DisassociateMacSecKey(connectionID, secretARN string) (string, []*MacSecKey, error)

DisassociateMacSecKey removes the MACsec key identified by SecretARN.

func (*InMemoryBackend) GatewayARN

func (b *InMemoryBackend) GatewayARN(id string) string

GatewayARN builds the ARN for a DirectConnectGateway ID. Confirmed GLOBAL (no region segment) shape (Terraform's gateway.go, gatewayARN func: `c.GlobalARN(ctx, "directconnect", "dx-gateway/"+id)`) -- see PARITY.md's ARN section and pkgs/arn.BuildGlobal's doc comment.

func (*InMemoryBackend) GatewayAmazonSideAsn

func (b *InMemoryBackend) GatewayAmazonSideAsn(gatewayID string) *int64

GatewayAmazonSideAsn returns the AmazonSideAsn of the given DirectConnectGateway, or nil if it does not exist -- used to populate VirtualInterface.AmazonSideAsn at wire-build time (see models.go's VirtualInterface doc comment).

func (*InMemoryBackend) InterconnectARN

func (b *InMemoryBackend) InterconnectARN(id string) string

InterconnectARN builds the ARN for an Interconnect ID. UNCONFIRMED shape -- PARITY.md: no Terraform-managed resource type exists for Interconnect at all (partner-only), so no primary source confirms its ARN resource-path segment. This reuses the "dxcon/" segment Connection uses (Direct Connect's real console/API historically shares the same "dxcon-xxxxxxxx" ID-format prefix between connections and interconnects), a defensible analogy, NOT a verified fact.

func (*InMemoryBackend) LagARN

func (b *InMemoryBackend) LagARN(id string) string

LagARN builds the ARN for a Lag ID. Confirmed shape (Terraform's lag.go): "arn:{partition}:directconnect:{region}:{account}:dxlag/{id}".

func (*InMemoryBackend) ListVirtualInterfaceTestHistory

func (b *InMemoryBackend) ListVirtualInterfaceTestHistory(
	vifID, testID, status string, bgpPeers []string,
) []*VifTestHistory

ListVirtualInterfaceTestHistory returns test-history records, optionally filtered by vifID/testID/status and any overlap with the bgpPeers filter.

func (*InMemoryBackend) Region

func (b *InMemoryBackend) Region() string

Region returns the AWS region this backend is configured for.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all stored state.

func (*InMemoryBackend) Restore

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

Restore loads backend state from a JSON snapshot.

func (*InMemoryBackend) SetEC2GatewayResolver

func (b *InMemoryBackend) SetEC2GatewayResolver(r EC2GatewayResolver)

SetEC2GatewayResolver wires the backend to validate/resolve VGW/TGW ids against the real services/ec2 backend -- see EC2GatewayResolver's doc comment. Called from cli.go's wireDirectConnectEC2, mirroring wireCloudWatchInfraActions's adapter-setter pattern.

func (*InMemoryBackend) Snapshot

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

Snapshot serialises the backend state to JSON.

func (*InMemoryBackend) StartBgpFailoverTest

func (b *InMemoryBackend) StartBgpFailoverTest(
	vifID string, bgpPeers []string, durationMinutes *int32,
) (*VifTestHistory, error)

StartBgpFailoverTest puts the named BGP peers (or every peer on the VIF, if bgpPeers is empty) into BgpStatus "down" and the VIF itself into VirtualInterfaceState "testing" for durationMinutes, auto-reverting on expiry unless StopBgpFailoverTest ends it first.

func (*InMemoryBackend) StopBgpFailoverTest

func (b *InMemoryBackend) StopBgpFailoverTest(vifID string) (*VifTestHistory, error)

StopBgpFailoverTest ends the open failover test for vifID, if any.

func (*InMemoryBackend) TagResource

func (b *InMemoryBackend) TagResource(_ context.Context, resourceArn string, newTags map[string]string) error

TagResource adds or updates tags on the named resource. The TooManyTagsException count check re-runs here (in addition to handler_static.go's handleTagResource) so it also applies to callers that invoke this method directly (e.g. cross-service resourcegroupstaggingapi wiring in cli.go), not just the native TagResource wire op. DuplicateTagKeysException detection, by contrast, is only meaningful at the wire layer against the RAW caller-supplied tag list before it collapses to this map -- a Go map can never itself hold a duplicate key, so mapKeys(newTags) can never trigger that branch from this call path.

func (*InMemoryBackend) TaggedResources

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

TaggedResources returns every tagged Connection/Lag/Interconnect/ VirtualInterface/DirectConnectGateway, for the resourcegroupstaggingapi integration.

func (*InMemoryBackend) UntagResource

func (b *InMemoryBackend) UntagResource(_ context.Context, resourceArn string, tagKeys []string) error

UntagResource removes tags from the named resource.

func (*InMemoryBackend) UpdateConnection

func (b *InMemoryBackend) UpdateConnection(req *updateConnectionRequest) (*Connection, error)

UpdateConnection applies a partial rename/encryption-mode update.

func (*InMemoryBackend) UpdateDirectConnectGateway

func (b *InMemoryBackend) UpdateDirectConnectGateway(gatewayID, newName string) (*DirectConnectGateway, error)

UpdateDirectConnectGateway renames a gateway -- the only Update* op in this service where the "what to change" field is itself required (PARITY.md).

func (*InMemoryBackend) UpdateDirectConnectGatewayAssociation

func (b *InMemoryBackend) UpdateDirectConnectGatewayAssociation(
	req *updateGatewayAssociationRequest,
) (*GatewayAssociation, error)

UpdateDirectConnectGatewayAssociation adds/removes allowed prefixes on an existing association, transitioning through "updating" -- the only state enum in this service with a mid-lifecycle value (PARITY.md).

func (*InMemoryBackend) UpdateLag

func (b *InMemoryBackend) UpdateLag(req *updateLagRequest) (*Lag, error)

UpdateLag applies a partial update, including raising MinimumLinks (a real, checkable operational lever -- see PARITY.md).

func (*InMemoryBackend) UpdateVirtualInterfaceAttributes

func (b *InMemoryBackend) UpdateVirtualInterfaceAttributes(req *updateVifAttributesRequest) (*VirtualInterface, error)

UpdateVirtualInterfaceAttributes applies a partial update.

func (*InMemoryBackend) VifARN

func (b *InMemoryBackend) VifARN(id string) string

VifARN builds the ARN for a VirtualInterface ID. Confirmed shape (Terraform's private_virtual_interface.go, shared across private/public/transit): "arn:{partition}:directconnect:{region}:{account}:dxvif/{id}".

type Interconnect

type Interconnect struct {
	Tags                 *tags.Tags
	InterconnectID       string
	InterconnectName     string
	InterconnectState    string
	Bandwidth            string
	Location             string
	Region               string
	LagID                string
	ProviderName         string
	AwsDeviceV2          string
	AwsLogicalDeviceID   string
	HasLogicalRedundancy string
	EncryptionMode       string
	PortEncryptionStatus string
	MacSecKeys           []*MacSecKey
	JumboFrameCapable    bool
	MacSecCapable        bool
}

Interconnect is the internal state of one interconnect -- a Direct Connect Partner's physical cross-connect. See PARITY.md's honest-gap section: this is real bookkeeping (state machine, parent/child relationships), never a simulation of the physical link itself.

type Lag

type Lag struct {
	Tags                    *tags.Tags
	RateLimiterStatus       *RateLimiterStatus
	LagID                   string
	LagName                 string
	LagState                string
	ConnectionsBandwidth    string
	Location                string
	Region                  string
	OwnerAccount            string
	ProviderName            string
	AwsDeviceV2             string
	AwsLogicalDeviceID      string
	HasLogicalRedundancy    string
	EncryptionMode          string
	MacSecKeys              []*MacSecKey
	MinimumLinks            int32
	NumberOfConnections     int32
	AllowsHostedConnections bool
	JumboFrameCapable       bool
	MacSecCapable           bool
}

Lag is the internal state of one link aggregation group. Its member Connections are NOT stored here as a nested slice -- they are their own Connection records with LagID set, looked up dynamically by connectionsByLagLocked at wire-build time, avoiding a second, aliasable copy of the same data (the exact class of bug outposts' de-stub pass found: a nested slice that silently goes stale).

type MacSecKey

type MacSecKey struct {
	Ckn       string
	SecretARN string
	StartOn   string
	State     string
}

MacSecKey mirrors types.MacSecKey. State is a bare string on the wire (not a typed enum -- see PARITY.md wire-trap #6): one of associating/associated/disassociating/disassociated.

Stored as []*MacSecKey (not []MacSecKey) on Connection/Lag/Interconnect specifically so store.go's scheduleTransition can hold a stable pointer to one key's State field across the key's associating->associated timer: a []MacSecKey value slice's backing array can be reallocated by a later append (e.g. a second AssociateMacSecKey call on the same connection), which would silently stand up an in-flight timer to mutate the old, now-orphaned backing array instead of the live one -- the exact aliasing bug class this task's instructions call out. A []*MacSecKey's pointers stay valid across any later append to the outer slice.

type Provider

type Provider struct{}

Provider implements service.Provider for AWS Direct Connect.

func (*Provider) Init

Init initializes the Direct Connect service backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

type RateLimiterStatus

type RateLimiterStatus struct {
	TotalBandwidth string
	InUse          int32
	MaxAllowed     int32
	Remaining      int32
}

RateLimiterStatus mirrors types.RateLimiterStatus.

type RouteFilterPrefix

type RouteFilterPrefix struct {
	Cidr string
}

RouteFilterPrefix mirrors types.RouteFilterPrefix.

type TaggedEntry

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

TaggedEntry is one tagged resource, used by TaggedResources for the resourcegroupstaggingapi integration (cli.go's wireTaggingDirectConnect).

type VifTestHistory

type VifTestHistory struct {
	StartTime             *time.Time
	EndTime               *time.Time
	TestID                string
	VirtualInterfaceID    string
	Status                string
	OwnerAccount          string
	BgpPeers              []string
	TestDurationInMinutes int32
}

VifTestHistory is the internal state of one StartBgpFailoverTest run -- see PARITY.md's "BGP failover testing" section.

type VirtualGatewayInfo

type VirtualGatewayInfo struct {
	VirtualGatewayID    string
	VirtualGatewayState string
}

VirtualGatewayInfo is the read-only shape DescribeVirtualGateways returns -- there is no backing internal model since this data is proxied from EC2, not stored by this backend (see DescribeVirtualGateways).

type VirtualInterface

type VirtualInterface struct {
	Tags                   *tags.Tags
	VirtualInterfaceID     string
	VirtualInterfaceName   string
	VirtualInterfaceType   string
	VirtualInterfaceState  string
	ConnectionID           string
	OwnerAccount           string
	Region                 string
	Location               string
	AddressFamily          string
	AmazonAddress          string
	CustomerAddress        string
	AuthKey                string
	DirectConnectGatewayID string
	VirtualGatewayID       string
	CustomerRouterConfig   string
	RateLimit              string
	AwsDeviceV2            string
	AwsLogicalDeviceID     string
	BgpPeers               []*BGPPeer
	RouteFilterPrefixes    []RouteFilterPrefix
	Vlan                   int32
	Mtu                    int32
	AsnValue               int64
	AsnProvided            bool
	JumboFrameCapable      bool
	SiteLinkEnabled        bool
}

VirtualInterface is the internal state of one private/public/transit virtual interface -- the richest resource in this service (10-value state enum, dual ASN fields, BGP peer list). AmazonSideAsn is NOT stored here: it is derived at wire-build time from the bound DirectConnectGateway (see wire_convert.go's toVirtualInterfaceWire), since it is really a property of the gateway the VIF is attached to, not the VIF itself -- storing it twice would risk the two copies drifting.

Jump to

Keyboard shortcuts

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