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.

ApplicationAutoScaling

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

type ApplicationAutoScaling struct { *client.Client }

ApplicationAutoScaling provides the API operation methods for making requests to Application Auto Scaling. See this package's package overview docs for details on the service.

ApplicationAutoScaling 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

DeleteScalingPolicy

func (c *ApplicationAutoScaling) DeleteScalingPolicy(input *DeleteScalingPolicyInput) (*DeleteScalingPolicyOutput, error)

DeleteScalingPolicy API operation for Application Auto Scaling.

Deletes the specified Application Auto Scaling scaling policy.

Deleting a policy deletes the underlying alarm action, but does not delete the CloudWatch alarm associated with the scaling policy, even if it no longer has an associated action.

To create a scaling policy or update an existing one, see PutScalingPolicy.

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 Application Auto Scaling's API operation DeleteScalingPolicy for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeObjectNotFoundException "ObjectNotFoundException" The specified object could not be found. For any operation that depends on the existence of a scalable target, this exception is thrown if the scalable target with the specified service namespace, resource ID, and scalable dimension does not exist. For any operation that deletes or deregisters a resource, this exception is thrown if the resource cannot be found.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeleteScalingPolicy

Example

ApplicationAutoScaling DeleteScalingPolicy shared00

To delete a scaling policy

This example deletes a scaling policy for the Amazon ECS service called web-app, which is running in the default cluster.

{ svc := applicationautoscaling.New(session.New()) input := &applicationautoscaling.DeleteScalingPolicyInput{ PolicyName: aws.String("web-app-cpu-lt-25"), ResourceId: aws.String("service/default/web-app"), ScalableDimension: aws.String("ecs:service:DesiredCount"), ServiceNamespace: aws.String("ecs"), } result, err := svc.DeleteScalingPolicy(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case applicationautoscaling.ErrCodeValidationException: fmt.Println(applicationautoscaling.ErrCodeValidationException, aerr.Error()) case applicationautoscaling.ErrCodeObjectNotFoundException: fmt.Println(applicationautoscaling.ErrCodeObjectNotFoundException, aerr.Error()) case applicationautoscaling.ErrCodeConcurrentUpdateException: fmt.Println(applicationautoscaling.ErrCodeConcurrentUpdateException, aerr.Error()) case applicationautoscaling.ErrCodeInternalServiceException: fmt.Println(applicationautoscaling.ErrCodeInternalServiceException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeleteScalingPolicyRequest

func (c *ApplicationAutoScaling) DeleteScalingPolicyRequest(input *DeleteScalingPolicyInput) (req *request.Request, output *DeleteScalingPolicyOutput)

DeleteScalingPolicyRequest generates a "aws/request.Request" representing the client's request for the DeleteScalingPolicy 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 DeleteScalingPolicy for more information on using the DeleteScalingPolicy 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 DeleteScalingPolicyRequest method. req, resp := client.DeleteScalingPolicyRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeleteScalingPolicy

DeleteScalingPolicyWithContext

func (c *ApplicationAutoScaling) DeleteScalingPolicyWithContext(ctx aws.Context, input *DeleteScalingPolicyInput, opts ...request.Option) (*DeleteScalingPolicyOutput, error)

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

See DeleteScalingPolicy 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.

DeleteScheduledAction

func (c *ApplicationAutoScaling) DeleteScheduledAction(input *DeleteScheduledActionInput) (*DeleteScheduledActionOutput, error)

DeleteScheduledAction API operation for Application Auto Scaling.

Deletes the specified Application Auto Scaling scheduled action.

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 Application Auto Scaling's API operation DeleteScheduledAction for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeObjectNotFoundException "ObjectNotFoundException" The specified object could not be found. For any operation that depends on the existence of a scalable target, this exception is thrown if the scalable target with the specified service namespace, resource ID, and scalable dimension does not exist. For any operation that deletes or deregisters a resource, this exception is thrown if the resource cannot be found.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeleteScheduledAction

DeleteScheduledActionRequest

func (c *ApplicationAutoScaling) DeleteScheduledActionRequest(input *DeleteScheduledActionInput) (req *request.Request, output *DeleteScheduledActionOutput)

DeleteScheduledActionRequest generates a "aws/request.Request" representing the client's request for the DeleteScheduledAction 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 DeleteScheduledAction for more information on using the DeleteScheduledAction 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 DeleteScheduledActionRequest method. req, resp := client.DeleteScheduledActionRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeleteScheduledAction

DeleteScheduledActionWithContext

func (c *ApplicationAutoScaling) DeleteScheduledActionWithContext(ctx aws.Context, input *DeleteScheduledActionInput, opts ...request.Option) (*DeleteScheduledActionOutput, error)

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

See DeleteScheduledAction 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.

DeregisterScalableTarget

func (c *ApplicationAutoScaling) DeregisterScalableTarget(input *DeregisterScalableTargetInput) (*DeregisterScalableTargetOutput, error)

DeregisterScalableTarget API operation for Application Auto Scaling.

Deregisters a scalable target.

Deregistering a scalable target deletes the scaling policies that are associated with it.

To create a scalable target or update an existing one, see RegisterScalableTarget.

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 Application Auto Scaling's API operation DeregisterScalableTarget for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeObjectNotFoundException "ObjectNotFoundException" The specified object could not be found. For any operation that depends on the existence of a scalable target, this exception is thrown if the scalable target with the specified service namespace, resource ID, and scalable dimension does not exist. For any operation that deletes or deregisters a resource, this exception is thrown if the resource cannot be found.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeregisterScalableTarget

Example

ApplicationAutoScaling DeregisterScalableTarget shared00

To deregister a scalable target

This example deregisters a scalable target for an Amazon ECS service called web-app that is running in the default cluster.

{ svc := applicationautoscaling.New(session.New()) input := &applicationautoscaling.DeregisterScalableTargetInput{ ResourceId: aws.String("service/default/web-app"), ScalableDimension: aws.String("ecs:service:DesiredCount"), ServiceNamespace: aws.String("ecs"), } result, err := svc.DeregisterScalableTarget(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case applicationautoscaling.ErrCodeValidationException: fmt.Println(applicationautoscaling.ErrCodeValidationException, aerr.Error()) case applicationautoscaling.ErrCodeObjectNotFoundException: fmt.Println(applicationautoscaling.ErrCodeObjectNotFoundException, aerr.Error()) case applicationautoscaling.ErrCodeConcurrentUpdateException: fmt.Println(applicationautoscaling.ErrCodeConcurrentUpdateException, aerr.Error()) case applicationautoscaling.ErrCodeInternalServiceException: fmt.Println(applicationautoscaling.ErrCodeInternalServiceException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeregisterScalableTargetRequest

func (c *ApplicationAutoScaling) DeregisterScalableTargetRequest(input *DeregisterScalableTargetInput) (req *request.Request, output *DeregisterScalableTargetOutput)

DeregisterScalableTargetRequest generates a "aws/request.Request" representing the client's request for the DeregisterScalableTarget 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 DeregisterScalableTarget for more information on using the DeregisterScalableTarget 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 DeregisterScalableTargetRequest method. req, resp := client.DeregisterScalableTargetRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeregisterScalableTarget

DeregisterScalableTargetWithContext

func (c *ApplicationAutoScaling) DeregisterScalableTargetWithContext(ctx aws.Context, input *DeregisterScalableTargetInput, opts ...request.Option) (*DeregisterScalableTargetOutput, error)

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

See DeregisterScalableTarget 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.

DescribeScalableTargets

func (c *ApplicationAutoScaling) DescribeScalableTargets(input *DescribeScalableTargetsInput) (*DescribeScalableTargetsOutput, error)

DescribeScalableTargets API operation for Application Auto Scaling.

Gets information about the scalable targets in the specified namespace.

You can filter the results using the ResourceIds and ScalableDimension parameters.

To create a scalable target or update an existing one, see RegisterScalableTarget. If you are no longer using a scalable target, you can deregister it using DeregisterScalableTarget.

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 Application Auto Scaling's API operation DescribeScalableTargets for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeInvalidNextTokenException "InvalidNextTokenException" The next token supplied was invalid.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalableTargets

Example

ApplicationAutoScaling DescribeScalableTargets shared00

To describe scalable targets

This example describes the scalable targets for the ecs service namespace.

{ svc := applicationautoscaling.New(session.New()) input := &applicationautoscaling.DescribeScalableTargetsInput{ ServiceNamespace: aws.String("ecs"), } result, err := svc.DescribeScalableTargets(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case applicationautoscaling.ErrCodeValidationException: fmt.Println(applicationautoscaling.ErrCodeValidationException, aerr.Error()) case applicationautoscaling.ErrCodeInvalidNextTokenException: fmt.Println(applicationautoscaling.ErrCodeInvalidNextTokenException, aerr.Error()) case applicationautoscaling.ErrCodeConcurrentUpdateException: fmt.Println(applicationautoscaling.ErrCodeConcurrentUpdateException, aerr.Error()) case applicationautoscaling.ErrCodeInternalServiceException: fmt.Println(applicationautoscaling.ErrCodeInternalServiceException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeScalableTargetsPages

func (c *ApplicationAutoScaling) DescribeScalableTargetsPages(input *DescribeScalableTargetsInput, fn func(*DescribeScalableTargetsOutput, bool) bool) error

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

See DescribeScalableTargets 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 DescribeScalableTargets operation. pageNum := 0 err := client.DescribeScalableTargetsPages(params, func(page *DescribeScalableTargetsOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

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

DescribeScalableTargetsPagesWithContext

func (c *ApplicationAutoScaling) DescribeScalableTargetsPagesWithContext(ctx aws.Context, input *DescribeScalableTargetsInput, fn func(*DescribeScalableTargetsOutput, bool) bool, opts ...request.Option) error

DescribeScalableTargetsPagesWithContext same as DescribeScalableTargetsPages 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.

DescribeScalableTargetsRequest

func (c *ApplicationAutoScaling) DescribeScalableTargetsRequest(input *DescribeScalableTargetsInput) (req *request.Request, output *DescribeScalableTargetsOutput)

DescribeScalableTargetsRequest generates a "aws/request.Request" representing the client's request for the DescribeScalableTargets 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 DescribeScalableTargets for more information on using the DescribeScalableTargets 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 DescribeScalableTargetsRequest method. req, resp := client.DescribeScalableTargetsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalableTargets

DescribeScalableTargetsWithContext

func (c *ApplicationAutoScaling) DescribeScalableTargetsWithContext(ctx aws.Context, input *DescribeScalableTargetsInput, opts ...request.Option) (*DescribeScalableTargetsOutput, error)

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

See DescribeScalableTargets 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.

DescribeScalingActivities

func (c *ApplicationAutoScaling) DescribeScalingActivities(input *DescribeScalingActivitiesInput) (*DescribeScalingActivitiesOutput, error)

DescribeScalingActivities API operation for Application Auto Scaling.

Provides descriptive information about the scaling activities in the specified namespace from the previous six weeks.

You can filter the results using the ResourceId and ScalableDimension parameters.

Scaling activities are triggered by CloudWatch alarms that are associated with scaling policies. To view the scaling policies for a service namespace, see DescribeScalingPolicies. To create a scaling policy or update an existing one, see PutScalingPolicy.

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 Application Auto Scaling's API operation DescribeScalingActivities for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeInvalidNextTokenException "InvalidNextTokenException" The next token supplied was invalid.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingActivities

Example

ApplicationAutoScaling DescribeScalingActivities shared00

To describe scaling activities for a scalable target

This example describes the scaling activities for an Amazon ECS service called web-app that is running in the default cluster.

{ svc := applicationautoscaling.New(session.New()) input := &applicationautoscaling.DescribeScalingActivitiesInput{ ResourceId: aws.String("service/default/web-app"), ScalableDimension: aws.String("ecs:service:DesiredCount"), ServiceNamespace: aws.String("ecs"), } result, err := svc.DescribeScalingActivities(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case applicationautoscaling.ErrCodeValidationException: fmt.Println(applicationautoscaling.ErrCodeValidationException, aerr.Error()) case applicationautoscaling.ErrCodeInvalidNextTokenException: fmt.Println(applicationautoscaling.ErrCodeInvalidNextTokenException, aerr.Error()) case applicationautoscaling.ErrCodeConcurrentUpdateException: fmt.Println(applicationautoscaling.ErrCodeConcurrentUpdateException, aerr.Error()) case applicationautoscaling.ErrCodeInternalServiceException: fmt.Println(applicationautoscaling.ErrCodeInternalServiceException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeScalingActivitiesPages

func (c *ApplicationAutoScaling) DescribeScalingActivitiesPages(input *DescribeScalingActivitiesInput, fn func(*DescribeScalingActivitiesOutput, bool) bool) error

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

See DescribeScalingActivities 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 DescribeScalingActivities operation. pageNum := 0 err := client.DescribeScalingActivitiesPages(params, func(page *DescribeScalingActivitiesOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

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

DescribeScalingActivitiesPagesWithContext

func (c *ApplicationAutoScaling) DescribeScalingActivitiesPagesWithContext(ctx aws.Context, input *DescribeScalingActivitiesInput, fn func(*DescribeScalingActivitiesOutput, bool) bool, opts ...request.Option) error

DescribeScalingActivitiesPagesWithContext same as DescribeScalingActivitiesPages 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.

DescribeScalingActivitiesRequest

func (c *ApplicationAutoScaling) DescribeScalingActivitiesRequest(input *DescribeScalingActivitiesInput) (req *request.Request, output *DescribeScalingActivitiesOutput)

DescribeScalingActivitiesRequest generates a "aws/request.Request" representing the client's request for the DescribeScalingActivities 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 DescribeScalingActivities for more information on using the DescribeScalingActivities 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 DescribeScalingActivitiesRequest method. req, resp := client.DescribeScalingActivitiesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingActivities

DescribeScalingActivitiesWithContext

func (c *ApplicationAutoScaling) DescribeScalingActivitiesWithContext(ctx aws.Context, input *DescribeScalingActivitiesInput, opts ...request.Option) (*DescribeScalingActivitiesOutput, error)

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

See DescribeScalingActivities 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.

DescribeScalingPolicies

func (c *ApplicationAutoScaling) DescribeScalingPolicies(input *DescribeScalingPoliciesInput) (*DescribeScalingPoliciesOutput, error)

DescribeScalingPolicies API operation for Application Auto Scaling.

Describes the scaling policies for the specified service namespace.

You can filter the results using the ResourceId, ScalableDimension, and PolicyNames parameters.

To create a scaling policy or update an existing one, see PutScalingPolicy. If you are no longer using a scaling policy, you can delete it using DeleteScalingPolicy.

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 Application Auto Scaling's API operation DescribeScalingPolicies for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeFailedResourceAccessException "FailedResourceAccessException" Failed access to resources caused an exception. This exception is thrown when Application Auto Scaling is unable to retrieve the alarms associated with a scaling policy due to a client error, for example, if the role ARN specified for a scalable target does not have permission to call the CloudWatch DescribeAlarms (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html) on your behalf.

  • ErrCodeInvalidNextTokenException "InvalidNextTokenException" The next token supplied was invalid.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingPolicies

Example

ApplicationAutoScaling DescribeScalingPolicies shared00

To describe scaling policies

This example describes the scaling policies for the ecs service namespace.

{ svc := applicationautoscaling.New(session.New()) input := &applicationautoscaling.DescribeScalingPoliciesInput{ ServiceNamespace: aws.String("ecs"), } result, err := svc.DescribeScalingPolicies(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case applicationautoscaling.ErrCodeValidationException: fmt.Println(applicationautoscaling.ErrCodeValidationException, aerr.Error()) case applicationautoscaling.ErrCodeFailedResourceAccessException: fmt.Println(applicationautoscaling.ErrCodeFailedResourceAccessException, aerr.Error()) case applicationautoscaling.ErrCodeInvalidNextTokenException: fmt.Println(applicationautoscaling.ErrCodeInvalidNextTokenException, aerr.Error()) case applicationautoscaling.ErrCodeConcurrentUpdateException: fmt.Println(applicationautoscaling.ErrCodeConcurrentUpdateException, aerr.Error()) case applicationautoscaling.ErrCodeInternalServiceException: fmt.Println(applicationautoscaling.ErrCodeInternalServiceException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeScalingPoliciesPages

func (c *ApplicationAutoScaling) DescribeScalingPoliciesPages(input *DescribeScalingPoliciesInput, fn func(*DescribeScalingPoliciesOutput, bool) bool) error

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

See DescribeScalingPolicies 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 DescribeScalingPolicies operation. pageNum := 0 err := client.DescribeScalingPoliciesPages(params, func(page *DescribeScalingPoliciesOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

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

DescribeScalingPoliciesPagesWithContext

func (c *ApplicationAutoScaling) DescribeScalingPoliciesPagesWithContext(ctx aws.Context, input *DescribeScalingPoliciesInput, fn func(*DescribeScalingPoliciesOutput, bool) bool, opts ...request.Option) error

DescribeScalingPoliciesPagesWithContext same as DescribeScalingPoliciesPages 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.

DescribeScalingPoliciesRequest

func (c *ApplicationAutoScaling) DescribeScalingPoliciesRequest(input *DescribeScalingPoliciesInput) (req *request.Request, output *DescribeScalingPoliciesOutput)

DescribeScalingPoliciesRequest generates a "aws/request.Request" representing the client's request for the DescribeScalingPolicies 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 DescribeScalingPolicies for more information on using the DescribeScalingPolicies 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 DescribeScalingPoliciesRequest method. req, resp := client.DescribeScalingPoliciesRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScalingPolicies

DescribeScalingPoliciesWithContext

func (c *ApplicationAutoScaling) DescribeScalingPoliciesWithContext(ctx aws.Context, input *DescribeScalingPoliciesInput, opts ...request.Option) (*DescribeScalingPoliciesOutput, error)

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

See DescribeScalingPolicies 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.

DescribeScheduledActions

func (c *ApplicationAutoScaling) DescribeScheduledActions(input *DescribeScheduledActionsInput) (*DescribeScheduledActionsOutput, error)

DescribeScheduledActions API operation for Application Auto Scaling.

Describes the scheduled actions for the specified service namespace.

You can filter the results using the ResourceId, ScalableDimension, and ScheduledActionNames parameters.

To create a scheduled action or update an existing one, see PutScheduledAction. If you are no longer using a scheduled action, you can delete it using DeleteScheduledAction.

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 Application Auto Scaling's API operation DescribeScheduledActions for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeInvalidNextTokenException "InvalidNextTokenException" The next token supplied was invalid.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScheduledActions

DescribeScheduledActionsRequest

func (c *ApplicationAutoScaling) DescribeScheduledActionsRequest(input *DescribeScheduledActionsInput) (req *request.Request, output *DescribeScheduledActionsOutput)

DescribeScheduledActionsRequest generates a "aws/request.Request" representing the client's request for the DescribeScheduledActions 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 DescribeScheduledActions for more information on using the DescribeScheduledActions 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 DescribeScheduledActionsRequest method. req, resp := client.DescribeScheduledActionsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DescribeScheduledActions

DescribeScheduledActionsWithContext

func (c *ApplicationAutoScaling) DescribeScheduledActionsWithContext(ctx aws.Context, input *DescribeScheduledActionsInput, opts ...request.Option) (*DescribeScheduledActionsOutput, error)

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

See DescribeScheduledActions 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.

PutScalingPolicy

func (c *ApplicationAutoScaling) PutScalingPolicy(input *PutScalingPolicyInput) (*PutScalingPolicyOutput, error)

PutScalingPolicy API operation for Application Auto Scaling.

Creates or updates a policy for an Application Auto Scaling scalable target.

Each scalable target is identified by a service namespace, resource ID, and scalable dimension. A scaling policy applies to the scalable target identified by those three attributes. You cannot create a scaling policy until you have registered the resource as a scalable target using RegisterScalableTarget.

To update a policy, specify its policy name and the parameters that you want to change. Any parameters that you don't specify are not changed by this update request.

You can view the scaling policies for a service namespace using DescribeScalingPolicies. If you are no longer using a scaling policy, you can delete it using DeleteScalingPolicy.

Multiple scaling policies can be in force at the same time for the same scalable target. You can have one or more target tracking scaling policies, one or more step scaling policies, or both. However, there is a chance that multiple policies could conflict, instructing the scalable target to scale out or in at the same time. Application Auto Scaling gives precedence to the policy that provides the largest capacity for both scale in and scale out. For example, if one policy increases capacity by 3, another policy increases capacity by 200 percent, and the current capacity is 10, Application Auto Scaling uses the policy with the highest calculated capacity (200% of 10 = 20) and scales out to 30.

Learn more about how to work with scaling policies in the Application Auto Scaling User Guide (https://docs.aws.amazon.com/autoscaling/application/userguide/what-is-application-auto-scaling.html).

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 Application Auto Scaling's API operation PutScalingPolicy for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeObjectNotFoundException "ObjectNotFoundException" The specified object could not be found. For any operation that depends on the existence of a scalable target, this exception is thrown if the scalable target with the specified service namespace, resource ID, and scalable dimension does not exist. For any operation that deletes or deregisters a resource, this exception is thrown if the resource cannot be found.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeFailedResourceAccessException "FailedResourceAccessException" Failed access to resources caused an exception. This exception is thrown when Application Auto Scaling is unable to retrieve the alarms associated with a scaling policy due to a client error, for example, if the role ARN specified for a scalable target does not have permission to call the CloudWatch DescribeAlarms (https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html) on your behalf.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PutScalingPolicy

Examples

ApplicationAutoScaling PutScalingPolicy shared00

To apply a scaling policy to an Amazon ECS service

This example applies a scaling policy to an Amazon ECS service called web-app in the default cluster. The policy increases the desired count of the service by 200%, with a cool down period of 60 seconds.

{ svc := applicationautoscaling.New(session.New()) input := &applicationautoscaling.PutScalingPolicyInput{ PolicyName: aws.String("web-app-cpu-gt-75"), PolicyType: aws.String("StepScaling"), ResourceId: aws.String("service/default/web-app"), ScalableDimension: aws.String("ecs:service:DesiredCount"), ServiceNamespace: aws.String("ecs"), StepScalingPolicyConfiguration: &applicationautoscaling.StepScalingPolicyConfiguration{ AdjustmentType: aws.String("PercentChangeInCapacity"), Cooldown: aws.Int64(60), StepAdjustments: []*applicationautoscaling.StepAdjustment{ { MetricIntervalLowerBound: aws.Float64(0.000000), ScalingAdjustment: aws.Int64(200), }, }, }, } result, err := svc.PutScalingPolicy(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case applicationautoscaling.ErrCodeValidationException: fmt.Println(applicationautoscaling.ErrCodeValidationException, aerr.Error()) case applicationautoscaling.ErrCodeLimitExceededException: fmt.Println(applicationautoscaling.ErrCodeLimitExceededException, aerr.Error()) case applicationautoscaling.ErrCodeObjectNotFoundException: fmt.Println(applicationautoscaling.ErrCodeObjectNotFoundException, aerr.Error()) case applicationautoscaling.ErrCodeConcurrentUpdateException: fmt.Println(applicationautoscaling.ErrCodeConcurrentUpdateException, aerr.Error()) case applicationautoscaling.ErrCodeFailedResourceAccessException: fmt.Println(applicationautoscaling.ErrCodeFailedResourceAccessException, aerr.Error()) case applicationautoscaling.ErrCodeInternalServiceException: fmt.Println(applicationautoscaling.ErrCodeInternalServiceException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
ApplicationAutoScaling PutScalingPolicy shared01

To apply a scaling policy to an Amazon EC2 Spot fleet

This example applies a scaling policy to an Amazon EC2 Spot fleet. The policy increases the target capacity of the spot fleet by 200%, with a cool down period of 180 seconds.",

{ svc := applicationautoscaling.New(session.New()) input := &applicationautoscaling.PutScalingPolicyInput{ PolicyName: aws.String("fleet-cpu-gt-75"), PolicyType: aws.String("StepScaling"), ResourceId: aws.String("spot-fleet-request/sfr-45e69d8a-be48-4539-bbf3-3464e99c50c3"), ScalableDimension: aws.String("ec2:spot-fleet-request:TargetCapacity"), ServiceNamespace: aws.String("ec2"), StepScalingPolicyConfiguration: &applicationautoscaling.StepScalingPolicyConfiguration{ AdjustmentType: aws.String("PercentChangeInCapacity"), Cooldown: aws.Int64(180), StepAdjustments: []*applicationautoscaling.StepAdjustment{ { MetricIntervalLowerBound: aws.Float64(0.000000), ScalingAdjustment: aws.Int64(200), }, }, }, } result, err := svc.PutScalingPolicy(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case applicationautoscaling.ErrCodeValidationException: fmt.Println(applicationautoscaling.ErrCodeValidationException, aerr.Error()) case applicationautoscaling.ErrCodeLimitExceededException: fmt.Println(applicationautoscaling.ErrCodeLimitExceededException, aerr.Error()) case applicationautoscaling.ErrCodeObjectNotFoundException: fmt.Println(applicationautoscaling.ErrCodeObjectNotFoundException, aerr.Error()) case applicationautoscaling.ErrCodeConcurrentUpdateException: fmt.Println(applicationautoscaling.ErrCodeConcurrentUpdateException, aerr.Error()) case applicationautoscaling.ErrCodeFailedResourceAccessException: fmt.Println(applicationautoscaling.ErrCodeFailedResourceAccessException, aerr.Error()) case applicationautoscaling.ErrCodeInternalServiceException: fmt.Println(applicationautoscaling.ErrCodeInternalServiceException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

PutScalingPolicyRequest

func (c *ApplicationAutoScaling) PutScalingPolicyRequest(input *PutScalingPolicyInput) (req *request.Request, output *PutScalingPolicyOutput)

PutScalingPolicyRequest generates a "aws/request.Request" representing the client's request for the PutScalingPolicy 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 PutScalingPolicy for more information on using the PutScalingPolicy 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 PutScalingPolicyRequest method. req, resp := client.PutScalingPolicyRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PutScalingPolicy

PutScalingPolicyWithContext

func (c *ApplicationAutoScaling) PutScalingPolicyWithContext(ctx aws.Context, input *PutScalingPolicyInput, opts ...request.Option) (*PutScalingPolicyOutput, error)

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

See PutScalingPolicy 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.

PutScheduledAction

func (c *ApplicationAutoScaling) PutScheduledAction(input *PutScheduledActionInput) (*PutScheduledActionOutput, error)

PutScheduledAction API operation for Application Auto Scaling.

Creates or updates a scheduled action for an Application Auto Scaling scalable target.

Each scalable target is identified by a service namespace, resource ID, and scalable dimension. A scheduled action applies to the scalable target identified by those three attributes. You cannot create a scheduled action until you have registered the resource as a scalable target using RegisterScalableTarget.

To update an action, specify its name and the parameters that you want to change. If you don't specify start and end times, the old values are deleted. Any other parameters that you don't specify are not changed by this update request.

You can view the scheduled actions using DescribeScheduledActions. If you are no longer using a scheduled action, you can delete it using DeleteScheduledAction.

Learn more about how to work with scheduled actions in the Application Auto Scaling User Guide (https://docs.aws.amazon.com/autoscaling/application/userguide/what-is-application-auto-scaling.html).

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 Application Auto Scaling's API operation PutScheduledAction for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeObjectNotFoundException "ObjectNotFoundException" The specified object could not be found. For any operation that depends on the existence of a scalable target, this exception is thrown if the scalable target with the specified service namespace, resource ID, and scalable dimension does not exist. For any operation that deletes or deregisters a resource, this exception is thrown if the resource cannot be found.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PutScheduledAction

PutScheduledActionRequest

func (c *ApplicationAutoScaling) PutScheduledActionRequest(input *PutScheduledActionInput) (req *request.Request, output *PutScheduledActionOutput)

PutScheduledActionRequest generates a "aws/request.Request" representing the client's request for the PutScheduledAction 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 PutScheduledAction for more information on using the PutScheduledAction 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 PutScheduledActionRequest method. req, resp := client.PutScheduledActionRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PutScheduledAction

PutScheduledActionWithContext

func (c *ApplicationAutoScaling) PutScheduledActionWithContext(ctx aws.Context, input *PutScheduledActionInput, opts ...request.Option) (*PutScheduledActionOutput, error)

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

See PutScheduledAction 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.

RegisterScalableTarget

func (c *ApplicationAutoScaling) RegisterScalableTarget(input *RegisterScalableTargetInput) (*RegisterScalableTargetOutput, error)

RegisterScalableTarget API operation for Application Auto Scaling.

Registers or updates a scalable target. A scalable target is a resource that Application Auto Scaling can scale out and scale in. Each scalable target has a resource ID, scalable dimension, and namespace, as well as values for minimum and maximum capacity.

After you register a scalable target, you do not need to register it again to use other Application Auto Scaling operations. To see which resources have been registered, use DescribeScalableTargets. You can also view the scaling policies for a service namespace using DescribeScalableTargets.

If you no longer need a scalable target, you can deregister it using DeregisterScalableTarget.

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 Application Auto Scaling's API operation RegisterScalableTarget for usage and error information.

Returned Error Codes:

  • ErrCodeValidationException "ValidationException" An exception was thrown for a validation issue. Review the available parameters for the API request.

  • ErrCodeConcurrentUpdateException "ConcurrentUpdateException" Concurrent updates caused an exception, for example, if you request an update to an Application Auto Scaling resource that already has a pending update.

  • ErrCodeInternalServiceException "InternalServiceException" The service encountered an internal error.

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/RegisterScalableTarget

Examples

ApplicationAutoScaling RegisterScalableTarget shared00

To register an ECS service as a scalable target

This example registers a scalable target from an Amazon ECS service called web-app that is running on the default cluster, with a minimum desired count of 1 task and a maximum desired count of 10 tasks.

{ svc := applicationautoscaling.New(session.New()) input := &applicationautoscaling.RegisterScalableTargetInput{ MaxCapacity: aws.Int64(10), MinCapacity: aws.Int64(1), ResourceId: aws.String("service/default/web-app"), RoleARN: aws.String("arn:aws:iam::012345678910:role/ApplicationAutoscalingECSRole"), ScalableDimension: aws.String("ecs:service:DesiredCount"), ServiceNamespace: aws.String("ecs"), } result, err := svc.RegisterScalableTarget(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case applicationautoscaling.ErrCodeValidationException: fmt.Println(applicationautoscaling.ErrCodeValidationException, aerr.Error()) case applicationautoscaling.ErrCodeLimitExceededException: fmt.Println(applicationautoscaling.ErrCodeLimitExceededException, aerr.Error()) case applicationautoscaling.ErrCodeConcurrentUpdateException: fmt.Println(applicationautoscaling.ErrCodeConcurrentUpdateException, aerr.Error()) case applicationautoscaling.ErrCodeInternalServiceException: fmt.Println(applicationautoscaling.ErrCodeInternalServiceException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }
ApplicationAutoScaling RegisterScalableTarget shared01

To register an EC2 Spot fleet as a scalable target

This example registers a scalable target from an Amazon EC2 Spot fleet with a minimum target capacity of 1 and a maximum of 10.

{ svc := applicationautoscaling.New(session.New()) input := &applicationautoscaling.RegisterScalableTargetInput{ MaxCapacity: aws.Int64(10), MinCapacity: aws.Int64(1), ResourceId: aws.String("spot-fleet-request/sfr-45e69d8a-be48-4539-bbf3-3464e99c50c3"), RoleARN: aws.String("arn:aws:iam::012345678910:role/ApplicationAutoscalingSpotRole"), ScalableDimension: aws.String("ec2:spot-fleet-request:TargetCapacity"), ServiceNamespace: aws.String("ec2"), } result, err := svc.RegisterScalableTarget(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case applicationautoscaling.ErrCodeValidationException: fmt.Println(applicationautoscaling.ErrCodeValidationException, aerr.Error()) case applicationautoscaling.ErrCodeLimitExceededException: fmt.Println(applicationautoscaling.ErrCodeLimitExceededException, aerr.Error()) case applicationautoscaling.ErrCodeConcurrentUpdateException: fmt.Println(applicationautoscaling.ErrCodeConcurrentUpdateException, aerr.Error()) case applicationautoscaling.ErrCodeInternalServiceException: fmt.Println(applicationautoscaling.ErrCodeInternalServiceException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

RegisterScalableTargetRequest

func (c *ApplicationAutoScaling) RegisterScalableTargetRequest(input *RegisterScalableTargetInput) (req *request.Request, output *RegisterScalableTargetOutput)

RegisterScalableTargetRequest generates a "aws/request.Request" representing the client's request for the RegisterScalableTarget 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 RegisterScalableTarget for more information on using the RegisterScalableTarget 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 RegisterScalableTargetRequest method. req, resp := client.RegisterScalableTargetRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/RegisterScalableTarget

RegisterScalableTargetWithContext

func (c *ApplicationAutoScaling) RegisterScalableTargetWithContext(ctx aws.Context, input *RegisterScalableTargetInput, opts ...request.Option) (*RegisterScalableTargetOutput, error)

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

See RegisterScalableTarget 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.

On this page: