elbv2

package
v0.0.1-alpha.37 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Type                string               `json:"Type" xml:"Type"`
	TargetGroupArn      string               `json:"TargetGroupArn,omitempty" xml:"TargetGroupArn,omitempty"`
	Order               int                  `json:"Order,omitempty" xml:"Order,omitempty"`
	RedirectConfig      *RedirectConfig      `json:"RedirectConfig,omitempty" xml:"RedirectConfig,omitempty"`
	FixedResponseConfig *FixedResponseConfig `json:"FixedResponseConfig,omitempty" xml:"FixedResponseConfig,omitempty"`
}

Action is a listener action. Only "forward" (via TargetGroupArn) has a data-plane effect — pickTarget (handler_proxy.go) only knows how to reach a plain forward. RedirectConfig and FixedResponseConfig round-trip through DescribeListeners so a CDK-authored redirect or fixed-response listener keeps its shape, but Overcast does not act on either: a request against such a listener still resolves through forwardTargetGroups rather than actually redirecting or returning the fixed body. ForwardConfig's weighted multi-target-group form, Certificates/SslPolicy/AlpnPolicy/ MutualAuthentication, and the Cognito/OIDC auth actions are not modelled at all — a template using them keeps whatever it set at the CFN layer only if the emulator's caller reads it back from the template, not from DescribeListeners.

json tags double as both the storage encoding (putListener) and the Query-form decode key (query.go's decodeStruct reads the json tag); xml tags on the nested config types double as the DescribeListeners/ CreateListener response encoding, so one type serves all three without a second "xmlAction" mirror.

type FixedResponseConfig

type FixedResponseConfig struct {
	MessageBody string `json:"MessageBody,omitempty" xml:"MessageBody,omitempty"`
	StatusCode  string `json:"StatusCode,omitempty" xml:"StatusCode,omitempty"`
	ContentType string `json:"ContentType,omitempty" xml:"ContentType,omitempty"`
}

FixedResponseConfig is a listener action's FixedResponseConfig member.

type Handler

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

func (*Handler) AddTags

func (h *Handler) AddTags(w http.ResponseWriter, r *http.Request)

AddTags adds tags to load balancers and target groups.

func (*Handler) CreateListener

func (h *Handler) CreateListener(w http.ResponseWriter, r *http.Request)

CreateListener creates a listener.

func (*Handler) CreateLoadBalancer

func (h *Handler) CreateLoadBalancer(w http.ResponseWriter, r *http.Request)

CreateLoadBalancer creates a load balancer.

func (*Handler) CreateTargetGroup

func (h *Handler) CreateTargetGroup(w http.ResponseWriter, r *http.Request)

CreateTargetGroup creates a target group.

func (*Handler) DeleteListener

func (h *Handler) DeleteListener(w http.ResponseWriter, r *http.Request)

DeleteListener deletes a listener.

func (*Handler) DeleteLoadBalancer

func (h *Handler) DeleteLoadBalancer(w http.ResponseWriter, r *http.Request)

DeleteLoadBalancer deletes a load balancer.

func (*Handler) DeleteTargetGroup

func (h *Handler) DeleteTargetGroup(w http.ResponseWriter, r *http.Request)

DeleteTargetGroup deletes a target group.

func (*Handler) DeregisterTargets

func (h *Handler) DeregisterTargets(w http.ResponseWriter, r *http.Request)

DeregisterTargets deregisters targets from a target group.

func (*Handler) DescribeListeners

func (h *Handler) DescribeListeners(w http.ResponseWriter, r *http.Request)

DescribeListeners describes listeners.

func (*Handler) DescribeLoadBalancers

func (h *Handler) DescribeLoadBalancers(w http.ResponseWriter, r *http.Request)

DescribeLoadBalancers describes load balancers.

func (*Handler) DescribeTags

func (h *Handler) DescribeTags(w http.ResponseWriter, r *http.Request)

DescribeTags describes tags on load balancers and target groups.

func (*Handler) DescribeTargetGroupAttributes

func (h *Handler) DescribeTargetGroupAttributes(w http.ResponseWriter, r *http.Request)

DescribeTargetGroupAttributes describes a target group's Attributes map.

func (*Handler) DescribeTargetGroups

func (h *Handler) DescribeTargetGroups(w http.ResponseWriter, r *http.Request)

DescribeTargetGroups describes target groups.

func (*Handler) DescribeTargetHealth

func (h *Handler) DescribeTargetHealth(w http.ResponseWriter, r *http.Request)

DescribeTargetHealth describes the health of a target group's targets.

func (*Handler) ModifyTargetGroup

func (h *Handler) ModifyTargetGroup(w http.ResponseWriter, r *http.Request)

ModifyTargetGroup updates a target group's health-check configuration.

func (*Handler) ModifyTargetGroupAttributes

func (h *Handler) ModifyTargetGroupAttributes(w http.ResponseWriter, r *http.Request)

ModifyTargetGroupAttributes updates a target group's Attributes map.

func (*Handler) ProxyRequest

func (h *Handler) ProxyRequest(w http.ResponseWriter, r *http.Request)

ProxyRequest forwards a request to a target registered behind the load balancer whose DNS name it arrived on.

func (*Handler) RegisterTargets

func (h *Handler) RegisterTargets(w http.ResponseWriter, r *http.Request)

RegisterTargets registers targets with a target group.

func (*Handler) RemoveTags

func (h *Handler) RemoveTags(w http.ResponseWriter, r *http.Request)

RemoveTags removes tags from load balancers and target groups.

type Listener

type Listener struct {
	ListenerArn     string `json:"ListenerArn"`
	LoadBalancerArn string `json:"LoadBalancerArn"`
	Protocol        string `json:"Protocol"`
	Port            int    `json:"Port"`
	Region          string `json:"Region"`
	// DefaultActions is what the listener does with a request no rule matched.
	// It carries the listener's link to its target group, so without it a load
	// balancer cannot forward anywhere.
	DefaultActions []Action `json:"DefaultActions,omitempty"`
}

type LoadBalancer

type LoadBalancer struct {
	LoadBalancerArn  string            `json:"LoadBalancerArn"`
	LoadBalancerName string            `json:"LoadBalancerName"`
	DNSName          string            `json:"DNSName"`
	Type             string            `json:"Type"`
	Scheme           string            `json:"Scheme"`
	IpAddressType    string            `json:"IpAddressType,omitempty"`
	State            string            `json:"State"`
	VpcId            string            `json:"VpcId,omitempty"`
	CreatedTime      time.Time         `json:"CreatedTime"`
	Region           string            `json:"Region"`
	Tags             map[string]string `json:"Tags,omitempty"`
}

type Matcher

type Matcher struct {
	HttpCode string `json:"HttpCode,omitempty" xml:"HttpCode,omitempty"`
	GrpcCode string `json:"GrpcCode,omitempty" xml:"GrpcCode,omitempty"`
}

Matcher is the target group health-check success matcher (HealthCheck's Matcher property).

type RedirectConfig

type RedirectConfig struct {
	Protocol   string `json:"Protocol,omitempty" xml:"Protocol,omitempty"`
	Port       string `json:"Port,omitempty" xml:"Port,omitempty"`
	Host       string `json:"Host,omitempty" xml:"Host,omitempty"`
	Path       string `json:"Path,omitempty" xml:"Path,omitempty"`
	Query      string `json:"Query,omitempty" xml:"Query,omitempty"`
	StatusCode string `json:"StatusCode,omitempty" xml:"StatusCode,omitempty"`
}

RedirectConfig is a listener action's RedirectConfig member — the shape a CDK HTTP→HTTPS redirect listener sends.

type Service

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

func New

func New(cfg *config.Config, store state.Store, logger *zap.Logger, clk clock.Clock) *Service

func (*Service) DeregisterTarget

func (s *Service) DeregisterTarget(ctx context.Context, targetGroupArn, address string) error

func (*Service) DispatchQuery

func (s *Service) DispatchQuery(w http.ResponseWriter, r *http.Request)

func (*Service) HostRouteRewrite

func (s *Service) HostRouteRewrite(r *http.Request, _ middleware.HostRouteMatch)

HostRouteRewrite claims a request addressed to a load balancer's DNS name.

Kept thin per the hostroute recipe: the handler resolves the load balancer from the Host header itself, so nothing about the name needs re-encoding into the path. The ALB hostname puts the region *before* the label ({name}-{id}.{region}.elb.{base}), so m.ID carries both and is not a useful key on its own.

func (*Service) Name

func (s *Service) Name() string

func (*Service) Operations

func (s *Service) Operations() []op.Operation

func (*Service) OwnsAction

func (s *Service) OwnsAction(action string) bool

func (*Service) OwnsVersion

func (s *Service) OwnsVersion(version string) bool

func (*Service) RegisterRoutes

func (s *Service) RegisterRoutes(r chi.Router)

RegisterRoutes mounts the load balancer data plane. Requests arriving on a load balancer's DNS name are rewritten onto /_overcast/elb by HostRouteRewrite and forwarded to a registered target from here.

func (*Service) RegisterTarget

func (s *Service) RegisterTarget(ctx context.Context, targetGroupArn, address string, port int) error

RegisterTarget adds an address to a target group, and DeregisterTarget removes it. ECS calls these as it places and stops the tasks of a service with a loadBalancers configuration, which is what puts a Fargate service behind its load balancer.

func (*Service) SupportedProtocols

func (s *Service) SupportedProtocols() []codec.Codec

type Target

type Target struct {
	TargetGroupArn string `json:"TargetGroupArn"`
	Id             string `json:"Id"`
	Port           int    `json:"Port,omitempty"`
}

type TargetGroup

type TargetGroup struct {
	TargetGroupArn  string `json:"TargetGroupArn"`
	TargetGroupName string `json:"TargetGroupName"`
	Protocol        string `json:"Protocol"`
	ProtocolVersion string `json:"ProtocolVersion,omitempty"`
	Port            int    `json:"Port"`
	VpcId           string `json:"VpcId,omitempty"`
	TargetType      string `json:"TargetType"`
	IpAddressType   string `json:"IpAddressType,omitempty"`

	// Health check block. CDK/CloudFormation templates set this via the
	// HealthCheck* properties on AWS::ElasticLoadBalancingV2::TargetGroup;
	// it round-trips through DescribeTargetGroups but is not evaluated
	// against registered targets — DescribeTargetHealth always answers
	// "healthy" (handler.go). Storage is faithful; enforcement is not
	// implemented.
	HealthCheckEnabled         bool     `json:"HealthCheckEnabled"`
	HealthCheckProtocol        string   `json:"HealthCheckProtocol,omitempty"`
	HealthCheckPort            string   `json:"HealthCheckPort,omitempty"`
	HealthCheckPath            string   `json:"HealthCheckPath,omitempty"`
	HealthCheckIntervalSeconds int      `json:"HealthCheckIntervalSeconds,omitempty"`
	HealthCheckTimeoutSeconds  int      `json:"HealthCheckTimeoutSeconds,omitempty"`
	HealthyThresholdCount      int      `json:"HealthyThresholdCount,omitempty"`
	UnhealthyThresholdCount    int      `json:"UnhealthyThresholdCount,omitempty"`
	Matcher                    *Matcher `json:"Matcher,omitempty"`

	// Attributes holds ModifyTargetGroupAttributes settings (e.g.
	// deregistration_delay.timeout_seconds, stickiness.enabled) keyed by
	// their AWS attribute name. Stored and echoed by
	// DescribeTargetGroupAttributes; not enforced by the data plane.
	Attributes map[string]string `json:"Attributes,omitempty"`

	Region string            `json:"Region"`
	Tags   map[string]string `json:"Tags,omitempty"`
}

Jump to

Keyboard shortcuts

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