elbv2

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 25 Imported by: 0

README

ELBv2

Parity grade: A · SDK aws-sdk-go-v2/service/elasticloadbalancingv2@v1.54.8 · last audited 2026-07-05 (d118e0d8)

Coverage

Metric Value
Operations audited 51 (49 ok, 2 partial)
Known gaps 4
Deferred items 2
Resource leaks clean
Known gaps
  • ASG/ECS -> ELBv2 target registration is cross-service: RegisterTargets/DeregisterTargets/DescribeTargetHealth on the ELBv2 side are correct and complete (verified and improved this pass - see ops), but nothing on the ASG/ECS side calls them when instances/tasks scale (bd: gopherstack-18k) - NOT fixed here, out of scope per task instructions (elbv2-only edits)
  • GetTrustStoreCaCertificatesBundle / GetTrustStoreRevocationContent always return an empty Location (no real S3-backed object to point to) - documented simplification, not a hidden stub (the ops correctly validate the trust store/revocation exist and return 400 TrustStoreNotFound/RevocationIdNotFound otherwise)
  • RevocationId is modeled/returned as a string in this mock (echoing the caller-supplied plain content, or a generated "s3-" for S3-structured entries); real AWS RevocationId is an int64 assigned by AWS when it parses the uploaded CRL/bundle. Existing tests in this package already encode string-shaped RevocationIds (e.g. "s3://my-bucket/revocations.crl", "1") predating this pass. Reworking this to a real monotonic int64 ID space is a moderate, invasive change (touches the TrustStoreRevocation struct, persistence JSON shape, and ~6 existing tests) for a rarely-exercised feature; deferred rather than rushed. No bd id filed yet - recommend filing one if this is prioritized.
  • The plain (non-S3) RevocationContents.member.N request field parsed by parseTrustStoreRevocations does not exist in the real AWS API (RevocationContent is always S3Bucket/S3Key/S3ObjectVersion/RevocationType - verified against types.RevocationContent) - harmless (real clients never send that shape so the branch is simply unreachable in practice), but worth removing in a future cleanup pass
Deferred
  • RegexValues on rule conditions (a newer AWS feature letting host-header/path-pattern/http-header conditions match by regex instead of exact/wildcard Values) - not implemented at all; SDK-side type exists (RuleCondition.RegexValues []string) but this pass did not add parsing/serialization for it
  • AuthenticateCognitoConfig/AuthenticateOidcConfig were verified for field-name accuracy only, not behaviorally exercised (this emulator does not implement actual OIDC/Cognito redirect flows, matching every other gopherstack service's scope for auth actions)

More

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLoadBalancerNotFound is returned when the requested load balancer does not exist.
	ErrLoadBalancerNotFound = awserr.New("LoadBalancerNotFound", awserr.ErrNotFound)
	// ErrTargetGroupNotFound is returned when the requested target group does not exist.
	ErrTargetGroupNotFound = awserr.New("TargetGroupNotFound", awserr.ErrNotFound)
	// ErrListenerNotFound is returned when the requested listener does not exist.
	ErrListenerNotFound = awserr.New("ListenerNotFound", awserr.ErrNotFound)
	// ErrRuleNotFound is returned when the requested rule does not exist.
	ErrRuleNotFound = awserr.New("RuleNotFound", awserr.ErrNotFound)
	// ErrTrustStoreNotFound is returned when the requested trust store does not exist.
	ErrTrustStoreNotFound = awserr.New("TrustStoreNotFound", awserr.ErrNotFound)
	// ErrLoadBalancerAlreadyExists is returned when a load balancer with that name already exists.
	ErrLoadBalancerAlreadyExists = awserr.New("DuplicateLoadBalancerName", awserr.ErrAlreadyExists)
	// ErrTargetGroupAlreadyExists is returned when a target group with that name already exists.
	ErrTargetGroupAlreadyExists = awserr.New("DuplicateTargetGroupName", awserr.ErrAlreadyExists)
	// ErrTrustStoreAlreadyExists is returned when a trust store with that name already exists.
	ErrTrustStoreAlreadyExists = awserr.New("DuplicateTrustStoreName", awserr.ErrAlreadyExists)
	// ErrInvalidParameter is returned when a request parameter is invalid or missing.
	ErrInvalidParameter = awserr.New("ValidationError", awserr.ErrInvalidParameter)
	// ErrUnknownAction is returned when the requested action is not recognized.
	ErrUnknownAction = awserr.New("InvalidAction", awserr.ErrInvalidParameter)
	// ErrDuplicateRulePriority is returned when two rules have the same priority.
	// AWS's real error code for this condition is "PriorityInUse" (PriorityInUseException),
	// not "DuplicatePriority" — verified against aws-sdk-go-v2/service/elasticloadbalancingv2/types.
	ErrDuplicateRulePriority = awserr.New("PriorityInUse", awserr.ErrInvalidParameter)
	// ErrOperationNotPermitted is returned when the operation is not allowed (e.g. deleting default rule).
	ErrOperationNotPermitted = awserr.New("OperationNotPermitted", awserr.ErrInvalidParameter)
	// ErrDuplicateListener is returned when a listener on the same port already exists.
	ErrDuplicateListener = awserr.New("DuplicateListener", awserr.ErrAlreadyExists)
	// ErrTargetGroupInUse is returned when attempting to delete a target group that is still referenced.
	ErrTargetGroupInUse = awserr.New("ResourceInUse", awserr.ErrInvalidParameter)
	// ErrInvalidConfigurationRequest is returned when a configuration is invalid for the LB type.
	ErrInvalidConfigurationRequest = awserr.New(
		"InvalidConfigurationRequest",
		awserr.ErrInvalidParameter,
	)
	// ErrResourcePolicyNotFound is returned when no resource policy is set for a resource.
	ErrResourcePolicyNotFound = awserr.New("ResourceNotFound", awserr.ErrNotFound)
	// ErrTrustStoreAssociationNotFound is returned when a shared trust store association does not exist.
	ErrTrustStoreAssociationNotFound = awserr.New("AssociationNotFound", awserr.ErrNotFound)
)

Functions

This section is empty.

Types

type Action

type Action struct {
	RedirectConfig            *RedirectConfig            `json:"redirectConfig,omitempty"`
	FixedResponseConfig       *FixedResponseConfig       `json:"fixedResponseConfig,omitempty"`
	ForwardConfig             *ForwardConfig             `json:"forwardConfig,omitempty"`
	AuthenticateCognitoConfig *AuthenticateCognitoConfig `json:"authenticateCognitoConfig,omitempty"`
	AuthenticateOidcConfig    *AuthenticateOidcConfig    `json:"authenticateOidcConfig,omitempty"`
	Type                      string                     `json:"type"`
	TargetGroupArn            string                     `json:"targetGroupArn"`
	Order                     int32                      `json:"order,omitempty"`
}

Action represents a listener or rule action.

type AuthenticateCognitoConfig

type AuthenticateCognitoConfig struct {
	AuthenticationRequestExtraParams map[string]string `json:"authenticationRequestExtraParams,omitempty"`
	UserPoolArn                      string            `json:"userPoolArn"`
	UserPoolClientID                 string            `json:"userPoolClientId"`
	UserPoolDomain                   string            `json:"userPoolDomain"`
	SessionCookieName                string            `json:"sessionCookieName,omitempty"`
	Scope                            string            `json:"scope,omitempty"`
	OnUnauthenticatedRequest         string            `json:"onUnauthenticatedRequest,omitempty"`
	SessionTimeout                   int64             `json:"sessionTimeout,omitempty"`
}

AuthenticateCognitoConfig holds configuration for authenticate-cognito actions.

type AuthenticateOidcConfig

type AuthenticateOidcConfig struct {
	AuthenticationRequestExtraParams map[string]string `json:"authenticationRequestExtraParams,omitempty"`
	Issuer                           string            `json:"issuer"`
	AuthorizationEndpoint            string            `json:"authorizationEndpoint"`
	TokenEndpoint                    string            `json:"tokenEndpoint"`
	UserInfoEndpoint                 string            `json:"userInfoEndpoint"`
	ClientID                         string            `json:"clientId"`
	ClientSecret                     string            `json:"clientSecret,omitempty"`
	SessionCookieName                string            `json:"sessionCookieName,omitempty"`
	Scope                            string            `json:"scope,omitempty"`
	OnUnauthenticatedRequest         string            `json:"onUnauthenticatedRequest,omitempty"`
	SessionTimeout                   int64             `json:"sessionTimeout,omitempty"`
}

AuthenticateOidcConfig holds configuration for authenticate-oidc actions.

type AvailabilityZone

type AvailabilityZone struct {
	ZoneName string `json:"zoneName"`
	SubnetID string `json:"subnetId,omitempty"`
}

AvailabilityZone holds the zone name and subnet ID for an LB availability zone mapping.

type CapacityReservation

type CapacityReservation struct {
	LastModifiedTime          time.Time `json:"lastModifiedTime"`
	MinimumCapacityUnits      int32     `json:"minimumCapacityUnits"`
	DecreaseRequestsRemaining int32     `json:"decreaseRequestsRemaining"`
}

CapacityReservation holds the capacity reservation state for a load balancer, as set by ModifyCapacityReservation and read by DescribeCapacityReservation.

type Certificate

type Certificate struct {
	CertificateArn string `json:"certificateArn"`
	IsDefault      bool   `json:"isDefault"`
}

Certificate represents a listener certificate.

type Condition

type Condition struct {
	// Field is the condition type: host-header, path-pattern, http-header,
	// http-request-method, query-string, source-ip.
	Field string `json:"field"`
	// Values holds the condition values (used for host-header, path-pattern,
	// http-request-method, source-ip).
	Values []string `json:"values,omitempty"`
	// HTTPHeaderName is only set for http-header conditions.
	HTTPHeaderName string `json:"httpHeaderName,omitempty"`
	// QueryStringPairs holds key/value pairs for query-string conditions.
	QueryStringPairs []QueryStringPair `json:"queryStringPairs,omitempty"`
}

Condition represents an ELBv2 rule condition (e.g. host-header, path-pattern, http-header).

type CreateListenerInput

type CreateListenerInput struct {
	MutualAuthentication *MutualAuthentication
	LoadBalancerArn      string
	Protocol             string
	SSLPolicy            string
	AlpnPolicy           []string
	DefaultActions       []Action
	Tags                 []tags.KV
	Certificates         []Certificate
	Port                 int32
}

CreateListenerInput holds the parameters for creating a listener.

type CreateLoadBalancerInput

type CreateLoadBalancerInput struct {
	Name           string
	Scheme         string
	Type           string
	IPAddressType  string
	Subnets        []string        // plain subnet IDs (Subnets.member.N)
	SubnetMappings []SubnetMapping // rich subnet mappings (SubnetMappings.member.N)
	SecurityGroups []string
	Tags           []tags.KV
}

CreateLoadBalancerInput holds the parameters for creating a load balancer.

type CreateRuleInput

type CreateRuleInput struct {
	ListenerArn string
	Priority    string
	Actions     []Action
	Conditions  []Condition
	Tags        []tags.KV
}

CreateRuleInput holds the parameters for creating a listener rule.

type CreateTargetGroupInput

type CreateTargetGroupInput struct {
	Name                       string
	Protocol                   string
	ProtocolVersion            string
	VpcID                      string
	TargetType                 string
	HealthCheckProtocol        string
	HealthCheckPort            string
	HealthCheckPath            string
	Matcher                    Matcher
	Tags                       []tags.KV
	Port                       int32
	HealthCheckIntervalSeconds int32
	HealthCheckTimeoutSeconds  int32
	HealthyThresholdCount      int32
	UnhealthyThresholdCount    int32
	HealthCheckEnabled         bool
}

CreateTargetGroupInput holds the parameters for creating a target group.

type FixedResponseConfig

type FixedResponseConfig struct {
	MessageBody string `json:"messageBody,omitempty"`
	StatusCode  string `json:"statusCode"`
	ContentType string `json:"contentType,omitempty"`
}

FixedResponseConfig holds configuration for fixed-response actions.

type ForwardConfig

type ForwardConfig struct {
	TargetGroups []TargetGroupTuple `json:"targetGroups,omitempty"`
}

ForwardConfig holds configuration for forward actions with multiple target groups.

type Handler

type Handler struct {
	Backend StorageBackend
	// contains filtered or unexported fields
}

Handler is the Echo HTTP handler for ELBv2 operations.

func NewHandler

func NewHandler(backend StorageBackend) *Handler

NewHandler creates a new ELBv2 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 extracts the ELBv2 action from the request.

func (*Handler) ExtractResource

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

ExtractResource extracts the primary resource identifier from the request.

func (*Handler) GetSupportedOperations

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

GetSupportedOperations returns the list of supported ELBv2 operations.

func (*Handler) Handler

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

Handler returns the Echo handler function for ELBv2 operations.

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) 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 ELBv2 requests. ELBv2 requests are form-encoded POSTs with Version=2015-12-01.

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
}

func NewInMemoryBackend

func NewInMemoryBackend(accountID, region string) *InMemoryBackend

NewInMemoryBackend creates a new in-memory ELBv2 backend.

func (*InMemoryBackend) AddListenerCertificates

func (b *InMemoryBackend) AddListenerCertificates(listenerArn string, certs []Certificate) error

AddListenerCertificates adds certificates to a listener.

func (*InMemoryBackend) AddTags

func (b *InMemoryBackend) AddTags(resourceArns []string, kvs []tags.KV) error

AddTags adds or updates tags on ELBv2 resources.

func (*InMemoryBackend) AddTrustStoreRevocations

func (b *InMemoryBackend) AddTrustStoreRevocations(
	trustStoreArn string,
	revocations []TrustStoreRevocation,
) error

AddTrustStoreRevocations appends revocation entries to a trust store.

func (*InMemoryBackend) Close

func (b *InMemoryBackend) Close()

Close stops the background health reconciler.

func (*InMemoryBackend) CreateListener

func (b *InMemoryBackend) CreateListener(input CreateListenerInput) (*Listener, error)

CreateListener creates a new listener on a load balancer.

func (*InMemoryBackend) CreateLoadBalancer

func (b *InMemoryBackend) CreateLoadBalancer(input CreateLoadBalancerInput) (*LoadBalancer, error)

CreateLoadBalancer creates a new load balancer.

func (*InMemoryBackend) CreateRule

func (b *InMemoryBackend) CreateRule(input CreateRuleInput) (*Rule, error)

CreateRule creates a new rule on a listener.

func (*InMemoryBackend) CreateTargetGroup

func (b *InMemoryBackend) CreateTargetGroup(input CreateTargetGroupInput) (*TargetGroup, error)

CreateTargetGroup creates a new target group.

func (*InMemoryBackend) CreateTrustStore

func (b *InMemoryBackend) CreateTrustStore(name string, kvs []tags.KV) (*TrustStore, error)

CreateTrustStore creates a new trust store.

func (*InMemoryBackend) DeleteListener

func (b *InMemoryBackend) DeleteListener(listenerArn string) error

DeleteListener deletes a listener by ARN.

func (*InMemoryBackend) DeleteLoadBalancer

func (b *InMemoryBackend) DeleteLoadBalancer(lbArn string) error

DeleteLoadBalancer deletes a load balancer by ARN.

func (*InMemoryBackend) DeleteRule

func (b *InMemoryBackend) DeleteRule(ruleArn string) error

DeleteRule deletes a rule by ARN.

func (*InMemoryBackend) DeleteSharedTrustStoreAssociation

func (b *InMemoryBackend) DeleteSharedTrustStoreAssociation(trustStoreArn, resourceArn string) error

DeleteSharedTrustStoreAssociation removes the association between a trust store and a resource (listener). The association exists when the listener's MutualAuthentication references the trust store; deleting it clears that reference.

func (*InMemoryBackend) DeleteTargetGroup

func (b *InMemoryBackend) DeleteTargetGroup(tgArn string) error

DeleteTargetGroup deletes a target group by ARN.

func (*InMemoryBackend) DeleteTrustStore

func (b *InMemoryBackend) DeleteTrustStore(trustStoreArn string) error

DeleteTrustStore deletes a trust store by ARN.

func (*InMemoryBackend) DeregisterTargets

func (b *InMemoryBackend) DeregisterTargets(tgArn string, targets []Target) error

DeregisterTargets transitions targets to draining state. They are removed after the deregistration_delay.timeout_seconds attribute expires.

func (*InMemoryBackend) DescribeCapacityReservation

func (b *InMemoryBackend) DescribeCapacityReservation(lbArn string) (*CapacityReservation, error)

DescribeCapacityReservation returns the capacity reservation state for a load balancer.

func (*InMemoryBackend) DescribeListenerAttributes

func (b *InMemoryBackend) DescribeListenerAttributes(
	listenerArn string,
) (map[string]string, error)

DescribeListenerAttributes returns attributes for a listener.

func (*InMemoryBackend) DescribeListenerCertificates

func (b *InMemoryBackend) DescribeListenerCertificates(listenerArn string) ([]Certificate, error)

DescribeListenerCertificates returns certificates on a listener.

func (*InMemoryBackend) DescribeListeners

func (b *InMemoryBackend) DescribeListeners(
	lbArn string,
	listenerArns []string,
) ([]Listener, error)

DescribeListeners returns listeners filtered by load balancer ARN and/or listener ARNs. The returned Listener values contain a Tags pointer that is backend-owned; callers must treat it as read-only.

Fast path: when only listener ARNs are supplied (no lbArn filter), look them up directly in the ARN-keyed map instead of scanning every listener.

func (*InMemoryBackend) DescribeLoadBalancers

func (b *InMemoryBackend) DescribeLoadBalancers(
	arns []string,
	names []string,
) ([]LoadBalancer, error)

DescribeLoadBalancers returns load balancers filtered by ARNs and/or names. The returned LoadBalancer values contain a Tags pointer that is backend-owned; callers must treat it as read-only.

Fast path: when only ARNs are supplied (no names), look them up directly in the ARN-keyed map instead of scanning every load balancer in the backend.

func (*InMemoryBackend) DescribeRules

func (b *InMemoryBackend) DescribeRules(listenerArn string, ruleArns []string) ([]Rule, error)

DescribeRules returns rules filtered by listener ARN and/or rule ARNs.

Fast path: when only rule ARNs are supplied (no listenerArn filter), look them up directly in the ARN-keyed map instead of scanning every rule.

func (*InMemoryBackend) DescribeTags

func (b *InMemoryBackend) DescribeTags(resourceArns []string) (map[string][]tags.KV, error)

DescribeTags returns tags for the specified resource ARNs.

func (*InMemoryBackend) DescribeTargetGroupAttributes

func (b *InMemoryBackend) DescribeTargetGroupAttributes(tgArn string) (map[string]string, error)

DescribeTargetGroupAttributes returns attributes for a target group.

func (*InMemoryBackend) DescribeTargetGroups

func (b *InMemoryBackend) DescribeTargetGroups(
	arns []string,
	names []string,
	lbArn string,
) ([]TargetGroup, error)

DescribeTargetGroups returns target groups filtered by ARNs, names, or load balancer ARN. The returned TargetGroup values contain a Tags pointer that is backend-owned; callers must treat it as read-only.

Fast path: when only ARNs are supplied (no names, no lbArn), look them up directly in the ARN-keyed map instead of scanning every target group.

func (*InMemoryBackend) DescribeTargetHealth

func (b *InMemoryBackend) DescribeTargetHealth(tgArn string) ([]TargetHealthDescription, error)

DescribeTargetHealth returns health descriptions for targets registered with the target group.

func (*InMemoryBackend) DescribeTrustStoreAssociations

func (b *InMemoryBackend) DescribeTrustStoreAssociations(trustStoreArn string) ([]string, error)

DescribeTrustStoreAssociations returns listener ARNs whose trust store is set to this ARN.

func (*InMemoryBackend) DescribeTrustStoreRevocations

func (b *InMemoryBackend) DescribeTrustStoreRevocations(
	trustStoreArn string,
) ([]TrustStoreRevocation, error)

DescribeTrustStoreRevocations returns revocation entries for a trust store.

func (*InMemoryBackend) DescribeTrustStores

func (b *InMemoryBackend) DescribeTrustStores(arns []string, names []string) ([]TrustStore, error)

DescribeTrustStores returns trust stores filtered by ARNs and/or names.

func (*InMemoryBackend) GetResourcePolicy

func (b *InMemoryBackend) GetResourcePolicy(resourceArn string) (string, error)

GetResourcePolicy returns the stored resource policy for a resource ARN.

func (*InMemoryBackend) ModifyCapacityReservation

func (b *InMemoryBackend) ModifyCapacityReservation(
	lbArn string, minimumCapacityUnits *int32, reset bool,
) (*CapacityReservation, error)

ModifyCapacityReservation persists capacity reservation state on a load balancer.

func (*InMemoryBackend) ModifyIPPools

func (b *InMemoryBackend) ModifyIPPools(
	lbArn string, ipv4PoolID *string, removeIPv4 bool,
) (*LoadBalancer, error)

ModifyIPPools updates the IPAM pool configuration on a load balancer.

func (*InMemoryBackend) ModifyListener

func (b *InMemoryBackend) ModifyListener(input ModifyListenerInput) (*Listener, error)

ModifyListener updates the properties of an existing listener.

func (*InMemoryBackend) ModifyListenerAttributes

func (b *InMemoryBackend) ModifyListenerAttributes(
	listenerArn string,
	attrs map[string]string,
) (*Listener, error)

ModifyListenerAttributes updates attributes on a listener.

func (*InMemoryBackend) ModifyLoadBalancerAttributes

func (b *InMemoryBackend) ModifyLoadBalancerAttributes(
	lbArn string,
	attrs map[string]string,
) (*LoadBalancer, error)

ModifyLoadBalancerAttributes updates attributes on a load balancer.

func (*InMemoryBackend) ModifyRule

func (b *InMemoryBackend) ModifyRule(
	ruleArn string,
	actions []Action,
	conditions []Condition,
) (*Rule, error)

ModifyRule updates the actions and/or conditions of an existing rule.

func (*InMemoryBackend) ModifyTargetGroup

func (b *InMemoryBackend) ModifyTargetGroup(input ModifyTargetGroupInput) (*TargetGroup, error)

ModifyTargetGroup updates health-check settings on a target group.

func (*InMemoryBackend) ModifyTargetGroupAttributes

func (b *InMemoryBackend) ModifyTargetGroupAttributes(
	tgArn string,
	attrs map[string]string,
) (*TargetGroup, error)

ModifyTargetGroupAttributes updates attributes on a target group.

func (*InMemoryBackend) ModifyTrustStore

func (b *InMemoryBackend) ModifyTrustStore(trustStoreArn, name string) (*TrustStore, error)

ModifyTrustStore updates a trust store's name.

func (*InMemoryBackend) PutResourcePolicy

func (b *InMemoryBackend) PutResourcePolicy(resourceArn, policy string) error

PutResourcePolicy stores a resource policy keyed by resource ARN.

func (*InMemoryBackend) RegisterTargets

func (b *InMemoryBackend) RegisterTargets(tgArn string, targets []Target) error

RegisterTargets registers targets with a target group.

func (*InMemoryBackend) RemoveListenerCertificates

func (b *InMemoryBackend) RemoveListenerCertificates(listenerArn string, certArns []string) error

RemoveListenerCertificates removes certificate ARNs from a listener.

func (*InMemoryBackend) RemoveTags

func (b *InMemoryBackend) RemoveTags(resourceArns []string, keys []string) error

RemoveTags removes tags from ELBv2 resources.

func (*InMemoryBackend) RemoveTrustStoreRevocations

func (b *InMemoryBackend) RemoveTrustStoreRevocations(
	trustStoreArn string,
	revocationIDs []string,
) error

RemoveTrustStoreRevocations removes revocation entries from a trust store by RevocationID.

func (*InMemoryBackend) Restore

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

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) SetIPAddressType

func (b *InMemoryBackend) SetIPAddressType(lbArn string, ipType string) (*LoadBalancer, error)

SetIPAddressType updates the IP address type of a load balancer.

func (*InMemoryBackend) SetRulePriorities

func (b *InMemoryBackend) SetRulePriorities(priorities []RulePriority) ([]Rule, error)

SetRulePriorities updates the priorities of one or more rules.

func (*InMemoryBackend) SetSecurityGroups

func (b *InMemoryBackend) SetSecurityGroups(lbArn string, sgs []string) (*LoadBalancer, error)

SetSecurityGroups updates the security groups associated with a load balancer.

func (*InMemoryBackend) SetSubnets

func (b *InMemoryBackend) SetSubnets(
	lbArn string,
	mappings []SubnetMapping,
) (*LoadBalancer, error)

SetSubnets updates the availability zones / subnets associated with a load balancer.

func (*InMemoryBackend) SetTargetHealthState

func (b *InMemoryBackend) SetTargetHealthState(
	tgArn, targetID string,
	port int32,
	state, reason string,
) error

SetTargetHealthState overrides the health state for a specific target in a target group. Used in tests to simulate health state transitions.

func (*InMemoryBackend) Snapshot

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

Snapshot serialises the backend state to JSON. It implements persistence.Persistable.

type Listener

type Listener struct {
	Tags                 *tags.Tags            `json:"tags,omitempty"`
	Attributes           map[string]string     `json:"attributes,omitempty"`
	MutualAuthentication *MutualAuthentication `json:"mutualAuthentication,omitempty"`
	ListenerArn          string                `json:"listenerArn"`
	LoadBalancerArn      string                `json:"loadBalancerArn"`
	Protocol             string                `json:"protocol"`
	SSLPolicy            string                `json:"sslPolicy,omitempty"`
	// AlpnPolicy is a list on the wire (AlpnPolicy.member.N / <AlpnPolicy><member>…),
	// not a bare string — verified against aws-sdk-go-v2 types.Listener.AlpnPolicy ([]string).
	AlpnPolicy     []string      `json:"alpnPolicy,omitempty"`
	DefaultActions []Action      `json:"defaultActions"`
	Certificates   []Certificate `json:"certificates,omitempty"`
	Port           int32         `json:"port"`
}

Listener represents an ELBv2 listener.

type LoadBalancer

type LoadBalancer struct {
	CreatedTime           time.Time            `json:"createdTime"`
	State                 LoadBalancerState    `json:"state"`
	Tags                  *tags.Tags           `json:"tags,omitempty"`
	Attributes            map[string]string    `json:"attributes,omitempty"`
	CapacityReservation   *CapacityReservation `json:"capacityReservation,omitempty"`
	LoadBalancerArn       string               `json:"loadBalancerArn"`
	LoadBalancerName      string               `json:"loadBalancerName"`
	DNSName               string               `json:"dnsName"`
	CanonicalHostedZoneID string               `json:"canonicalHostedZoneId"`
	VpcID                 string               `json:"vpcId"`
	Scheme                string               `json:"scheme"`
	Type                  string               `json:"type"`
	IPAddressType         string               `json:"ipAddressType"`
	IPv4IPAMPoolID        string               `json:"ipv4IpamPoolId,omitempty"`
	AvailabilityZones     []AvailabilityZone   `json:"availabilityZones"`
	SecurityGroups        []string             `json:"securityGroups"`
}

LoadBalancer represents an ELBv2 load balancer.

type LoadBalancerState

type LoadBalancerState struct {
	Code        string `json:"code"`
	Description string `json:"description"`
}

LoadBalancerState represents the state of a load balancer.

type Matcher

type Matcher struct {
	HTTPCode string `json:"httpCode,omitempty"`
	GrpcCode string `json:"grpcCode,omitempty"`
}

Matcher holds health-check matcher codes for a target group.

type ModifyListenerInput

type ModifyListenerInput struct {
	MutualAuthentication *MutualAuthentication
	ListenerArn          string
	Protocol             string
	SSLPolicy            string
	AlpnPolicy           []string
	DefaultActions       []Action
	Certificates         []Certificate
	Port                 int32
}

ModifyListenerInput holds the parameters for modifying a listener.

type ModifyTargetGroupInput

type ModifyTargetGroupInput struct {
	HealthCheckEnabled         *bool
	Matcher                    Matcher
	TargetGroupArn             string
	HealthCheckProtocol        string
	HealthCheckPort            string
	HealthCheckPath            string
	HealthCheckIntervalSeconds int32
	HealthCheckTimeoutSeconds  int32
	HealthyThresholdCount      int32
	UnhealthyThresholdCount    int32
}

ModifyTargetGroupInput holds the parameters for modifying a target group. HealthCheckEnabled is a pointer so that an absent parameter does not overwrite the stored value.

type MutualAuthentication

type MutualAuthentication struct {
	TrustStoreArn                     string `json:"trustStoreArn,omitempty"`
	Mode                              string `json:"mode"`
	IgnoreClientCertificateExpiration bool   `json:"ignoreClientCertificateExpiration,omitempty"`
}

MutualAuthentication holds mTLS configuration for a listener.

type Provider

type Provider struct{}

Provider implements service.Provider for the ELBv2 service.

func (*Provider) Init

Init initializes the ELBv2 backend and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the logical name of the provider.

type QueryStringPair

type QueryStringPair struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value"`
}

QueryStringPair is a key/value pair used in query-string rule conditions.

type RedirectConfig

type RedirectConfig struct {
	Protocol   string `json:"protocol,omitempty"`
	Port       string `json:"port,omitempty"`
	Host       string `json:"host,omitempty"`
	Path       string `json:"path,omitempty"`
	Query      string `json:"query,omitempty"`
	StatusCode string `json:"statusCode"`
}

RedirectConfig holds configuration for redirect actions.

type Rule

type Rule struct {
	Tags        *tags.Tags  `json:"tags,omitempty"`
	RuleArn     string      `json:"ruleArn"`
	ListenerArn string      `json:"listenerArn"`
	Priority    string      `json:"priority"`
	Actions     []Action    `json:"actions"`
	Conditions  []Condition `json:"conditions,omitempty"`
	IsDefault   bool        `json:"isDefault"`
}

Rule represents an ELBv2 listener rule.

type RulePriority

type RulePriority struct {
	RuleArn  string
	Priority string
}

RulePriority holds an ARN-to-priority mapping used by SetRulePriorities.

type StorageBackend

type StorageBackend interface {
	CreateLoadBalancer(input CreateLoadBalancerInput) (*LoadBalancer, error)
	DescribeLoadBalancers(arns []string, names []string) ([]LoadBalancer, error)
	DeleteLoadBalancer(lbArn string) error
	ModifyLoadBalancerAttributes(lbArn string, attrs map[string]string) (*LoadBalancer, error)
	SetSecurityGroups(lbArn string, sgs []string) (*LoadBalancer, error)
	SetSubnets(lbArn string, mappings []SubnetMapping) (*LoadBalancer, error)
	SetIPAddressType(lbArn string, ipType string) (*LoadBalancer, error)
	CreateTargetGroup(input CreateTargetGroupInput) (*TargetGroup, error)
	DescribeTargetGroups(arns []string, names []string, lbArn string) ([]TargetGroup, error)
	DeleteTargetGroup(tgArn string) error
	ModifyTargetGroup(input ModifyTargetGroupInput) (*TargetGroup, error)
	ModifyTargetGroupAttributes(tgArn string, attrs map[string]string) (*TargetGroup, error)
	DescribeTargetGroupAttributes(tgArn string) (map[string]string, error)
	RegisterTargets(tgArn string, targets []Target) error
	DeregisterTargets(tgArn string, targets []Target) error
	DescribeTargetHealth(tgArn string) ([]TargetHealthDescription, error)
	CreateListener(input CreateListenerInput) (*Listener, error)
	DescribeListeners(lbArn string, listenerArns []string) ([]Listener, error)
	DeleteListener(listenerArn string) error
	ModifyListener(input ModifyListenerInput) (*Listener, error)
	ModifyListenerAttributes(listenerArn string, attrs map[string]string) (*Listener, error)
	DescribeListenerAttributes(listenerArn string) (map[string]string, error)
	CreateRule(input CreateRuleInput) (*Rule, error)
	DescribeRules(listenerArn string, ruleArns []string) ([]Rule, error)
	DeleteRule(ruleArn string) error
	ModifyRule(ruleArn string, actions []Action, conditions []Condition) (*Rule, error)
	AddTags(resourceArns []string, kvs []tags.KV) error
	RemoveTags(resourceArns []string, keys []string) error
	DescribeTags(resourceArns []string) (map[string][]tags.KV, error)
	// TrustStore operations.
	CreateTrustStore(name string, kvs []tags.KV) (*TrustStore, error)
	DescribeTrustStores(arns []string, names []string) ([]TrustStore, error)
	DeleteTrustStore(trustStoreArn string) error
	ModifyTrustStore(trustStoreArn, name string) (*TrustStore, error)
	AddTrustStoreRevocations(trustStoreArn string, revocations []TrustStoreRevocation) error
	RemoveTrustStoreRevocations(trustStoreArn string, revocationIDs []string) error
	DescribeTrustStoreRevocations(trustStoreArn string) ([]TrustStoreRevocation, error)
	DescribeTrustStoreAssociations(trustStoreArn string) ([]string, error)
	DeleteSharedTrustStoreAssociation(trustStoreArn, resourceArn string) error
	// Capacity reservation operations.
	ModifyCapacityReservation(lbArn string, minimumCapacityUnits *int32, reset bool) (*CapacityReservation, error)
	DescribeCapacityReservation(lbArn string) (*CapacityReservation, error)
	// IP pool operations.
	ModifyIPPools(lbArn string, ipv4PoolID *string, removeIPv4 bool) (*LoadBalancer, error)
	// Resource policy operations.
	GetResourcePolicy(resourceArn string) (string, error)
	PutResourcePolicy(resourceArn, policy string) error
	// Rule priority operations.
	SetRulePriorities(priorities []RulePriority) ([]Rule, error)
	// Listener certificate operations.
	AddListenerCertificates(listenerArn string, certs []Certificate) error
	DescribeListenerCertificates(listenerArn string) ([]Certificate, error)
	RemoveListenerCertificates(listenerArn string, certArns []string) error
}

StorageBackend is the interface for ELBv2 storage operations.

type SubnetMapping

type SubnetMapping struct {
	SubnetID           string
	AllocationID       string
	PrivateIPv4Address string
	IPv6Address        string
}

SubnetMapping holds subnet configuration for CreateLoadBalancer and SetSubnets.

type Target

type Target struct {
	ID           string `json:"id"`
	HealthState  string `json:"healthState,omitempty"`
	HealthReason string `json:"healthReason,omitempty"`
	Port         int32  `json:"port"`
}

Target represents a registered target in a target group.

type TargetGroup

type TargetGroup struct {
	Tags                       *tags.Tags        `json:"tags,omitempty"`
	TargetGroupAttributes      map[string]string `json:"targetGroupAttributes,omitempty"`
	TargetGroupArn             string            `json:"targetGroupArn"`
	TargetGroupName            string            `json:"targetGroupName"`
	Protocol                   string            `json:"protocol"`
	ProtocolVersion            string            `json:"protocolVersion,omitempty"`
	VpcID                      string            `json:"vpcId"`
	TargetType                 string            `json:"targetType"`
	HealthCheckProtocol        string            `json:"healthCheckProtocol"`
	HealthCheckPort            string            `json:"healthCheckPort"`
	HealthCheckPath            string            `json:"healthCheckPath"`
	Matcher                    Matcher           `json:"matcher"`
	Targets                    []Target          `json:"targets"`
	LoadBalancerArns           []string          `json:"loadBalancerArns,omitempty"`
	Port                       int32             `json:"port"`
	HealthCheckIntervalSeconds int32             `json:"healthCheckIntervalSeconds"`
	HealthCheckTimeoutSeconds  int32             `json:"healthCheckTimeoutSeconds"`
	HealthyThresholdCount      int32             `json:"healthyThresholdCount"`
	UnhealthyThresholdCount    int32             `json:"unhealthyThresholdCount"`
	HealthCheckEnabled         bool              `json:"healthCheckEnabled"`
	CrossZoneLoadBalancing     bool              `json:"crossZoneLoadBalancing"`
}

TargetGroup represents an ELBv2 target group.

type TargetGroupTuple

type TargetGroupTuple struct {
	TargetGroupArn string `json:"targetGroupArn"`
	Weight         int32  `json:"weight,omitempty"`
}

TargetGroupTuple is a target group reference used in ForwardConfig.

type TargetHealthDescription

type TargetHealthDescription struct {
	HealthState  string `json:"healthState"`
	HealthReason string `json:"healthReason,omitempty"`
	Target       Target `json:"target"`
}

TargetHealthDescription describes the health state of a registered target.

type TrustStore

type TrustStore struct {
	Tags                *tags.Tags             `json:"tags,omitempty"`
	TrustStoreArn       string                 `json:"trustStoreArn"`
	Name                string                 `json:"name"`
	Status              string                 `json:"status"`
	Revocations         []TrustStoreRevocation `json:"revocations,omitempty"`
	TotalRevokedEntries int64                  `json:"totalRevokedEntries"`
}

TrustStore represents an ELBv2 trust store.

type TrustStoreRevocation

type TrustStoreRevocation struct {
	RevocationID           string `json:"revocationId"`
	RevocationType         string `json:"revocationType"`
	NumberOfRevokedEntries int64  `json:"numberOfRevokedEntries"`
}

TrustStoreRevocation represents a single revocation entry stored in a trust store.

Jump to

Keyboard shortcuts

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