AWS SDK for Go (PILOT)
API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

ELBV2

import "github.com/aws/aws-sdk-go/service/elbv2"

type ELBV2 struct { *client.Client }

ELBV2 provides the API operation methods for making requests to Elastic Load Balancing. See this package's package overview docs for details on the service.

ELBV2 methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

Client

Type: *client.Client

Method

AddListenerCertificates

func (c *ELBV2) AddListenerCertificates(input *AddListenerCertificatesInput) (*AddListenerCertificatesOutput, error)

AddListenerCertificates API operation for Elastic Load Balancing.

Adds the specified certificate to the specified HTTPS listener.

If the certificate was already added, the call is successful but the certificate is not added again.

To list the certificates for your listener, use DescribeListenerCertificates. To remove certificates from your listener, use RemoveListenerCertificates. To specify the default SSL server certificate, use ModifyListener.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation AddListenerCertificates for usage and error information.

Returned Error Codes:

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

  • ErrCodeTooManyCertificatesException "TooManyCertificates" You've reached the limit on the number of certificates per load balancer.

  • ErrCodeCertificateNotFoundException "CertificateNotFound" The specified certificate does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/AddListenerCertificates

AddListenerCertificatesRequest

func (c *ELBV2) AddListenerCertificatesRequest(input *AddListenerCertificatesInput) (req *request.Request, output *AddListenerCertificatesOutput)

AddListenerCertificatesRequest generates a "aws/request.Request" representing the client's request for the AddListenerCertificates operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See AddListenerCertificates for more information on using the AddListenerCertificates API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the AddListenerCertificatesRequest method. req, resp := client.AddListenerCertificatesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/AddListenerCertificates

AddListenerCertificatesWithContext

func (c *ELBV2) AddListenerCertificatesWithContext(ctx aws.Context, input *AddListenerCertificatesInput, opts ...request.Option) (*AddListenerCertificatesOutput, error)

AddListenerCertificatesWithContext is the same as AddListenerCertificates with the addition of the ability to pass a context and additional request options.

See AddListenerCertificates for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

AddTags

func (c *ELBV2) AddTags(input *AddTagsInput) (*AddTagsOutput, error)

AddTags API operation for Elastic Load Balancing.

Adds the specified tags to the specified Elastic Load Balancing resource. You can tag your Application Load Balancers, Network Load Balancers, and your target groups.

Each tag consists of a key and an optional value. If a resource already has a tag with the same key, AddTags updates its value.

To list the current tags for your resources, use DescribeTags. To remove tags from your resources, use RemoveTags.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation AddTags for usage and error information.

Returned Error Codes:

  • ErrCodeDuplicateTagKeysException "DuplicateTagKeys" A tag key was specified more than once.

  • ErrCodeTooManyTagsException "TooManyTags" You've reached the limit on the number of tags per load balancer.

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/AddTags

Example

ELBV2 AddTags shared00

To add tags to a load balancer

This example adds the specified tags to the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.AddTagsInput{ ResourceArns: []*string{ aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), }, Tags: []*elbv2.Tag{ { Key: aws.String("project"), Value: aws.String("lima"), }, { Key: aws.String("department"), Value: aws.String("digital-media"), }, }, } result, err := svc.AddTags(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeDuplicateTagKeysException: fmt.Println(elbv2.ErrCodeDuplicateTagKeysException, aerr.Error()) case elbv2.ErrCodeTooManyTagsException: fmt.Println(elbv2.ErrCodeTooManyTagsException, aerr.Error()) case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

AddTagsRequest

func (c *ELBV2) AddTagsRequest(input *AddTagsInput) (req *request.Request, output *AddTagsOutput)

AddTagsRequest generates a "aws/request.Request" representing the client's request for the AddTags operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See AddTags for more information on using the AddTags API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the AddTagsRequest method. req, resp := client.AddTagsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/AddTags

AddTagsWithContext

func (c *ELBV2) AddTagsWithContext(ctx aws.Context, input *AddTagsInput, opts ...request.Option) (*AddTagsOutput, error)

AddTagsWithContext is the same as AddTags with the addition of the ability to pass a context and additional request options.

See AddTags for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreateListener

func (c *ELBV2) CreateListener(input *CreateListenerInput) (*CreateListenerOutput, error)

CreateListener API operation for Elastic Load Balancing.

Creates a listener for the specified Application Load Balancer or Network Load Balancer.

To update a listener, use ModifyListener. When you are finished with a listener, you can delete it using DeleteListener. If you are finished with both the listener and the load balancer, you can delete them both using DeleteLoadBalancer.

This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple listeners with the same settings, each call succeeds.

For more information, see Listeners for Your Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html) in the Application Load Balancers Guide and Listeners for Your Network Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-listeners.html) in the Network Load Balancers Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation CreateListener for usage and error information.

Returned Error Codes:

  • ErrCodeDuplicateListenerException "DuplicateListener" A listener with the specified port already exists.

  • ErrCodeTooManyListenersException "TooManyListeners" You've reached the limit on the number of listeners per load balancer.

  • ErrCodeTooManyCertificatesException "TooManyCertificates" You've reached the limit on the number of certificates per load balancer.

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeTargetGroupAssociationLimitException "TargetGroupAssociationLimit" You've reached the limit on the number of load balancers per target group.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

  • ErrCodeIncompatibleProtocolsException "IncompatibleProtocols" The specified configuration is not valid with this protocol.

  • ErrCodeSSLPolicyNotFoundException "SSLPolicyNotFound" The specified SSL policy does not exist.

  • ErrCodeCertificateNotFoundException "CertificateNotFound" The specified certificate does not exist.

  • ErrCodeUnsupportedProtocolException "UnsupportedProtocol" The specified protocol is not supported.

  • ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" You've reached the limit on the number of times a target can be registered with a load balancer.

  • ErrCodeTooManyTargetsException "TooManyTargets" You've reached the limit on the number of targets.

  • ErrCodeTooManyActionsException "TooManyActions" You've reached the limit on the number of actions per rule.

  • ErrCodeInvalidLoadBalancerActionException "InvalidLoadBalancerAction" The requested action is not valid.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateListener

Examples

ELBV2 CreateListener shared00

To create an HTTP listener

This example creates an HTTP listener for the specified load balancer that forwards requests to the specified target group.

{ svc := elbv2.New(session.New()) input := &elbv2.CreateListenerInput{ DefaultActions: []*elbv2.Action{ { TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), Type: aws.String("forward"), }, }, LoadBalancerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), Port: aws.Int64(80), Protocol: aws.String("HTTP"), } result, err := svc.CreateListener(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeDuplicateListenerException: fmt.Println(elbv2.ErrCodeDuplicateListenerException, aerr.Error()) case elbv2.ErrCodeTooManyListenersException: fmt.Println(elbv2.ErrCodeTooManyListenersException, aerr.Error()) case elbv2.ErrCodeTooManyCertificatesException: fmt.Println(elbv2.ErrCodeTooManyCertificatesException, aerr.Error()) case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupAssociationLimitException: fmt.Println(elbv2.ErrCodeTargetGroupAssociationLimitException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) case elbv2.ErrCodeIncompatibleProtocolsException: fmt.Println(elbv2.ErrCodeIncompatibleProtocolsException, aerr.Error()) case elbv2.ErrCodeSSLPolicyNotFoundException: fmt.Println(elbv2.ErrCodeSSLPolicyNotFoundException, aerr.Error()) case elbv2.ErrCodeCertificateNotFoundException: fmt.Println(elbv2.ErrCodeCertificateNotFoundException, aerr.Error()) case elbv2.ErrCodeUnsupportedProtocolException: fmt.Println(elbv2.ErrCodeUnsupportedProtocolException, aerr.Error()) case elbv2.ErrCodeTooManyRegistrationsForTargetIdException: fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error()) case elbv2.ErrCodeTooManyTargetsException: fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error()) case elbv2.ErrCodeTooManyActionsException: fmt.Println(elbv2.ErrCodeTooManyActionsException, aerr.Error()) case elbv2.ErrCodeInvalidLoadBalancerActionException: fmt.Println(elbv2.ErrCodeInvalidLoadBalancerActionException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
ELBV2 CreateListener shared01

To create an HTTPS listener

This example creates an HTTPS listener for the specified load balancer that forwards requests to the specified target group. Note that you must specify an SSL certificate for an HTTPS listener. You can create and manage certificates using AWS Certificate Manager (ACM). Alternatively, you can create a certificate using SSL/TLS tools, get the certificate signed by a certificate authority (CA), and upload the certificate to AWS Identity and Access Management (IAM).

{ svc := elbv2.New(session.New()) input := &elbv2.CreateListenerInput{ Certificates: []*elbv2.Certificate{ { CertificateArn: aws.String("arn:aws:iam::123456789012:server-certificate/my-server-cert"), }, }, DefaultActions: []*elbv2.Action{ { TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), Type: aws.String("forward"), }, }, LoadBalancerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), Port: aws.Int64(443), Protocol: aws.String("HTTPS"), SslPolicy: aws.String("ELBSecurityPolicy-2015-05"), } result, err := svc.CreateListener(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeDuplicateListenerException: fmt.Println(elbv2.ErrCodeDuplicateListenerException, aerr.Error()) case elbv2.ErrCodeTooManyListenersException: fmt.Println(elbv2.ErrCodeTooManyListenersException, aerr.Error()) case elbv2.ErrCodeTooManyCertificatesException: fmt.Println(elbv2.ErrCodeTooManyCertificatesException, aerr.Error()) case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupAssociationLimitException: fmt.Println(elbv2.ErrCodeTargetGroupAssociationLimitException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) case elbv2.ErrCodeIncompatibleProtocolsException: fmt.Println(elbv2.ErrCodeIncompatibleProtocolsException, aerr.Error()) case elbv2.ErrCodeSSLPolicyNotFoundException: fmt.Println(elbv2.ErrCodeSSLPolicyNotFoundException, aerr.Error()) case elbv2.ErrCodeCertificateNotFoundException: fmt.Println(elbv2.ErrCodeCertificateNotFoundException, aerr.Error()) case elbv2.ErrCodeUnsupportedProtocolException: fmt.Println(elbv2.ErrCodeUnsupportedProtocolException, aerr.Error()) case elbv2.ErrCodeTooManyRegistrationsForTargetIdException: fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error()) case elbv2.ErrCodeTooManyTargetsException: fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error()) case elbv2.ErrCodeTooManyActionsException: fmt.Println(elbv2.ErrCodeTooManyActionsException, aerr.Error()) case elbv2.ErrCodeInvalidLoadBalancerActionException: fmt.Println(elbv2.ErrCodeInvalidLoadBalancerActionException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreateListenerRequest

func (c *ELBV2) CreateListenerRequest(input *CreateListenerInput) (req *request.Request, output *CreateListenerOutput)

CreateListenerRequest generates a "aws/request.Request" representing the client's request for the CreateListener operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateListener for more information on using the CreateListener API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateListenerRequest method. req, resp := client.CreateListenerRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateListener

CreateListenerWithContext

func (c *ELBV2) CreateListenerWithContext(ctx aws.Context, input *CreateListenerInput, opts ...request.Option) (*CreateListenerOutput, error)

CreateListenerWithContext is the same as CreateListener with the addition of the ability to pass a context and additional request options.

See CreateListener for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreateLoadBalancer

func (c *ELBV2) CreateLoadBalancer(input *CreateLoadBalancerInput) (*CreateLoadBalancerOutput, error)

CreateLoadBalancer API operation for Elastic Load Balancing.

Creates an Application Load Balancer or a Network Load Balancer.

When you create a load balancer, you can specify security groups, public subnets, IP address type, and tags. Otherwise, you could do so later using SetSecurityGroups, SetSubnets, SetIpAddressType, and AddTags.

To create listeners for your load balancer, use CreateListener. To describe your current load balancers, see DescribeLoadBalancers. When you are finished with a load balancer, you can delete it using DeleteLoadBalancer.

For limit information, see Limits for Your Application Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html) in the Application Load Balancers Guide and Limits for Your Network Load Balancer (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-limits.html) in the Network Load Balancers Guide.

This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple load balancers with the same settings, each call succeeds.

For more information, see Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html) in the Application Load Balancers Guide and Network Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html) in the Network Load Balancers Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation CreateLoadBalancer for usage and error information.

Returned Error Codes:

  • ErrCodeDuplicateLoadBalancerNameException "DuplicateLoadBalancerName" A load balancer with the specified name already exists.

  • ErrCodeTooManyLoadBalancersException "TooManyLoadBalancers" You've reached the limit on the number of load balancers for your AWS account.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

  • ErrCodeSubnetNotFoundException "SubnetNotFound" The specified subnet does not exist.

  • ErrCodeInvalidSubnetException "InvalidSubnet" The specified subnet is out of available addresses.

  • ErrCodeInvalidSecurityGroupException "InvalidSecurityGroup" The specified security group does not exist.

  • ErrCodeInvalidSchemeException "InvalidScheme" The requested scheme is not valid.

  • ErrCodeTooManyTagsException "TooManyTags" You've reached the limit on the number of tags per load balancer.

  • ErrCodeDuplicateTagKeysException "DuplicateTagKeys" A tag key was specified more than once.

  • ErrCodeResourceInUseException "ResourceInUse" A specified resource is in use.

  • ErrCodeAllocationIdNotFoundException "AllocationIdNotFound" The specified allocation ID does not exist.

  • ErrCodeAvailabilityZoneNotSupportedException "AvailabilityZoneNotSupported" The specified Availability Zone is not supported.

  • ErrCodeOperationNotPermittedException "OperationNotPermitted" This operation is not allowed.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateLoadBalancer

Examples

ELBV2 CreateLoadBalancer shared00

To create an Internet-facing load balancer

This example creates an Internet-facing load balancer and enables the Availability Zones for the specified subnets.

{ svc := elbv2.New(session.New()) input := &elbv2.CreateLoadBalancerInput{ Name: aws.String("my-load-balancer"), Subnets: []*string{ aws.String("subnet-b7d581c0"), aws.String("subnet-8360a9e7"), }, } result, err := svc.CreateLoadBalancer(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeDuplicateLoadBalancerNameException: fmt.Println(elbv2.ErrCodeDuplicateLoadBalancerNameException, aerr.Error()) case elbv2.ErrCodeTooManyLoadBalancersException: fmt.Println(elbv2.ErrCodeTooManyLoadBalancersException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) case elbv2.ErrCodeSubnetNotFoundException: fmt.Println(elbv2.ErrCodeSubnetNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidSubnetException: fmt.Println(elbv2.ErrCodeInvalidSubnetException, aerr.Error()) case elbv2.ErrCodeInvalidSecurityGroupException: fmt.Println(elbv2.ErrCodeInvalidSecurityGroupException, aerr.Error()) case elbv2.ErrCodeInvalidSchemeException: fmt.Println(elbv2.ErrCodeInvalidSchemeException, aerr.Error()) case elbv2.ErrCodeTooManyTagsException: fmt.Println(elbv2.ErrCodeTooManyTagsException, aerr.Error()) case elbv2.ErrCodeDuplicateTagKeysException: fmt.Println(elbv2.ErrCodeDuplicateTagKeysException, aerr.Error()) case elbv2.ErrCodeResourceInUseException: fmt.Println(elbv2.ErrCodeResourceInUseException, aerr.Error()) case elbv2.ErrCodeAllocationIdNotFoundException: fmt.Println(elbv2.ErrCodeAllocationIdNotFoundException, aerr.Error()) case elbv2.ErrCodeAvailabilityZoneNotSupportedException: fmt.Println(elbv2.ErrCodeAvailabilityZoneNotSupportedException, aerr.Error()) case elbv2.ErrCodeOperationNotPermittedException: fmt.Println(elbv2.ErrCodeOperationNotPermittedException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
ELBV2 CreateLoadBalancer shared01

To create an internal load balancer

This example creates an internal load balancer and enables the Availability Zones for the specified subnets.

{ svc := elbv2.New(session.New()) input := &elbv2.CreateLoadBalancerInput{ Name: aws.String("my-internal-load-balancer"), Scheme: aws.String("internal"), Subnets: []*string{ aws.String("subnet-b7d581c0"), aws.String("subnet-8360a9e7"), }, } result, err := svc.CreateLoadBalancer(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeDuplicateLoadBalancerNameException: fmt.Println(elbv2.ErrCodeDuplicateLoadBalancerNameException, aerr.Error()) case elbv2.ErrCodeTooManyLoadBalancersException: fmt.Println(elbv2.ErrCodeTooManyLoadBalancersException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) case elbv2.ErrCodeSubnetNotFoundException: fmt.Println(elbv2.ErrCodeSubnetNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidSubnetException: fmt.Println(elbv2.ErrCodeInvalidSubnetException, aerr.Error()) case elbv2.ErrCodeInvalidSecurityGroupException: fmt.Println(elbv2.ErrCodeInvalidSecurityGroupException, aerr.Error()) case elbv2.ErrCodeInvalidSchemeException: fmt.Println(elbv2.ErrCodeInvalidSchemeException, aerr.Error()) case elbv2.ErrCodeTooManyTagsException: fmt.Println(elbv2.ErrCodeTooManyTagsException, aerr.Error()) case elbv2.ErrCodeDuplicateTagKeysException: fmt.Println(elbv2.ErrCodeDuplicateTagKeysException, aerr.Error()) case elbv2.ErrCodeResourceInUseException: fmt.Println(elbv2.ErrCodeResourceInUseException, aerr.Error()) case elbv2.ErrCodeAllocationIdNotFoundException: fmt.Println(elbv2.ErrCodeAllocationIdNotFoundException, aerr.Error()) case elbv2.ErrCodeAvailabilityZoneNotSupportedException: fmt.Println(elbv2.ErrCodeAvailabilityZoneNotSupportedException, aerr.Error()) case elbv2.ErrCodeOperationNotPermittedException: fmt.Println(elbv2.ErrCodeOperationNotPermittedException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreateLoadBalancerRequest

func (c *ELBV2) CreateLoadBalancerRequest(input *CreateLoadBalancerInput) (req *request.Request, output *CreateLoadBalancerOutput)

CreateLoadBalancerRequest generates a "aws/request.Request" representing the client's request for the CreateLoadBalancer operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateLoadBalancer for more information on using the CreateLoadBalancer API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateLoadBalancerRequest method. req, resp := client.CreateLoadBalancerRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateLoadBalancer

CreateLoadBalancerWithContext

func (c *ELBV2) CreateLoadBalancerWithContext(ctx aws.Context, input *CreateLoadBalancerInput, opts ...request.Option) (*CreateLoadBalancerOutput, error)

CreateLoadBalancerWithContext is the same as CreateLoadBalancer with the addition of the ability to pass a context and additional request options.

See CreateLoadBalancer for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreateRule

func (c *ELBV2) CreateRule(input *CreateRuleInput) (*CreateRuleOutput, error)

CreateRule API operation for Elastic Load Balancing.

Creates a rule for the specified listener. The listener must be associated with an Application Load Balancer.

Rules are evaluated in priority order, from the lowest value to the highest value. When the conditions for a rule are met, its actions are performed. If the conditions for no rules are met, the actions for the default rule are performed. For more information, see Listener Rules (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#listener-rules) in the Application Load Balancers Guide.

To view your current rules, use DescribeRules. To update a rule, use ModifyRule. To set the priorities of your rules, use SetRulePriorities. To delete a rule, use DeleteRule.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation CreateRule for usage and error information.

Returned Error Codes:

  • ErrCodePriorityInUseException "PriorityInUse" The specified priority is in use.

  • ErrCodeTooManyTargetGroupsException "TooManyTargetGroups" You've reached the limit on the number of target groups for your AWS account.

  • ErrCodeTooManyRulesException "TooManyRules" You've reached the limit on the number of rules per load balancer.

  • ErrCodeTargetGroupAssociationLimitException "TargetGroupAssociationLimit" You've reached the limit on the number of load balancers per target group.

  • ErrCodeIncompatibleProtocolsException "IncompatibleProtocols" The specified configuration is not valid with this protocol.

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

  • ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" You've reached the limit on the number of times a target can be registered with a load balancer.

  • ErrCodeTooManyTargetsException "TooManyTargets" You've reached the limit on the number of targets.

  • ErrCodeUnsupportedProtocolException "UnsupportedProtocol" The specified protocol is not supported.

  • ErrCodeTooManyActionsException "TooManyActions" You've reached the limit on the number of actions per rule.

  • ErrCodeInvalidLoadBalancerActionException "InvalidLoadBalancerAction" The requested action is not valid.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateRule

Example

ELBV2 CreateRule shared00

To create a rule

This example creates a rule that forwards requests to the specified target group if the URL contains the specified pattern (for example, /img/*).

{ svc := elbv2.New(session.New()) input := &elbv2.CreateRuleInput{ Actions: []*elbv2.Action{ { TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), Type: aws.String("forward"), }, }, Conditions: []*elbv2.RuleCondition{ { Field: aws.String("path-pattern"), Values: []*string{ aws.String("/img/*"), }, }, }, ListenerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"), Priority: aws.Int64(10), } result, err := svc.CreateRule(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodePriorityInUseException: fmt.Println(elbv2.ErrCodePriorityInUseException, aerr.Error()) case elbv2.ErrCodeTooManyTargetGroupsException: fmt.Println(elbv2.ErrCodeTooManyTargetGroupsException, aerr.Error()) case elbv2.ErrCodeTooManyRulesException: fmt.Println(elbv2.ErrCodeTooManyRulesException, aerr.Error()) case elbv2.ErrCodeTargetGroupAssociationLimitException: fmt.Println(elbv2.ErrCodeTargetGroupAssociationLimitException, aerr.Error()) case elbv2.ErrCodeIncompatibleProtocolsException: fmt.Println(elbv2.ErrCodeIncompatibleProtocolsException, aerr.Error()) case elbv2.ErrCodeListenerNotFoundException: fmt.Println(elbv2.ErrCodeListenerNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) case elbv2.ErrCodeTooManyRegistrationsForTargetIdException: fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error()) case elbv2.ErrCodeTooManyTargetsException: fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error()) case elbv2.ErrCodeUnsupportedProtocolException: fmt.Println(elbv2.ErrCodeUnsupportedProtocolException, aerr.Error()) case elbv2.ErrCodeTooManyActionsException: fmt.Println(elbv2.ErrCodeTooManyActionsException, aerr.Error()) case elbv2.ErrCodeInvalidLoadBalancerActionException: fmt.Println(elbv2.ErrCodeInvalidLoadBalancerActionException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreateRuleRequest

func (c *ELBV2) CreateRuleRequest(input *CreateRuleInput) (req *request.Request, output *CreateRuleOutput)

CreateRuleRequest generates a "aws/request.Request" representing the client's request for the CreateRule operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateRule for more information on using the CreateRule API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateRuleRequest method. req, resp := client.CreateRuleRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateRule

CreateRuleWithContext

func (c *ELBV2) CreateRuleWithContext(ctx aws.Context, input *CreateRuleInput, opts ...request.Option) (*CreateRuleOutput, error)

CreateRuleWithContext is the same as CreateRule with the addition of the ability to pass a context and additional request options.

See CreateRule for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

CreateTargetGroup

func (c *ELBV2) CreateTargetGroup(input *CreateTargetGroupInput) (*CreateTargetGroupOutput, error)

CreateTargetGroup API operation for Elastic Load Balancing.

Creates a target group.

To register targets with the target group, use RegisterTargets. To update the health check settings for the target group, use ModifyTargetGroup. To monitor the health of targets in the target group, use DescribeTargetHealth.

To route traffic to the targets in a target group, specify the target group in an action using CreateListener or CreateRule.

To delete a target group, use DeleteTargetGroup.

This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple target groups with the same settings, each call succeeds.

For more information, see Target Groups for Your Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html) in the Application Load Balancers Guide or Target Groups for Your Network Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html) in the Network Load Balancers Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation CreateTargetGroup for usage and error information.

Returned Error Codes:

  • ErrCodeDuplicateTargetGroupNameException "DuplicateTargetGroupName" A target group with the specified name already exists.

  • ErrCodeTooManyTargetGroupsException "TooManyTargetGroups" You've reached the limit on the number of target groups for your AWS account.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateTargetGroup

Example

ELBV2 CreateTargetGroup shared00

To create a target group

This example creates a target group that you can use to route traffic to targets using HTTP on port 80. This target group uses the default health check configuration.

{ svc := elbv2.New(session.New()) input := &elbv2.CreateTargetGroupInput{ Name: aws.String("my-targets"), Port: aws.Int64(80), Protocol: aws.String("HTTP"), VpcId: aws.String("vpc-3ac0fb5f"), } result, err := svc.CreateTargetGroup(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeDuplicateTargetGroupNameException: fmt.Println(elbv2.ErrCodeDuplicateTargetGroupNameException, aerr.Error()) case elbv2.ErrCodeTooManyTargetGroupsException: fmt.Println(elbv2.ErrCodeTooManyTargetGroupsException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

CreateTargetGroupRequest

func (c *ELBV2) CreateTargetGroupRequest(input *CreateTargetGroupInput) (req *request.Request, output *CreateTargetGroupOutput)

CreateTargetGroupRequest generates a "aws/request.Request" representing the client's request for the CreateTargetGroup operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See CreateTargetGroup for more information on using the CreateTargetGroup API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the CreateTargetGroupRequest method. req, resp := client.CreateTargetGroupRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/CreateTargetGroup

CreateTargetGroupWithContext

func (c *ELBV2) CreateTargetGroupWithContext(ctx aws.Context, input *CreateTargetGroupInput, opts ...request.Option) (*CreateTargetGroupOutput, error)

CreateTargetGroupWithContext is the same as CreateTargetGroup with the addition of the ability to pass a context and additional request options.

See CreateTargetGroup for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeleteListener

func (c *ELBV2) DeleteListener(input *DeleteListenerInput) (*DeleteListenerOutput, error)

DeleteListener API operation for Elastic Load Balancing.

Deletes the specified listener.

Alternatively, your listener is deleted when you delete the load balancer to which it is attached, using DeleteLoadBalancer.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DeleteListener for usage and error information.

Returned Error Codes:

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteListener

Example

ELBV2 DeleteListener shared00

To delete a listener

This example deletes the specified listener.

{ svc := elbv2.New(session.New()) input := &elbv2.DeleteListenerInput{ ListenerArn: aws.String("arn:aws:elasticloadbalancing:ua-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"), } result, err := svc.DeleteListener(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeListenerNotFoundException: fmt.Println(elbv2.ErrCodeListenerNotFoundException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeleteListenerRequest

func (c *ELBV2) DeleteListenerRequest(input *DeleteListenerInput) (req *request.Request, output *DeleteListenerOutput)

DeleteListenerRequest generates a "aws/request.Request" representing the client's request for the DeleteListener operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteListener for more information on using the DeleteListener API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteListenerRequest method. req, resp := client.DeleteListenerRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteListener

DeleteListenerWithContext

func (c *ELBV2) DeleteListenerWithContext(ctx aws.Context, input *DeleteListenerInput, opts ...request.Option) (*DeleteListenerOutput, error)

DeleteListenerWithContext is the same as DeleteListener with the addition of the ability to pass a context and additional request options.

See DeleteListener for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeleteLoadBalancer

func (c *ELBV2) DeleteLoadBalancer(input *DeleteLoadBalancerInput) (*DeleteLoadBalancerOutput, error)

DeleteLoadBalancer API operation for Elastic Load Balancing.

Deletes the specified Application Load Balancer or Network Load Balancer and its attached listeners.

You can't delete a load balancer if deletion protection is enabled. If the load balancer does not exist or has already been deleted, the call succeeds.

Deleting a load balancer does not affect its registered targets. For example, your EC2 instances continue to run and are still registered to their target groups. If you no longer need these EC2 instances, you can stop or terminate them.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DeleteLoadBalancer for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeOperationNotPermittedException "OperationNotPermitted" This operation is not allowed.

  • ErrCodeResourceInUseException "ResourceInUse" A specified resource is in use.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteLoadBalancer

Example

ELBV2 DeleteLoadBalancer shared00

To delete a load balancer

This example deletes the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.DeleteLoadBalancerInput{ LoadBalancerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), } result, err := svc.DeleteLoadBalancer(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeOperationNotPermittedException: fmt.Println(elbv2.ErrCodeOperationNotPermittedException, aerr.Error()) case elbv2.ErrCodeResourceInUseException: fmt.Println(elbv2.ErrCodeResourceInUseException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeleteLoadBalancerRequest

func (c *ELBV2) DeleteLoadBalancerRequest(input *DeleteLoadBalancerInput) (req *request.Request, output *DeleteLoadBalancerOutput)

DeleteLoadBalancerRequest generates a "aws/request.Request" representing the client's request for the DeleteLoadBalancer operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteLoadBalancer for more information on using the DeleteLoadBalancer API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteLoadBalancerRequest method. req, resp := client.DeleteLoadBalancerRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteLoadBalancer

DeleteLoadBalancerWithContext

func (c *ELBV2) DeleteLoadBalancerWithContext(ctx aws.Context, input *DeleteLoadBalancerInput, opts ...request.Option) (*DeleteLoadBalancerOutput, error)

DeleteLoadBalancerWithContext is the same as DeleteLoadBalancer with the addition of the ability to pass a context and additional request options.

See DeleteLoadBalancer for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeleteRule

func (c *ELBV2) DeleteRule(input *DeleteRuleInput) (*DeleteRuleOutput, error)

DeleteRule API operation for Elastic Load Balancing.

Deletes the specified rule.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DeleteRule for usage and error information.

Returned Error Codes:

  • ErrCodeRuleNotFoundException "RuleNotFound" The specified rule does not exist.

  • ErrCodeOperationNotPermittedException "OperationNotPermitted" This operation is not allowed.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteRule

Example

ELBV2 DeleteRule shared00

To delete a rule

This example deletes the specified rule.

{ svc := elbv2.New(session.New()) input := &elbv2.DeleteRuleInput{ RuleArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3"), } result, err := svc.DeleteRule(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeRuleNotFoundException: fmt.Println(elbv2.ErrCodeRuleNotFoundException, aerr.Error()) case elbv2.ErrCodeOperationNotPermittedException: fmt.Println(elbv2.ErrCodeOperationNotPermittedException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeleteRuleRequest

func (c *ELBV2) DeleteRuleRequest(input *DeleteRuleInput) (req *request.Request, output *DeleteRuleOutput)

DeleteRuleRequest generates a "aws/request.Request" representing the client's request for the DeleteRule operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteRule for more information on using the DeleteRule API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteRuleRequest method. req, resp := client.DeleteRuleRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteRule

DeleteRuleWithContext

func (c *ELBV2) DeleteRuleWithContext(ctx aws.Context, input *DeleteRuleInput, opts ...request.Option) (*DeleteRuleOutput, error)

DeleteRuleWithContext is the same as DeleteRule with the addition of the ability to pass a context and additional request options.

See DeleteRule for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeleteTargetGroup

func (c *ELBV2) DeleteTargetGroup(input *DeleteTargetGroupInput) (*DeleteTargetGroupOutput, error)

DeleteTargetGroup API operation for Elastic Load Balancing.

Deletes the specified target group.

You can delete a target group if it is not referenced by any actions. Deleting a target group also deletes any associated health checks.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DeleteTargetGroup for usage and error information.

Returned Error Codes:

  • ErrCodeResourceInUseException "ResourceInUse" A specified resource is in use.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteTargetGroup

Example

ELBV2 DeleteTargetGroup shared00

To delete a target group

This example deletes the specified target group.

{ svc := elbv2.New(session.New()) input := &elbv2.DeleteTargetGroupInput{ TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), } result, err := svc.DeleteTargetGroup(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeResourceInUseException: fmt.Println(elbv2.ErrCodeResourceInUseException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeleteTargetGroupRequest

func (c *ELBV2) DeleteTargetGroupRequest(input *DeleteTargetGroupInput) (req *request.Request, output *DeleteTargetGroupOutput)

DeleteTargetGroupRequest generates a "aws/request.Request" representing the client's request for the DeleteTargetGroup operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteTargetGroup for more information on using the DeleteTargetGroup API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteTargetGroupRequest method. req, resp := client.DeleteTargetGroupRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeleteTargetGroup

DeleteTargetGroupWithContext

func (c *ELBV2) DeleteTargetGroupWithContext(ctx aws.Context, input *DeleteTargetGroupInput, opts ...request.Option) (*DeleteTargetGroupOutput, error)

DeleteTargetGroupWithContext is the same as DeleteTargetGroup with the addition of the ability to pass a context and additional request options.

See DeleteTargetGroup for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DeregisterTargets

func (c *ELBV2) DeregisterTargets(input *DeregisterTargetsInput) (*DeregisterTargetsOutput, error)

DeregisterTargets API operation for Elastic Load Balancing.

Deregisters the specified targets from the specified target group. After the targets are deregistered, they no longer receive traffic from the load balancer.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DeregisterTargets for usage and error information.

Returned Error Codes:

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeInvalidTargetException "InvalidTarget" The specified target does not exist, is not in the same VPC as the target group, or has an unsupported instance type.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeregisterTargets

Example

ELBV2 DeregisterTargets shared00

To deregister a target from a target group

This example deregisters the specified instance from the specified target group.

{ svc := elbv2.New(session.New()) input := &elbv2.DeregisterTargetsInput{ TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), Targets: []*elbv2.TargetDescription{ { Id: aws.String("i-0f76fade"), }, }, } result, err := svc.DeregisterTargets(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidTargetException: fmt.Println(elbv2.ErrCodeInvalidTargetException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeregisterTargetsRequest

func (c *ELBV2) DeregisterTargetsRequest(input *DeregisterTargetsInput) (req *request.Request, output *DeregisterTargetsOutput)

DeregisterTargetsRequest generates a "aws/request.Request" representing the client's request for the DeregisterTargets operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeregisterTargets for more information on using the DeregisterTargets API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeregisterTargetsRequest method. req, resp := client.DeregisterTargetsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DeregisterTargets

DeregisterTargetsWithContext

func (c *ELBV2) DeregisterTargetsWithContext(ctx aws.Context, input *DeregisterTargetsInput, opts ...request.Option) (*DeregisterTargetsOutput, error)

DeregisterTargetsWithContext is the same as DeregisterTargets with the addition of the ability to pass a context and additional request options.

See DeregisterTargets for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeAccountLimits

func (c *ELBV2) DescribeAccountLimits(input *DescribeAccountLimitsInput) (*DescribeAccountLimitsOutput, error)

DescribeAccountLimits API operation for Elastic Load Balancing.

Describes the current Elastic Load Balancing resource limits for your AWS account.

For more information, see Limits for Your Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html) in the Application Load Balancer Guide or Limits for Your Network Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-limits.html) in the Network Load Balancers Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeAccountLimits for usage and error information. See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeAccountLimits

DescribeAccountLimitsRequest

func (c *ELBV2) DescribeAccountLimitsRequest(input *DescribeAccountLimitsInput) (req *request.Request, output *DescribeAccountLimitsOutput)

DescribeAccountLimitsRequest generates a "aws/request.Request" representing the client's request for the DescribeAccountLimits operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeAccountLimits for more information on using the DescribeAccountLimits API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeAccountLimitsRequest method. req, resp := client.DescribeAccountLimitsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeAccountLimits

DescribeAccountLimitsWithContext

func (c *ELBV2) DescribeAccountLimitsWithContext(ctx aws.Context, input *DescribeAccountLimitsInput, opts ...request.Option) (*DescribeAccountLimitsOutput, error)

DescribeAccountLimitsWithContext is the same as DescribeAccountLimits with the addition of the ability to pass a context and additional request options.

See DescribeAccountLimits for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeListenerCertificates

func (c *ELBV2) DescribeListenerCertificates(input *DescribeListenerCertificatesInput) (*DescribeListenerCertificatesOutput, error)

DescribeListenerCertificates API operation for Elastic Load Balancing.

Describes the certificates for the specified HTTPS listener.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeListenerCertificates for usage and error information.

Returned Error Codes:

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeListenerCertificates

DescribeListenerCertificatesRequest

func (c *ELBV2) DescribeListenerCertificatesRequest(input *DescribeListenerCertificatesInput) (req *request.Request, output *DescribeListenerCertificatesOutput)

DescribeListenerCertificatesRequest generates a "aws/request.Request" representing the client's request for the DescribeListenerCertificates operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeListenerCertificates for more information on using the DescribeListenerCertificates API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeListenerCertificatesRequest method. req, resp := client.DescribeListenerCertificatesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeListenerCertificates

DescribeListenerCertificatesWithContext

func (c *ELBV2) DescribeListenerCertificatesWithContext(ctx aws.Context, input *DescribeListenerCertificatesInput, opts ...request.Option) (*DescribeListenerCertificatesOutput, error)

DescribeListenerCertificatesWithContext is the same as DescribeListenerCertificates with the addition of the ability to pass a context and additional request options.

See DescribeListenerCertificates for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeListeners

func (c *ELBV2) DescribeListeners(input *DescribeListenersInput) (*DescribeListenersOutput, error)

DescribeListeners API operation for Elastic Load Balancing.

Describes the specified listeners or the listeners for the specified Application Load Balancer or Network Load Balancer. You must specify either a load balancer or one or more listeners.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeListeners for usage and error information.

Returned Error Codes:

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeUnsupportedProtocolException "UnsupportedProtocol" The specified protocol is not supported.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeListeners

Example

ELBV2 DescribeListeners shared00

To describe a listener

This example describes the specified listener.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeListenersInput{ ListenerArns: []*string{ aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"), }, } result, err := svc.DescribeListeners(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeListenerNotFoundException: fmt.Println(elbv2.ErrCodeListenerNotFoundException, aerr.Error()) case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeUnsupportedProtocolException: fmt.Println(elbv2.ErrCodeUnsupportedProtocolException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeListenersPages

func (c *ELBV2) DescribeListenersPages(input *DescribeListenersInput, fn func(*DescribeListenersOutput, bool) bool) error

DescribeListenersPages iterates over the pages of a DescribeListeners operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See DescribeListeners method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a DescribeListeners operation. pageNum := 0 err := client.DescribeListenersPages(params, func(page *DescribeListenersOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

For more information about using this API, see AWS API Documentation.

DescribeListenersPagesWithContext

func (c *ELBV2) DescribeListenersPagesWithContext(ctx aws.Context, input *DescribeListenersInput, fn func(*DescribeListenersOutput, bool) bool, opts ...request.Option) error

DescribeListenersPagesWithContext same as DescribeListenersPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeListenersRequest

func (c *ELBV2) DescribeListenersRequest(input *DescribeListenersInput) (req *request.Request, output *DescribeListenersOutput)

DescribeListenersRequest generates a "aws/request.Request" representing the client's request for the DescribeListeners operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeListeners for more information on using the DescribeListeners API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeListenersRequest method. req, resp := client.DescribeListenersRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeListeners

DescribeListenersWithContext

func (c *ELBV2) DescribeListenersWithContext(ctx aws.Context, input *DescribeListenersInput, opts ...request.Option) (*DescribeListenersOutput, error)

DescribeListenersWithContext is the same as DescribeListeners with the addition of the ability to pass a context and additional request options.

See DescribeListeners for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeLoadBalancerAttributes

func (c *ELBV2) DescribeLoadBalancerAttributes(input *DescribeLoadBalancerAttributesInput) (*DescribeLoadBalancerAttributesOutput, error)

DescribeLoadBalancerAttributes API operation for Elastic Load Balancing.

Describes the attributes for the specified Application Load Balancer or Network Load Balancer.

For more information, see Load Balancer Attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#load-balancer-attributes) in the Application Load Balancers Guide or Load Balancer Attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#load-balancer-attributes) in the Network Load Balancers Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeLoadBalancerAttributes for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeLoadBalancerAttributes

Example

ELBV2 DescribeLoadBalancerAttributes shared00

To describe load balancer attributes

This example describes the attributes of the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeLoadBalancerAttributesInput{ LoadBalancerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), } result, err := svc.DescribeLoadBalancerAttributes(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeLoadBalancerAttributesRequest

func (c *ELBV2) DescribeLoadBalancerAttributesRequest(input *DescribeLoadBalancerAttributesInput) (req *request.Request, output *DescribeLoadBalancerAttributesOutput)

DescribeLoadBalancerAttributesRequest generates a "aws/request.Request" representing the client's request for the DescribeLoadBalancerAttributes operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeLoadBalancerAttributes for more information on using the DescribeLoadBalancerAttributes API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeLoadBalancerAttributesRequest method. req, resp := client.DescribeLoadBalancerAttributesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeLoadBalancerAttributes

DescribeLoadBalancerAttributesWithContext

func (c *ELBV2) DescribeLoadBalancerAttributesWithContext(ctx aws.Context, input *DescribeLoadBalancerAttributesInput, opts ...request.Option) (*DescribeLoadBalancerAttributesOutput, error)

DescribeLoadBalancerAttributesWithContext is the same as DescribeLoadBalancerAttributes with the addition of the ability to pass a context and additional request options.

See DescribeLoadBalancerAttributes for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeLoadBalancers

func (c *ELBV2) DescribeLoadBalancers(input *DescribeLoadBalancersInput) (*DescribeLoadBalancersOutput, error)

DescribeLoadBalancers API operation for Elastic Load Balancing.

Describes the specified load balancers or all of your load balancers.

To describe the listeners for a load balancer, use DescribeListeners. To describe the attributes for a load balancer, use DescribeLoadBalancerAttributes.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeLoadBalancers for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeLoadBalancers

Example

ELBV2 DescribeLoadBalancers shared00

To describe a load balancer

This example describes the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeLoadBalancersInput{ LoadBalancerArns: []*string{ aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), }, } result, err := svc.DescribeLoadBalancers(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeLoadBalancersPages

func (c *ELBV2) DescribeLoadBalancersPages(input *DescribeLoadBalancersInput, fn func(*DescribeLoadBalancersOutput, bool) bool) error

DescribeLoadBalancersPages iterates over the pages of a DescribeLoadBalancers operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See DescribeLoadBalancers method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a DescribeLoadBalancers operation. pageNum := 0 err := client.DescribeLoadBalancersPages(params, func(page *DescribeLoadBalancersOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

For more information about using this API, see AWS API Documentation.

DescribeLoadBalancersPagesWithContext

func (c *ELBV2) DescribeLoadBalancersPagesWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, fn func(*DescribeLoadBalancersOutput, bool) bool, opts ...request.Option) error

DescribeLoadBalancersPagesWithContext same as DescribeLoadBalancersPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeLoadBalancersRequest

func (c *ELBV2) DescribeLoadBalancersRequest(input *DescribeLoadBalancersInput) (req *request.Request, output *DescribeLoadBalancersOutput)

DescribeLoadBalancersRequest generates a "aws/request.Request" representing the client's request for the DescribeLoadBalancers operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeLoadBalancers for more information on using the DescribeLoadBalancers API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeLoadBalancersRequest method. req, resp := client.DescribeLoadBalancersRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeLoadBalancers

DescribeLoadBalancersWithContext

func (c *ELBV2) DescribeLoadBalancersWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.Option) (*DescribeLoadBalancersOutput, error)

DescribeLoadBalancersWithContext is the same as DescribeLoadBalancers with the addition of the ability to pass a context and additional request options.

See DescribeLoadBalancers for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeRules

func (c *ELBV2) DescribeRules(input *DescribeRulesInput) (*DescribeRulesOutput, error)

DescribeRules API operation for Elastic Load Balancing.

Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeRules for usage and error information.

Returned Error Codes:

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

  • ErrCodeRuleNotFoundException "RuleNotFound" The specified rule does not exist.

  • ErrCodeUnsupportedProtocolException "UnsupportedProtocol" The specified protocol is not supported.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeRules

Example

ELBV2 DescribeRules shared00

To describe a rule

This example describes the specified rule.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeRulesInput{ RuleArns: []*string{ aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee"), }, } result, err := svc.DescribeRules(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeListenerNotFoundException: fmt.Println(elbv2.ErrCodeListenerNotFoundException, aerr.Error()) case elbv2.ErrCodeRuleNotFoundException: fmt.Println(elbv2.ErrCodeRuleNotFoundException, aerr.Error()) case elbv2.ErrCodeUnsupportedProtocolException: fmt.Println(elbv2.ErrCodeUnsupportedProtocolException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeRulesRequest

func (c *ELBV2) DescribeRulesRequest(input *DescribeRulesInput) (req *request.Request, output *DescribeRulesOutput)

DescribeRulesRequest generates a "aws/request.Request" representing the client's request for the DescribeRules operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeRules for more information on using the DescribeRules API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeRulesRequest method. req, resp := client.DescribeRulesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeRules

DescribeRulesWithContext

func (c *ELBV2) DescribeRulesWithContext(ctx aws.Context, input *DescribeRulesInput, opts ...request.Option) (*DescribeRulesOutput, error)

DescribeRulesWithContext is the same as DescribeRules with the addition of the ability to pass a context and additional request options.

See DescribeRules for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeSSLPolicies

func (c *ELBV2) DescribeSSLPolicies(input *DescribeSSLPoliciesInput) (*DescribeSSLPoliciesOutput, error)

DescribeSSLPolicies API operation for Elastic Load Balancing.

Describes the specified policies or all policies used for SSL negotiation.

For more information, see Security Policies (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies) in the Application Load Balancers Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeSSLPolicies for usage and error information.

Returned Error Codes:

  • ErrCodeSSLPolicyNotFoundException "SSLPolicyNotFound" The specified SSL policy does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeSSLPolicies

Example

ELBV2 DescribeSSLPolicies shared00

To describe a policy used for SSL negotiation

This example describes the specified policy used for SSL negotiation.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeSSLPoliciesInput{ Names: []*string{ aws.String("ELBSecurityPolicy-2015-05"), }, } result, err := svc.DescribeSSLPolicies(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeSSLPolicyNotFoundException: fmt.Println(elbv2.ErrCodeSSLPolicyNotFoundException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeSSLPoliciesRequest

func (c *ELBV2) DescribeSSLPoliciesRequest(input *DescribeSSLPoliciesInput) (req *request.Request, output *DescribeSSLPoliciesOutput)

DescribeSSLPoliciesRequest generates a "aws/request.Request" representing the client's request for the DescribeSSLPolicies operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeSSLPolicies for more information on using the DescribeSSLPolicies API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeSSLPoliciesRequest method. req, resp := client.DescribeSSLPoliciesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeSSLPolicies

DescribeSSLPoliciesWithContext

func (c *ELBV2) DescribeSSLPoliciesWithContext(ctx aws.Context, input *DescribeSSLPoliciesInput, opts ...request.Option) (*DescribeSSLPoliciesOutput, error)

DescribeSSLPoliciesWithContext is the same as DescribeSSLPolicies with the addition of the ability to pass a context and additional request options.

See DescribeSSLPolicies for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeTags

func (c *ELBV2) DescribeTags(input *DescribeTagsInput) (*DescribeTagsOutput, error)

DescribeTags API operation for Elastic Load Balancing.

Describes the tags for the specified resources. You can describe the tags for one or more Application Load Balancers, Network Load Balancers, and target groups.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeTags for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

  • ErrCodeRuleNotFoundException "RuleNotFound" The specified rule does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTags

Example

ELBV2 DescribeTags shared00

To describe the tags assigned to a load balancer

This example describes the tags assigned to the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeTagsInput{ ResourceArns: []*string{ aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), }, } result, err := svc.DescribeTags(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeListenerNotFoundException: fmt.Println(elbv2.ErrCodeListenerNotFoundException, aerr.Error()) case elbv2.ErrCodeRuleNotFoundException: fmt.Println(elbv2.ErrCodeRuleNotFoundException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeTagsRequest

func (c *ELBV2) DescribeTagsRequest(input *DescribeTagsInput) (req *request.Request, output *DescribeTagsOutput)

DescribeTagsRequest generates a "aws/request.Request" representing the client's request for the DescribeTags operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeTags for more information on using the DescribeTags API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeTagsRequest method. req, resp := client.DescribeTagsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTags

DescribeTagsWithContext

func (c *ELBV2) DescribeTagsWithContext(ctx aws.Context, input *DescribeTagsInput, opts ...request.Option) (*DescribeTagsOutput, error)

DescribeTagsWithContext is the same as DescribeTags with the addition of the ability to pass a context and additional request options.

See DescribeTags for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeTargetGroupAttributes

func (c *ELBV2) DescribeTargetGroupAttributes(input *DescribeTargetGroupAttributesInput) (*DescribeTargetGroupAttributesOutput, error)

DescribeTargetGroupAttributes API operation for Elastic Load Balancing.

Describes the attributes for the specified target group.

For more information, see Target Group Attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-attributes) in the Application Load Balancers Guide or Target Group Attributes (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#target-group-attributes) in the Network Load Balancers Guide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeTargetGroupAttributes for usage and error information.

Returned Error Codes:

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetGroupAttributes

Example

ELBV2 DescribeTargetGroupAttributes shared00

To describe target group attributes

This example describes the attributes of the specified target group.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeTargetGroupAttributesInput{ TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), } result, err := svc.DescribeTargetGroupAttributes(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeTargetGroupAttributesRequest

func (c *ELBV2) DescribeTargetGroupAttributesRequest(input *DescribeTargetGroupAttributesInput) (req *request.Request, output *DescribeTargetGroupAttributesOutput)

DescribeTargetGroupAttributesRequest generates a "aws/request.Request" representing the client's request for the DescribeTargetGroupAttributes operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeTargetGroupAttributes for more information on using the DescribeTargetGroupAttributes API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeTargetGroupAttributesRequest method. req, resp := client.DescribeTargetGroupAttributesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetGroupAttributes

DescribeTargetGroupAttributesWithContext

func (c *ELBV2) DescribeTargetGroupAttributesWithContext(ctx aws.Context, input *DescribeTargetGroupAttributesInput, opts ...request.Option) (*DescribeTargetGroupAttributesOutput, error)

DescribeTargetGroupAttributesWithContext is the same as DescribeTargetGroupAttributes with the addition of the ability to pass a context and additional request options.

See DescribeTargetGroupAttributes for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeTargetGroups

func (c *ELBV2) DescribeTargetGroups(input *DescribeTargetGroupsInput) (*DescribeTargetGroupsOutput, error)

DescribeTargetGroups API operation for Elastic Load Balancing.

Describes the specified target groups or all of your target groups. By default, all target groups are described. Alternatively, you can specify one of the following to filter the results: the ARN of the load balancer, the names of one or more target groups, or the ARNs of one or more target groups.

To describe the targets for a target group, use DescribeTargetHealth. To describe the attributes of a target group, use DescribeTargetGroupAttributes.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeTargetGroups for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetGroups

Example

ELBV2 DescribeTargetGroups shared00

To describe a target group

This example describes the specified target group.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeTargetGroupsInput{ TargetGroupArns: []*string{ aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), }, } result, err := svc.DescribeTargetGroups(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeTargetGroupsPages

func (c *ELBV2) DescribeTargetGroupsPages(input *DescribeTargetGroupsInput, fn func(*DescribeTargetGroupsOutput, bool) bool) error

DescribeTargetGroupsPages iterates over the pages of a DescribeTargetGroups operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See DescribeTargetGroups method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a DescribeTargetGroups operation. pageNum := 0 err := client.DescribeTargetGroupsPages(params, func(page *DescribeTargetGroupsOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

For more information about using this API, see AWS API Documentation.

DescribeTargetGroupsPagesWithContext

func (c *ELBV2) DescribeTargetGroupsPagesWithContext(ctx aws.Context, input *DescribeTargetGroupsInput, fn func(*DescribeTargetGroupsOutput, bool) bool, opts ...request.Option) error

DescribeTargetGroupsPagesWithContext same as DescribeTargetGroupsPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeTargetGroupsRequest

func (c *ELBV2) DescribeTargetGroupsRequest(input *DescribeTargetGroupsInput) (req *request.Request, output *DescribeTargetGroupsOutput)

DescribeTargetGroupsRequest generates a "aws/request.Request" representing the client's request for the DescribeTargetGroups operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeTargetGroups for more information on using the DescribeTargetGroups API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeTargetGroupsRequest method. req, resp := client.DescribeTargetGroupsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetGroups

DescribeTargetGroupsWithContext

func (c *ELBV2) DescribeTargetGroupsWithContext(ctx aws.Context, input *DescribeTargetGroupsInput, opts ...request.Option) (*DescribeTargetGroupsOutput, error)

DescribeTargetGroupsWithContext is the same as DescribeTargetGroups with the addition of the ability to pass a context and additional request options.

See DescribeTargetGroups for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeTargetHealth

func (c *ELBV2) DescribeTargetHealth(input *DescribeTargetHealthInput) (*DescribeTargetHealthOutput, error)

DescribeTargetHealth API operation for Elastic Load Balancing.

Describes the health of the specified targets or all of your targets.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation DescribeTargetHealth for usage and error information.

Returned Error Codes:

  • ErrCodeInvalidTargetException "InvalidTarget" The specified target does not exist, is not in the same VPC as the target group, or has an unsupported instance type.

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeHealthUnavailableException "HealthUnavailable" The health of the specified targets could not be retrieved due to an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetHealth

Examples

ELBV2 DescribeTargetHealth shared00

To describe the health of the targets for a target group

This example describes the health of the targets for the specified target group. One target is healthy but the other is not specified in an action, so it can't receive traffic from the load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeTargetHealthInput{ TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), } result, err := svc.DescribeTargetHealth(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeInvalidTargetException: fmt.Println(elbv2.ErrCodeInvalidTargetException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeHealthUnavailableException: fmt.Println(elbv2.ErrCodeHealthUnavailableException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
ELBV2 DescribeTargetHealth shared01

To describe the health of a target

This example describes the health of the specified target. This target is healthy.

{ svc := elbv2.New(session.New()) input := &elbv2.DescribeTargetHealthInput{ TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), Targets: []*elbv2.TargetDescription{ { Id: aws.String("i-0f76fade"), Port: aws.Int64(80), }, }, } result, err := svc.DescribeTargetHealth(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeInvalidTargetException: fmt.Println(elbv2.ErrCodeInvalidTargetException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeHealthUnavailableException: fmt.Println(elbv2.ErrCodeHealthUnavailableException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeTargetHealthRequest

func (c *ELBV2) DescribeTargetHealthRequest(input *DescribeTargetHealthInput) (req *request.Request, output *DescribeTargetHealthOutput)

DescribeTargetHealthRequest generates a "aws/request.Request" representing the client's request for the DescribeTargetHealth operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeTargetHealth for more information on using the DescribeTargetHealth API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeTargetHealthRequest method. req, resp := client.DescribeTargetHealthRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/DescribeTargetHealth

DescribeTargetHealthWithContext

func (c *ELBV2) DescribeTargetHealthWithContext(ctx aws.Context, input *DescribeTargetHealthInput, opts ...request.Option) (*DescribeTargetHealthOutput, error)

DescribeTargetHealthWithContext is the same as DescribeTargetHealth with the addition of the ability to pass a context and additional request options.

See DescribeTargetHealth for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ModifyListener

func (c *ELBV2) ModifyListener(input *ModifyListenerInput) (*ModifyListenerOutput, error)

ModifyListener API operation for Elastic Load Balancing.

Modifies the specified properties of the specified listener.

Any properties that you do not specify retain their current values. However, changing the protocol from HTTPS to HTTP, or from TLS to TCP, removes the security policy and server certificate properties. If you change the protocol from HTTP to HTTPS, or from TCP to TLS, you must add the security policy and server certificate properties.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation ModifyListener for usage and error information.

Returned Error Codes:

  • ErrCodeDuplicateListenerException "DuplicateListener" A listener with the specified port already exists.

  • ErrCodeTooManyListenersException "TooManyListeners" You've reached the limit on the number of listeners per load balancer.

  • ErrCodeTooManyCertificatesException "TooManyCertificates" You've reached the limit on the number of certificates per load balancer.

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeTargetGroupAssociationLimitException "TargetGroupAssociationLimit" You've reached the limit on the number of load balancers per target group.

  • ErrCodeIncompatibleProtocolsException "IncompatibleProtocols" The specified configuration is not valid with this protocol.

  • ErrCodeSSLPolicyNotFoundException "SSLPolicyNotFound" The specified SSL policy does not exist.

  • ErrCodeCertificateNotFoundException "CertificateNotFound" The specified certificate does not exist.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

  • ErrCodeUnsupportedProtocolException "UnsupportedProtocol" The specified protocol is not supported.

  • ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" You've reached the limit on the number of times a target can be registered with a load balancer.

  • ErrCodeTooManyTargetsException "TooManyTargets" You've reached the limit on the number of targets.

  • ErrCodeTooManyActionsException "TooManyActions" You've reached the limit on the number of actions per rule.

  • ErrCodeInvalidLoadBalancerActionException "InvalidLoadBalancerAction" The requested action is not valid.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyListener

Examples

ELBV2 ModifyListener shared00

To change the default action for a listener

This example changes the default action for the specified listener.

{ svc := elbv2.New(session.New()) input := &elbv2.ModifyListenerInput{ DefaultActions: []*elbv2.Action{ { TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f"), Type: aws.String("forward"), }, }, ListenerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2"), } result, err := svc.ModifyListener(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeDuplicateListenerException: fmt.Println(elbv2.ErrCodeDuplicateListenerException, aerr.Error()) case elbv2.ErrCodeTooManyListenersException: fmt.Println(elbv2.ErrCodeTooManyListenersException, aerr.Error()) case elbv2.ErrCodeTooManyCertificatesException: fmt.Println(elbv2.ErrCodeTooManyCertificatesException, aerr.Error()) case elbv2.ErrCodeListenerNotFoundException: fmt.Println(elbv2.ErrCodeListenerNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupAssociationLimitException: fmt.Println(elbv2.ErrCodeTargetGroupAssociationLimitException, aerr.Error()) case elbv2.ErrCodeIncompatibleProtocolsException: fmt.Println(elbv2.ErrCodeIncompatibleProtocolsException, aerr.Error()) case elbv2.ErrCodeSSLPolicyNotFoundException: fmt.Println(elbv2.ErrCodeSSLPolicyNotFoundException, aerr.Error()) case elbv2.ErrCodeCertificateNotFoundException: fmt.Println(elbv2.ErrCodeCertificateNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) case elbv2.ErrCodeUnsupportedProtocolException: fmt.Println(elbv2.ErrCodeUnsupportedProtocolException, aerr.Error()) case elbv2.ErrCodeTooManyRegistrationsForTargetIdException: fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error()) case elbv2.ErrCodeTooManyTargetsException: fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error()) case elbv2.ErrCodeTooManyActionsException: fmt.Println(elbv2.ErrCodeTooManyActionsException, aerr.Error()) case elbv2.ErrCodeInvalidLoadBalancerActionException: fmt.Println(elbv2.ErrCodeInvalidLoadBalancerActionException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
ELBV2 ModifyListener shared01

To change the server certificate

This example changes the server certificate for the specified HTTPS listener.

{ svc := elbv2.New(session.New()) input := &elbv2.ModifyListenerInput{ Certificates: []*elbv2.Certificate{ { CertificateArn: aws.String("arn:aws:iam::123456789012:server-certificate/my-new-server-cert"), }, }, ListenerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65"), } result, err := svc.ModifyListener(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeDuplicateListenerException: fmt.Println(elbv2.ErrCodeDuplicateListenerException, aerr.Error()) case elbv2.ErrCodeTooManyListenersException: fmt.Println(elbv2.ErrCodeTooManyListenersException, aerr.Error()) case elbv2.ErrCodeTooManyCertificatesException: fmt.Println(elbv2.ErrCodeTooManyCertificatesException, aerr.Error()) case elbv2.ErrCodeListenerNotFoundException: fmt.Println(elbv2.ErrCodeListenerNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupAssociationLimitException: fmt.Println(elbv2.ErrCodeTargetGroupAssociationLimitException, aerr.Error()) case elbv2.ErrCodeIncompatibleProtocolsException: fmt.Println(elbv2.ErrCodeIncompatibleProtocolsException, aerr.Error()) case elbv2.ErrCodeSSLPolicyNotFoundException: fmt.Println(elbv2.ErrCodeSSLPolicyNotFoundException, aerr.Error()) case elbv2.ErrCodeCertificateNotFoundException: fmt.Println(elbv2.ErrCodeCertificateNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) case elbv2.ErrCodeUnsupportedProtocolException: fmt.Println(elbv2.ErrCodeUnsupportedProtocolException, aerr.Error()) case elbv2.ErrCodeTooManyRegistrationsForTargetIdException: fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error()) case elbv2.ErrCodeTooManyTargetsException: fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error()) case elbv2.ErrCodeTooManyActionsException: fmt.Println(elbv2.ErrCodeTooManyActionsException, aerr.Error()) case elbv2.ErrCodeInvalidLoadBalancerActionException: fmt.Println(elbv2.ErrCodeInvalidLoadBalancerActionException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ModifyListenerRequest

func (c *ELBV2) ModifyListenerRequest(input *ModifyListenerInput) (req *request.Request, output *ModifyListenerOutput)

ModifyListenerRequest generates a "aws/request.Request" representing the client's request for the ModifyListener operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ModifyListener for more information on using the ModifyListener API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ModifyListenerRequest method. req, resp := client.ModifyListenerRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyListener

ModifyListenerWithContext

func (c *ELBV2) ModifyListenerWithContext(ctx aws.Context, input *ModifyListenerInput, opts ...request.Option) (*ModifyListenerOutput, error)

ModifyListenerWithContext is the same as ModifyListener with the addition of the ability to pass a context and additional request options.

See ModifyListener for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ModifyLoadBalancerAttributes

func (c *ELBV2) ModifyLoadBalancerAttributes(input *ModifyLoadBalancerAttributesInput) (*ModifyLoadBalancerAttributesOutput, error)

ModifyLoadBalancerAttributes API operation for Elastic Load Balancing.

Modifies the specified attributes of the specified Application Load Balancer or Network Load Balancer.

If any of the specified attributes can't be modified as requested, the call fails. Any existing attributes that you do not modify retain their current values.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation ModifyLoadBalancerAttributes for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyLoadBalancerAttributes

Examples

ELBV2 ModifyLoadBalancerAttributes shared00

To enable deletion protection

This example enables deletion protection for the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.ModifyLoadBalancerAttributesInput{ Attributes: []*elbv2.LoadBalancerAttribute{ { Key: aws.String("deletion_protection.enabled"), Value: aws.String("true"), }, }, LoadBalancerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), } result, err := svc.ModifyLoadBalancerAttributes(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
ELBV2 ModifyLoadBalancerAttributes shared01

To change the idle timeout

This example changes the idle timeout value for the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.ModifyLoadBalancerAttributesInput{ Attributes: []*elbv2.LoadBalancerAttribute{ { Key: aws.String("idle_timeout.timeout_seconds"), Value: aws.String("30"), }, }, LoadBalancerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), } result, err := svc.ModifyLoadBalancerAttributes(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
ELBV2 ModifyLoadBalancerAttributes shared02

To enable access logs

This example enables access logs for the specified load balancer. Note that the S3 bucket must exist in the same region as the load balancer and must have a policy attached that grants access to the Elastic Load Balancing service.

{ svc := elbv2.New(session.New()) input := &elbv2.ModifyLoadBalancerAttributesInput{ Attributes: []*elbv2.LoadBalancerAttribute{ { Key: aws.String("access_logs.s3.enabled"), Value: aws.String("true"), }, { Key: aws.String("access_logs.s3.bucket"), Value: aws.String("my-loadbalancer-logs"), }, { Key: aws.String("access_logs.s3.prefix"), Value: aws.String("myapp"), }, }, LoadBalancerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), } result, err := svc.ModifyLoadBalancerAttributes(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ModifyLoadBalancerAttributesRequest

func (c *ELBV2) ModifyLoadBalancerAttributesRequest(input *ModifyLoadBalancerAttributesInput) (req *request.Request, output *ModifyLoadBalancerAttributesOutput)

ModifyLoadBalancerAttributesRequest generates a "aws/request.Request" representing the client's request for the ModifyLoadBalancerAttributes operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ModifyLoadBalancerAttributes for more information on using the ModifyLoadBalancerAttributes API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ModifyLoadBalancerAttributesRequest method. req, resp := client.ModifyLoadBalancerAttributesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyLoadBalancerAttributes

ModifyLoadBalancerAttributesWithContext

func (c *ELBV2) ModifyLoadBalancerAttributesWithContext(ctx aws.Context, input *ModifyLoadBalancerAttributesInput, opts ...request.Option) (*ModifyLoadBalancerAttributesOutput, error)

ModifyLoadBalancerAttributesWithContext is the same as ModifyLoadBalancerAttributes with the addition of the ability to pass a context and additional request options.

See ModifyLoadBalancerAttributes for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ModifyRule

func (c *ELBV2) ModifyRule(input *ModifyRuleInput) (*ModifyRuleOutput, error)

ModifyRule API operation for Elastic Load Balancing.

Modifies the specified rule.

Any existing properties that you do not modify retain their current values.

To modify the actions for the default rule, use ModifyListener.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation ModifyRule for usage and error information.

Returned Error Codes:

  • ErrCodeTargetGroupAssociationLimitException "TargetGroupAssociationLimit" You've reached the limit on the number of load balancers per target group.

  • ErrCodeIncompatibleProtocolsException "IncompatibleProtocols" The specified configuration is not valid with this protocol.

  • ErrCodeRuleNotFoundException "RuleNotFound" The specified rule does not exist.

  • ErrCodeOperationNotPermittedException "OperationNotPermitted" This operation is not allowed.

  • ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" You've reached the limit on the number of times a target can be registered with a load balancer.

  • ErrCodeTooManyTargetsException "TooManyTargets" You've reached the limit on the number of targets.

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeUnsupportedProtocolException "UnsupportedProtocol" The specified protocol is not supported.

  • ErrCodeTooManyActionsException "TooManyActions" You've reached the limit on the number of actions per rule.

  • ErrCodeInvalidLoadBalancerActionException "InvalidLoadBalancerAction" The requested action is not valid.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyRule

Example

ELBV2 ModifyRule shared00

To modify a rule

This example modifies the condition for the specified rule.

{ svc := elbv2.New(session.New()) input := &elbv2.ModifyRuleInput{ Conditions: []*elbv2.RuleCondition{ { Field: aws.String("path-pattern"), Values: []*string{ aws.String("/images/*"), }, }, }, RuleArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/9683b2d02a6cabee"), } result, err := svc.ModifyRule(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeTargetGroupAssociationLimitException: fmt.Println(elbv2.ErrCodeTargetGroupAssociationLimitException, aerr.Error()) case elbv2.ErrCodeIncompatibleProtocolsException: fmt.Println(elbv2.ErrCodeIncompatibleProtocolsException, aerr.Error()) case elbv2.ErrCodeRuleNotFoundException: fmt.Println(elbv2.ErrCodeRuleNotFoundException, aerr.Error()) case elbv2.ErrCodeOperationNotPermittedException: fmt.Println(elbv2.ErrCodeOperationNotPermittedException, aerr.Error()) case elbv2.ErrCodeTooManyRegistrationsForTargetIdException: fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error()) case elbv2.ErrCodeTooManyTargetsException: fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeUnsupportedProtocolException: fmt.Println(elbv2.ErrCodeUnsupportedProtocolException, aerr.Error()) case elbv2.ErrCodeTooManyActionsException: fmt.Println(elbv2.ErrCodeTooManyActionsException, aerr.Error()) case elbv2.ErrCodeInvalidLoadBalancerActionException: fmt.Println(elbv2.ErrCodeInvalidLoadBalancerActionException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ModifyRuleRequest

func (c *ELBV2) ModifyRuleRequest(input *ModifyRuleInput) (req *request.Request, output *ModifyRuleOutput)

ModifyRuleRequest generates a "aws/request.Request" representing the client's request for the ModifyRule operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ModifyRule for more information on using the ModifyRule API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ModifyRuleRequest method. req, resp := client.ModifyRuleRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyRule

ModifyRuleWithContext

func (c *ELBV2) ModifyRuleWithContext(ctx aws.Context, input *ModifyRuleInput, opts ...request.Option) (*ModifyRuleOutput, error)

ModifyRuleWithContext is the same as ModifyRule with the addition of the ability to pass a context and additional request options.

See ModifyRule for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ModifyTargetGroup

func (c *ELBV2) ModifyTargetGroup(input *ModifyTargetGroupInput) (*ModifyTargetGroupOutput, error)

ModifyTargetGroup API operation for Elastic Load Balancing.

Modifies the health checks used when evaluating the health state of the targets in the specified target group.

To monitor the health of the targets, use DescribeTargetHealth.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation ModifyTargetGroup for usage and error information.

Returned Error Codes:

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyTargetGroup

Example

ELBV2 ModifyTargetGroup shared00

To modify the health check configuration for a target group

This example changes the configuration of the health checks used to evaluate the health of the targets for the specified target group.

{ svc := elbv2.New(session.New()) input := &elbv2.ModifyTargetGroupInput{ HealthCheckPort: aws.String("443"), HealthCheckProtocol: aws.String("HTTPS"), TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f"), } result, err := svc.ModifyTargetGroup(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ModifyTargetGroupAttributes

func (c *ELBV2) ModifyTargetGroupAttributes(input *ModifyTargetGroupAttributesInput) (*ModifyTargetGroupAttributesOutput, error)

ModifyTargetGroupAttributes API operation for Elastic Load Balancing.

Modifies the specified attributes of the specified target group.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation ModifyTargetGroupAttributes for usage and error information.

Returned Error Codes:

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyTargetGroupAttributes

Example

ELBV2 ModifyTargetGroupAttributes shared00

To modify the deregistration delay timeout

This example sets the deregistration delay timeout to the specified value for the specified target group.

{ svc := elbv2.New(session.New()) input := &elbv2.ModifyTargetGroupAttributesInput{ Attributes: []*elbv2.TargetGroupAttribute{ { Key: aws.String("deregistration_delay.timeout_seconds"), Value: aws.String("600"), }, }, TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), } result, err := svc.ModifyTargetGroupAttributes(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

ModifyTargetGroupAttributesRequest

func (c *ELBV2) ModifyTargetGroupAttributesRequest(input *ModifyTargetGroupAttributesInput) (req *request.Request, output *ModifyTargetGroupAttributesOutput)

ModifyTargetGroupAttributesRequest generates a "aws/request.Request" representing the client's request for the ModifyTargetGroupAttributes operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ModifyTargetGroupAttributes for more information on using the ModifyTargetGroupAttributes API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ModifyTargetGroupAttributesRequest method. req, resp := client.ModifyTargetGroupAttributesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyTargetGroupAttributes

ModifyTargetGroupAttributesWithContext

func (c *ELBV2) ModifyTargetGroupAttributesWithContext(ctx aws.Context, input *ModifyTargetGroupAttributesInput, opts ...request.Option) (*ModifyTargetGroupAttributesOutput, error)

ModifyTargetGroupAttributesWithContext is the same as ModifyTargetGroupAttributes with the addition of the ability to pass a context and additional request options.

See ModifyTargetGroupAttributes for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

ModifyTargetGroupRequest

func (c *ELBV2) ModifyTargetGroupRequest(input *ModifyTargetGroupInput) (req *request.Request, output *ModifyTargetGroupOutput)

ModifyTargetGroupRequest generates a "aws/request.Request" representing the client's request for the ModifyTargetGroup operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See ModifyTargetGroup for more information on using the ModifyTargetGroup API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the ModifyTargetGroupRequest method. req, resp := client.ModifyTargetGroupRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/ModifyTargetGroup

ModifyTargetGroupWithContext

func (c *ELBV2) ModifyTargetGroupWithContext(ctx aws.Context, input *ModifyTargetGroupInput, opts ...request.Option) (*ModifyTargetGroupOutput, error)

ModifyTargetGroupWithContext is the same as ModifyTargetGroup with the addition of the ability to pass a context and additional request options.

See ModifyTargetGroup for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

RegisterTargets

func (c *ELBV2) RegisterTargets(input *RegisterTargetsInput) (*RegisterTargetsOutput, error)

RegisterTargets API operation for Elastic Load Balancing.

Registers the specified targets with the specified target group.

If the target is an EC2 instance, it must be in the running state when you register it.

By default, the load balancer routes requests to registered targets using the protocol and port for the target group. Alternatively, you can override the port for a target when you register it. You can register each EC2 instance or IP address with the same target group multiple times using different ports.

With a Network Load Balancer, you cannot register instances by instance ID if they have the following instance types: C1, CC1, CC2, CG1, CG2, CR1, CS1, G1, G2, HI1, HS1, M1, M2, M3, and T1. You can register instances of these types by IP address.

To remove a target from a target group, use DeregisterTargets.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation RegisterTargets for usage and error information.

Returned Error Codes:

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeTooManyTargetsException "TooManyTargets" You've reached the limit on the number of targets.

  • ErrCodeInvalidTargetException "InvalidTarget" The specified target does not exist, is not in the same VPC as the target group, or has an unsupported instance type.

  • ErrCodeTooManyRegistrationsForTargetIdException "TooManyRegistrationsForTargetId" You've reached the limit on the number of times a target can be registered with a load balancer.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RegisterTargets

Examples

ELBV2 RegisterTargets shared00

To register targets with a target group

This example registers the specified instances with the specified target group.

{ svc := elbv2.New(session.New()) input := &elbv2.RegisterTargetsInput{ TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"), Targets: []*elbv2.TargetDescription{ { Id: aws.String("i-80c8dd94"), }, { Id: aws.String("i-ceddcd4d"), }, }, } result, err := svc.RegisterTargets(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeTooManyTargetsException: fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error()) case elbv2.ErrCodeInvalidTargetException: fmt.Println(elbv2.ErrCodeInvalidTargetException, aerr.Error()) case elbv2.ErrCodeTooManyRegistrationsForTargetIdException: fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
ELBV2 RegisterTargets shared01

To register targets with a target group using port overrides

This example registers the specified instance with the specified target group using multiple ports. This enables you to register ECS containers on the same instance as targets in the target group.

{ svc := elbv2.New(session.New()) input := &elbv2.RegisterTargetsInput{ TargetGroupArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/3bb63f11dfb0faf9"), Targets: []*elbv2.TargetDescription{ { Id: aws.String("i-80c8dd94"), Port: aws.Int64(80), }, { Id: aws.String("i-80c8dd94"), Port: aws.Int64(766), }, }, } result, err := svc.RegisterTargets(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeTooManyTargetsException: fmt.Println(elbv2.ErrCodeTooManyTargetsException, aerr.Error()) case elbv2.ErrCodeInvalidTargetException: fmt.Println(elbv2.ErrCodeInvalidTargetException, aerr.Error()) case elbv2.ErrCodeTooManyRegistrationsForTargetIdException: fmt.Println(elbv2.ErrCodeTooManyRegistrationsForTargetIdException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

RegisterTargetsRequest

func (c *ELBV2) RegisterTargetsRequest(input *RegisterTargetsInput) (req *request.Request, output *RegisterTargetsOutput)

RegisterTargetsRequest generates a "aws/request.Request" representing the client's request for the RegisterTargets operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See RegisterTargets for more information on using the RegisterTargets API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the RegisterTargetsRequest method. req, resp := client.RegisterTargetsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RegisterTargets

RegisterTargetsWithContext

func (c *ELBV2) RegisterTargetsWithContext(ctx aws.Context, input *RegisterTargetsInput, opts ...request.Option) (*RegisterTargetsOutput, error)

RegisterTargetsWithContext is the same as RegisterTargets with the addition of the ability to pass a context and additional request options.

See RegisterTargets for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

RemoveListenerCertificates

func (c *ELBV2) RemoveListenerCertificates(input *RemoveListenerCertificatesInput) (*RemoveListenerCertificatesOutput, error)

RemoveListenerCertificates API operation for Elastic Load Balancing.

Removes the specified certificate from the specified HTTPS listener.

You can't remove the default certificate for a listener. To replace the default certificate, call ModifyListener.

To list the certificates for your listener, use DescribeListenerCertificates.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation RemoveListenerCertificates for usage and error information.

Returned Error Codes:

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

  • ErrCodeOperationNotPermittedException "OperationNotPermitted" This operation is not allowed.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RemoveListenerCertificates

RemoveListenerCertificatesRequest

func (c *ELBV2) RemoveListenerCertificatesRequest(input *RemoveListenerCertificatesInput) (req *request.Request, output *RemoveListenerCertificatesOutput)

RemoveListenerCertificatesRequest generates a "aws/request.Request" representing the client's request for the RemoveListenerCertificates operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See RemoveListenerCertificates for more information on using the RemoveListenerCertificates API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the RemoveListenerCertificatesRequest method. req, resp := client.RemoveListenerCertificatesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RemoveListenerCertificates

RemoveListenerCertificatesWithContext

func (c *ELBV2) RemoveListenerCertificatesWithContext(ctx aws.Context, input *RemoveListenerCertificatesInput, opts ...request.Option) (*RemoveListenerCertificatesOutput, error)

RemoveListenerCertificatesWithContext is the same as RemoveListenerCertificates with the addition of the ability to pass a context and additional request options.

See RemoveListenerCertificates for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

RemoveTags

func (c *ELBV2) RemoveTags(input *RemoveTagsInput) (*RemoveTagsOutput, error)

RemoveTags API operation for Elastic Load Balancing.

Removes the specified tags from the specified Elastic Load Balancing resource.

To list the current tags for your resources, use DescribeTags.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation RemoveTags for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeTargetGroupNotFoundException "TargetGroupNotFound" The specified target group does not exist.

  • ErrCodeListenerNotFoundException "ListenerNotFound" The specified listener does not exist.

  • ErrCodeRuleNotFoundException "RuleNotFound" The specified rule does not exist.

  • ErrCodeTooManyTagsException "TooManyTags" You've reached the limit on the number of tags per load balancer.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RemoveTags

Example

ELBV2 RemoveTags shared00

To remove tags from a load balancer

This example removes the specified tags from the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.RemoveTagsInput{ ResourceArns: []*string{ aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), }, TagKeys: []*string{ aws.String("project"), aws.String("department"), }, } result, err := svc.RemoveTags(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeTargetGroupNotFoundException: fmt.Println(elbv2.ErrCodeTargetGroupNotFoundException, aerr.Error()) case elbv2.ErrCodeListenerNotFoundException: fmt.Println(elbv2.ErrCodeListenerNotFoundException, aerr.Error()) case elbv2.ErrCodeRuleNotFoundException: fmt.Println(elbv2.ErrCodeRuleNotFoundException, aerr.Error()) case elbv2.ErrCodeTooManyTagsException: fmt.Println(elbv2.ErrCodeTooManyTagsException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

RemoveTagsRequest

func (c *ELBV2) RemoveTagsRequest(input *RemoveTagsInput) (req *request.Request, output *RemoveTagsOutput)

RemoveTagsRequest generates a "aws/request.Request" representing the client's request for the RemoveTags operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See RemoveTags for more information on using the RemoveTags API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the RemoveTagsRequest method. req, resp := client.RemoveTagsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/RemoveTags

RemoveTagsWithContext

func (c *ELBV2) RemoveTagsWithContext(ctx aws.Context, input *RemoveTagsInput, opts ...request.Option) (*RemoveTagsOutput, error)

RemoveTagsWithContext is the same as RemoveTags with the addition of the ability to pass a context and additional request options.

See RemoveTags for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

SetIpAddressType

func (c *ELBV2) SetIpAddressType(input *SetIpAddressTypeInput) (*SetIpAddressTypeOutput, error)

SetIpAddressType API operation for Elastic Load Balancing.

Sets the type of IP addresses used by the subnets of the specified Application Load Balancer or Network Load Balancer.

Network Load Balancers must use ipv4.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation SetIpAddressType for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

  • ErrCodeInvalidSubnetException "InvalidSubnet" The specified subnet is out of available addresses.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetIpAddressType

SetIpAddressTypeRequest

func (c *ELBV2) SetIpAddressTypeRequest(input *SetIpAddressTypeInput) (req *request.Request, output *SetIpAddressTypeOutput)

SetIpAddressTypeRequest generates a "aws/request.Request" representing the client's request for the SetIpAddressType operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See SetIpAddressType for more information on using the SetIpAddressType API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the SetIpAddressTypeRequest method. req, resp := client.SetIpAddressTypeRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetIpAddressType

SetIpAddressTypeWithContext

func (c *ELBV2) SetIpAddressTypeWithContext(ctx aws.Context, input *SetIpAddressTypeInput, opts ...request.Option) (*SetIpAddressTypeOutput, error)

SetIpAddressTypeWithContext is the same as SetIpAddressType with the addition of the ability to pass a context and additional request options.

See SetIpAddressType for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

SetRulePriorities

func (c *ELBV2) SetRulePriorities(input *SetRulePrioritiesInput) (*SetRulePrioritiesOutput, error)

SetRulePriorities API operation for Elastic Load Balancing.

Sets the priorities of the specified rules.

You can reorder the rules as long as there are no priority conflicts in the new order. Any existing rules that you do not specify retain their current priority.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation SetRulePriorities for usage and error information.

Returned Error Codes:

  • ErrCodeRuleNotFoundException "RuleNotFound" The specified rule does not exist.

  • ErrCodePriorityInUseException "PriorityInUse" The specified priority is in use.

  • ErrCodeOperationNotPermittedException "OperationNotPermitted" This operation is not allowed.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetRulePriorities

Example

ELBV2 SetRulePriorities shared00

To set the rule priority

This example sets the priority of the specified rule.

{ svc := elbv2.New(session.New()) input := &elbv2.SetRulePrioritiesInput{ RulePriorities: []*elbv2.RulePriorityPair{ { Priority: aws.Int64(5), RuleArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener-rule/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2/1291d13826f405c3"), }, }, } result, err := svc.SetRulePriorities(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeRuleNotFoundException: fmt.Println(elbv2.ErrCodeRuleNotFoundException, aerr.Error()) case elbv2.ErrCodePriorityInUseException: fmt.Println(elbv2.ErrCodePriorityInUseException, aerr.Error()) case elbv2.ErrCodeOperationNotPermittedException: fmt.Println(elbv2.ErrCodeOperationNotPermittedException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

SetRulePrioritiesRequest

func (c *ELBV2) SetRulePrioritiesRequest(input *SetRulePrioritiesInput) (req *request.Request, output *SetRulePrioritiesOutput)

SetRulePrioritiesRequest generates a "aws/request.Request" representing the client's request for the SetRulePriorities operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See SetRulePriorities for more information on using the SetRulePriorities API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the SetRulePrioritiesRequest method. req, resp := client.SetRulePrioritiesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetRulePriorities

SetRulePrioritiesWithContext

func (c *ELBV2) SetRulePrioritiesWithContext(ctx aws.Context, input *SetRulePrioritiesInput, opts ...request.Option) (*SetRulePrioritiesOutput, error)

SetRulePrioritiesWithContext is the same as SetRulePriorities with the addition of the ability to pass a context and additional request options.

See SetRulePriorities for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

SetSecurityGroups

func (c *ELBV2) SetSecurityGroups(input *SetSecurityGroupsInput) (*SetSecurityGroupsOutput, error)

SetSecurityGroups API operation for Elastic Load Balancing.

Associates the specified security groups with the specified Application Load Balancer. The specified security groups override the previously associated security groups.

You can't specify a security group for a Network Load Balancer.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation SetSecurityGroups for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

  • ErrCodeInvalidSecurityGroupException "InvalidSecurityGroup" The specified security group does not exist.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetSecurityGroups

Example

ELBV2 SetSecurityGroups shared00

To associate a security group with a load balancer

This example associates the specified security group with the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.SetSecurityGroupsInput{ LoadBalancerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), SecurityGroups: []*string{ aws.String("sg-5943793c"), }, } result, err := svc.SetSecurityGroups(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) case elbv2.ErrCodeInvalidSecurityGroupException: fmt.Println(elbv2.ErrCodeInvalidSecurityGroupException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

SetSecurityGroupsRequest

func (c *ELBV2) SetSecurityGroupsRequest(input *SetSecurityGroupsInput) (req *request.Request, output *SetSecurityGroupsOutput)

SetSecurityGroupsRequest generates a "aws/request.Request" representing the client's request for the SetSecurityGroups operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See SetSecurityGroups for more information on using the SetSecurityGroups API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the SetSecurityGroupsRequest method. req, resp := client.SetSecurityGroupsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetSecurityGroups

SetSecurityGroupsWithContext

func (c *ELBV2) SetSecurityGroupsWithContext(ctx aws.Context, input *SetSecurityGroupsInput, opts ...request.Option) (*SetSecurityGroupsOutput, error)

SetSecurityGroupsWithContext is the same as SetSecurityGroups with the addition of the ability to pass a context and additional request options.

See SetSecurityGroups for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

SetSubnets

func (c *ELBV2) SetSubnets(input *SetSubnetsInput) (*SetSubnetsOutput, error)

SetSubnets API operation for Elastic Load Balancing.

Enables the Availability Zone for the specified public subnets for the specified Application Load Balancer. The specified subnets replace the previously enabled subnets.

You can't change the subnets for a Network Load Balancer.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for Elastic Load Balancing's API operation SetSubnets for usage and error information.

Returned Error Codes:

  • ErrCodeLoadBalancerNotFoundException "LoadBalancerNotFound" The specified load balancer does not exist.

  • ErrCodeInvalidConfigurationRequestException "InvalidConfigurationRequest" The requested configuration is not valid.

  • ErrCodeSubnetNotFoundException "SubnetNotFound" The specified subnet does not exist.

  • ErrCodeInvalidSubnetException "InvalidSubnet" The specified subnet is out of available addresses.

  • ErrCodeAllocationIdNotFoundException "AllocationIdNotFound" The specified allocation ID does not exist.

  • ErrCodeAvailabilityZoneNotSupportedException "AvailabilityZoneNotSupported" The specified Availability Zone is not supported.

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetSubnets

Example

ELBV2 SetSubnets shared00

To enable Availability Zones for a load balancer

This example enables the Availability Zones for the specified subnets for the specified load balancer.

{ svc := elbv2.New(session.New()) input := &elbv2.SetSubnetsInput{ LoadBalancerArn: aws.String("arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188"), Subnets: []*string{ aws.String("subnet-8360a9e7"), aws.String("subnet-b7d581c0"), }, } result, err := svc.SetSubnets(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case elbv2.ErrCodeLoadBalancerNotFoundException: fmt.Println(elbv2.ErrCodeLoadBalancerNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidConfigurationRequestException: fmt.Println(elbv2.ErrCodeInvalidConfigurationRequestException, aerr.Error()) case elbv2.ErrCodeSubnetNotFoundException: fmt.Println(elbv2.ErrCodeSubnetNotFoundException, aerr.Error()) case elbv2.ErrCodeInvalidSubnetException: fmt.Println(elbv2.ErrCodeInvalidSubnetException, aerr.Error()) case elbv2.ErrCodeAllocationIdNotFoundException: fmt.Println(elbv2.ErrCodeAllocationIdNotFoundException, aerr.Error()) case elbv2.ErrCodeAvailabilityZoneNotSupportedException: fmt.Println(elbv2.ErrCodeAvailabilityZoneNotSupportedException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

SetSubnetsRequest

func (c *ELBV2) SetSubnetsRequest(input *SetSubnetsInput) (req *request.Request, output *SetSubnetsOutput)

SetSubnetsRequest generates a "aws/request.Request" representing the client's request for the SetSubnets operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See SetSubnets for more information on using the SetSubnets API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the SetSubnetsRequest method. req, resp := client.SetSubnetsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/elasticloadbalancingv2-2015-12-01/SetSubnets

SetSubnetsWithContext

func (c *ELBV2) SetSubnetsWithContext(ctx aws.Context, input *SetSubnetsInput, opts ...request.Option) (*SetSubnetsOutput, error)

SetSubnetsWithContext is the same as SetSubnets with the addition of the ability to pass a context and additional request options.

See SetSubnets for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

WaitUntilLoadBalancerAvailable

func (c *ELBV2) WaitUntilLoadBalancerAvailable(input *DescribeLoadBalancersInput) error

WaitUntilLoadBalancerAvailable uses the Elastic Load Balancing v2 API operation DescribeLoadBalancers to wait for a condition to be met before returning. If the condition is not met within the max attempt window, an error will be returned.

WaitUntilLoadBalancerAvailableWithContext

func (c *ELBV2) WaitUntilLoadBalancerAvailableWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.WaiterOption) error

WaitUntilLoadBalancerAvailableWithContext is an extended version of WaitUntilLoadBalancerAvailable. With the support for passing in a context and options to configure the Waiter and the underlying request options.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

WaitUntilLoadBalancerExists

func (c *ELBV2) WaitUntilLoadBalancerExists(input *DescribeLoadBalancersInput) error

WaitUntilLoadBalancerExists uses the Elastic Load Balancing v2 API operation DescribeLoadBalancers to wait for a condition to be met before returning. If the condition is not met within the max attempt window, an error will be returned.

WaitUntilLoadBalancerExistsWithContext

func (c *ELBV2) WaitUntilLoadBalancerExistsWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.WaiterOption) error

WaitUntilLoadBalancerExistsWithContext is an extended version of WaitUntilLoadBalancerExists. With the support for passing in a context and options to configure the Waiter and the underlying request options.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

WaitUntilLoadBalancersDeleted

func (c *ELBV2) WaitUntilLoadBalancersDeleted(input *DescribeLoadBalancersInput) error

WaitUntilLoadBalancersDeleted uses the Elastic Load Balancing v2 API operation DescribeLoadBalancers to wait for a condition to be met before returning. If the condition is not met within the max attempt window, an error will be returned.

WaitUntilLoadBalancersDeletedWithContext

func (c *ELBV2) WaitUntilLoadBalancersDeletedWithContext(ctx aws.Context, input *DescribeLoadBalancersInput, opts ...request.WaiterOption) error

WaitUntilLoadBalancersDeletedWithContext is an extended version of WaitUntilLoadBalancersDeleted. With the support for passing in a context and options to configure the Waiter and the underlying request options.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

WaitUntilTargetDeregistered

func (c *ELBV2) WaitUntilTargetDeregistered(input *DescribeTargetHealthInput) error

WaitUntilTargetDeregistered uses the Elastic Load Balancing v2 API operation DescribeTargetHealth to wait for a condition to be met before returning. If the condition is not met within the max attempt window, an error will be returned.

WaitUntilTargetDeregisteredWithContext

func (c *ELBV2) WaitUntilTargetDeregisteredWithContext(ctx aws.Context, input *DescribeTargetHealthInput, opts ...request.WaiterOption) error

WaitUntilTargetDeregisteredWithContext is an extended version of WaitUntilTargetDeregistered. With the support for passing in a context and options to configure the Waiter and the underlying request options.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

WaitUntilTargetInService

func (c *ELBV2) WaitUntilTargetInService(input *DescribeTargetHealthInput) error

WaitUntilTargetInService uses the Elastic Load Balancing v2 API operation DescribeTargetHealth to wait for a condition to be met before returning. If the condition is not met within the max attempt window, an error will be returned.

WaitUntilTargetInServiceWithContext

func (c *ELBV2) WaitUntilTargetInServiceWithContext(ctx aws.Context, input *DescribeTargetHealthInput, opts ...request.WaiterOption) error

WaitUntilTargetInServiceWithContext is an extended version of WaitUntilTargetInService. With the support for passing in a context and options to configure the Waiter and the underlying request options.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

On this page: