Help us shape the future of Go! Take the 2026 Go Developer Survey

elbv2

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 25 Imported by: 0

README

ELBv2

Parity grade: A · SDK aws-sdk-go-v2/service/elasticloadbalancingv2@v1.58.5 · last audited 2026-08-07 (198990e82)

Coverage

Metric Value
Operations audited 51 (50 ok, 1 partial)
Feature families 8 (7 ok, 1 partial)
Known gaps 3
Deferred items 6
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). UPDATED (2026-08-13, bd gopherstack-hl3h): the RevocationIdNotFound check was previously not implemented despite this gap note claiming it was (GetTrustStoreRevocationContent never read RevocationId at all) - now genuinely true, see the op's PARITY note above. CreateTrustStore/ModifyTrustStore's CaCertificatesBundleS3Bucket/Key/ObjectVersion are recorded on TrustStore (same pass) but likewise never used to produce real bundle content, for the same no-real-S3 reason.
  • CreateTargetGroup's default TargetGroupAttributes map only pre-populates 5 of the ~15+ attribute keys real AWS always returns from DescribeTargetGroupAttributes (see target-group-attributes family note above) - explicitly-set attributes still round-trip correctly via ModifyTargetGroupAttributes, so this is a completeness gap in the defaults, not a wire-shape bug; deferred rather than rushed because the correct default value differs per target type (instance/ip vs lambda) and expanding the map risks breaking the ~30 existing tests that assert on today's 5-key map. No bd id filed yet - recommend filing one if prioritized.
Deferred
  • IMPLEMENTED 2026-08-07 (bd gopherstack-q1z2): RuleTransforms -- see families.rule-transforms above.
  • jwt-validation is a real, newer Action type (types.ActionTypeEnum has "jwt-validation" alongside forward/redirect/fixed-response/authenticate-oidc/authenticate-cognito; backed by JwtValidationActionConfig/JwtValidationActionAdditionalClaim) not implemented here at all - not in this task's explicit actions checklist (forward/redirect/fixed-response/authenticate-oidc/authenticate-cognito). No bd id filed yet.
  • AnomalyDetection (types.TargetHealth.AnomalyDetection) and AdministrativeOverride (types.TargetHealth.AdministrativeOverride) are newer DescribeTargetHealth response fields (anomaly mitigation / zonal-shift administrative override status) not modeled on the backend Target/TargetHealthDescription types - not in this task's explicit target-health checklist. No bd id filed yet.
  • LoadBalancer fields added to the SDK since the last full field-diff: IpamPools, EnablePrefixForIpv6SourceNat, CustomerOwnedIpv4Pool, EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic (types.LoadBalancer / CreateLoadBalancerInput) - all Outposts/IPAM/UDP-source-NAT niche features, not in this task's explicit CreateLoadBalancer checklist (subnets/subnetMappings/securityGroups/scheme/ipAddressType). No bd id filed yet.
  • MutualAuthenticationAttributes.AdvertiseTrustStoreCaNames and .TrustStoreAssociationStatus (types.go) are not modeled on the backend MutualAuthentication struct - a newer mTLS/shared-trust-store feature, not in this task's explicit trust-store checklist. No bd id filed yet.
  • …and 1 more — see PARITY.md

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)
	// ErrRevocationIDNotFound is returned when the requested revocation ID does not exist
	// on the trust store (GetTrustStoreRevocationContent).
	ErrRevocationIDNotFound = awserr.New("RevocationIdNotFound", 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"`
	// RegexValues holds regular expressions to match instead of exact/wildcard
	// Values. Valid only for host-header, path-pattern, and http-header conditions
	// (types.RuleCondition.RegexValues / HostHeaderConditionConfig.RegexValues /
	// PathPatternConditionConfig.RegexValues / HttpHeaderConditionConfig.RegexValues).
	RegexValues []string `json:"regexValues,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
	Transforms  []RuleTransform
	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 HostHeaderRewriteConfig added in v1.3.1

type HostHeaderRewriteConfig struct {
	Rewrites []RewriteConfig `json:"rewrites,omitempty"`
}

HostHeaderRewriteConfig holds the rewrite rules for a host-header-rewrite transform.

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,
	contents []RevocationContentInput,
) ([]TrustStoreRevocation, error)

AddTrustStoreRevocations appends revocation entries to a trust store, assigning each a monotonically increasing RevocationId (real AWS assigns this server-side; see RevocationContentInput doc comment). Returns the newly created revocations so the caller can echo them in the AddTrustStoreRevocationsResult response.

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,
	s3Bucket, s3Key, s3ObjectVersion string,
) (*TrustStore, error)

CreateTrustStore creates a new trust store. s3Bucket/s3Key/s3ObjectVersion are CreateTrustStoreInput's CaCertificatesBundleS3* fields (Bucket/Key required on the real wire) -- stored inertly, see TrustStore's doc comment.

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,
	transforms []RuleTransform,
	resetTransforms bool,
) (*Rule, error)

ModifyRule updates the actions, conditions, and/or transforms of an existing rule. resetTransforms clears Transforms entirely; it is mutually exclusive with a non-empty transforms (enforced by the handler, per ModifyRuleInput's doc comment).

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 string,
	s3Bucket, s3Key, s3ObjectVersion string,
) (*TrustStore, error)

ModifyTrustStore looks up a trust store for ModifyTrustStoreInput, whose only real fields are TrustStoreArn and the CA certificates bundle location (CaCertificatesBundleS3Bucket/Key/ObjectVersion, both Bucket/Key required on the real wire). Bundle content itself stays inert -- see TrustStore's doc comment -- but the location is now recorded (gopherstack-hl3h), matching CreateTrustStore so the two ops model the same shape consistently.

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 []int64,
) 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 RevocationContentInput added in v1.2.0

type RevocationContentInput struct {
	S3Bucket        string `json:"s3Bucket,omitempty"`
	S3Key           string `json:"s3Key,omitempty"`
	S3ObjectVersion string `json:"s3ObjectVersion,omitempty"`
	RevocationType  string `json:"revocationType,omitempty"`
}

RevocationContentInput represents a single revocation-file reference submitted to AddTrustStoreRevocations. Mirrors aws-sdk-go-v2 types.RevocationContent exactly -- S3Bucket/S3Key/S3ObjectVersion/RevocationType is the only real wire shape; there is no plain/inline revocation-content field on the real API.

type RewriteConfig added in v1.3.1

type RewriteConfig struct {
	Regex   string `json:"regex"`
	Replace string `json:"replace"`
}

RewriteConfig holds a regex/replace pair applied by a host-header-rewrite or url-rewrite transform. Both Regex and Replace are required on the real wire (types.RewriteConfig).

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"`
	Transforms  []RuleTransform `json:"transforms,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 RuleTransform added in v1.3.1

type RuleTransform struct {
	HostHeaderRewriteConfig *HostHeaderRewriteConfig `json:"hostHeaderRewriteConfig,omitempty"`
	URLRewriteConfig        *URLRewriteConfig        `json:"urlRewriteConfig,omitempty"`
	Type                    string                   `json:"type"`
}

RuleTransform represents a single request transform applied before forwarding to targets. Type is one of "host-header-rewrite"/"url-rewrite" (types.TransformTypeEnum); exactly one of HostHeaderRewriteConfig/URLRewriteConfig is set, matching Type.

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,
		transforms []RuleTransform, resetTransforms bool,
	) (*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, s3Bucket, s3Key, s3ObjectVersion string) (*TrustStore, error)
	DescribeTrustStores(arns []string, names []string) ([]TrustStore, error)
	DeleteTrustStore(trustStoreArn string) error
	ModifyTrustStore(trustStoreArn string, s3Bucket, s3Key, s3ObjectVersion string) (*TrustStore, error)
	AddTrustStoreRevocations(
		trustStoreArn string,
		contents []RevocationContentInput,
	) ([]TrustStoreRevocation, error)
	RemoveTrustStoreRevocations(trustStoreArn string, revocationIDs []int64) 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"`
	CaCertificatesBundleS3Bucket        string                 `json:"caCertificatesBundleS3Bucket,omitempty"`
	CaCertificatesBundleS3Key           string                 `json:"caCertificatesBundleS3Key,omitempty"`
	CaCertificatesBundleS3ObjectVersion string                 `json:"caCertificatesBundleS3ObjectVersion,omitempty"`
	Revocations                         []TrustStoreRevocation `json:"revocations,omitempty"`
	TotalRevokedEntries                 int64                  `json:"totalRevokedEntries"`
}

TrustStore represents an ELBv2 trust store. CaCertificatesBundleS3* fields are stored inertly -- this emulator has no real S3 to fetch the bundle from (see GetTrustStoreCaCertificatesBundle's always-empty Location), so they are recorded but never used to compute NumberOfCaCertificates or content.

type TrustStoreRevocation

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

TrustStoreRevocation represents a single revocation entry stored in a trust store. RevocationID is int64 -- verified against aws-sdk-go-v2 types.TrustStoreRevocation / types.DescribeTrustStoreRevocation (RevocationId *int64). AWS assigns this ID itself when it parses the uploaded revocation file; it is never client-supplied.

type URLRewriteConfig added in v1.3.1

type URLRewriteConfig struct {
	Rewrites []RewriteConfig `json:"rewrites,omitempty"`
}

URLRewriteConfig holds the rewrite rules for a url-rewrite transform.

Jump to

Keyboard shortcuts

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