Vendor aws-sdk-go (dep ensure) (#178)

This commit is contained in:
Onur Filiz
2018-04-27 18:18:36 -07:00
committed by Robbie Zhang
parent 228a1f7a5f
commit 8d67098d06
2785 changed files with 1973570 additions and 25 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,113 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package applicationautoscalingiface provides an interface to enable mocking the Application Auto Scaling service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package applicationautoscalingiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/applicationautoscaling"
)
// ApplicationAutoScalingAPI provides an interface to enable mocking the
// applicationautoscaling.ApplicationAutoScaling service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Application Auto Scaling.
// func myFunc(svc applicationautoscalingiface.ApplicationAutoScalingAPI) bool {
// // Make svc.DeleteScalingPolicy request
// }
//
// func main() {
// sess := session.New()
// svc := applicationautoscaling.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockApplicationAutoScalingClient struct {
// applicationautoscalingiface.ApplicationAutoScalingAPI
// }
// func (m *mockApplicationAutoScalingClient) DeleteScalingPolicy(input *applicationautoscaling.DeleteScalingPolicyInput) (*applicationautoscaling.DeleteScalingPolicyOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockApplicationAutoScalingClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type ApplicationAutoScalingAPI interface {
DeleteScalingPolicy(*applicationautoscaling.DeleteScalingPolicyInput) (*applicationautoscaling.DeleteScalingPolicyOutput, error)
DeleteScalingPolicyWithContext(aws.Context, *applicationautoscaling.DeleteScalingPolicyInput, ...request.Option) (*applicationautoscaling.DeleteScalingPolicyOutput, error)
DeleteScalingPolicyRequest(*applicationautoscaling.DeleteScalingPolicyInput) (*request.Request, *applicationautoscaling.DeleteScalingPolicyOutput)
DeleteScheduledAction(*applicationautoscaling.DeleteScheduledActionInput) (*applicationautoscaling.DeleteScheduledActionOutput, error)
DeleteScheduledActionWithContext(aws.Context, *applicationautoscaling.DeleteScheduledActionInput, ...request.Option) (*applicationautoscaling.DeleteScheduledActionOutput, error)
DeleteScheduledActionRequest(*applicationautoscaling.DeleteScheduledActionInput) (*request.Request, *applicationautoscaling.DeleteScheduledActionOutput)
DeregisterScalableTarget(*applicationautoscaling.DeregisterScalableTargetInput) (*applicationautoscaling.DeregisterScalableTargetOutput, error)
DeregisterScalableTargetWithContext(aws.Context, *applicationautoscaling.DeregisterScalableTargetInput, ...request.Option) (*applicationautoscaling.DeregisterScalableTargetOutput, error)
DeregisterScalableTargetRequest(*applicationautoscaling.DeregisterScalableTargetInput) (*request.Request, *applicationautoscaling.DeregisterScalableTargetOutput)
DescribeScalableTargets(*applicationautoscaling.DescribeScalableTargetsInput) (*applicationautoscaling.DescribeScalableTargetsOutput, error)
DescribeScalableTargetsWithContext(aws.Context, *applicationautoscaling.DescribeScalableTargetsInput, ...request.Option) (*applicationautoscaling.DescribeScalableTargetsOutput, error)
DescribeScalableTargetsRequest(*applicationautoscaling.DescribeScalableTargetsInput) (*request.Request, *applicationautoscaling.DescribeScalableTargetsOutput)
DescribeScalableTargetsPages(*applicationautoscaling.DescribeScalableTargetsInput, func(*applicationautoscaling.DescribeScalableTargetsOutput, bool) bool) error
DescribeScalableTargetsPagesWithContext(aws.Context, *applicationautoscaling.DescribeScalableTargetsInput, func(*applicationautoscaling.DescribeScalableTargetsOutput, bool) bool, ...request.Option) error
DescribeScalingActivities(*applicationautoscaling.DescribeScalingActivitiesInput) (*applicationautoscaling.DescribeScalingActivitiesOutput, error)
DescribeScalingActivitiesWithContext(aws.Context, *applicationautoscaling.DescribeScalingActivitiesInput, ...request.Option) (*applicationautoscaling.DescribeScalingActivitiesOutput, error)
DescribeScalingActivitiesRequest(*applicationautoscaling.DescribeScalingActivitiesInput) (*request.Request, *applicationautoscaling.DescribeScalingActivitiesOutput)
DescribeScalingActivitiesPages(*applicationautoscaling.DescribeScalingActivitiesInput, func(*applicationautoscaling.DescribeScalingActivitiesOutput, bool) bool) error
DescribeScalingActivitiesPagesWithContext(aws.Context, *applicationautoscaling.DescribeScalingActivitiesInput, func(*applicationautoscaling.DescribeScalingActivitiesOutput, bool) bool, ...request.Option) error
DescribeScalingPolicies(*applicationautoscaling.DescribeScalingPoliciesInput) (*applicationautoscaling.DescribeScalingPoliciesOutput, error)
DescribeScalingPoliciesWithContext(aws.Context, *applicationautoscaling.DescribeScalingPoliciesInput, ...request.Option) (*applicationautoscaling.DescribeScalingPoliciesOutput, error)
DescribeScalingPoliciesRequest(*applicationautoscaling.DescribeScalingPoliciesInput) (*request.Request, *applicationautoscaling.DescribeScalingPoliciesOutput)
DescribeScalingPoliciesPages(*applicationautoscaling.DescribeScalingPoliciesInput, func(*applicationautoscaling.DescribeScalingPoliciesOutput, bool) bool) error
DescribeScalingPoliciesPagesWithContext(aws.Context, *applicationautoscaling.DescribeScalingPoliciesInput, func(*applicationautoscaling.DescribeScalingPoliciesOutput, bool) bool, ...request.Option) error
DescribeScheduledActions(*applicationautoscaling.DescribeScheduledActionsInput) (*applicationautoscaling.DescribeScheduledActionsOutput, error)
DescribeScheduledActionsWithContext(aws.Context, *applicationautoscaling.DescribeScheduledActionsInput, ...request.Option) (*applicationautoscaling.DescribeScheduledActionsOutput, error)
DescribeScheduledActionsRequest(*applicationautoscaling.DescribeScheduledActionsInput) (*request.Request, *applicationautoscaling.DescribeScheduledActionsOutput)
PutScalingPolicy(*applicationautoscaling.PutScalingPolicyInput) (*applicationautoscaling.PutScalingPolicyOutput, error)
PutScalingPolicyWithContext(aws.Context, *applicationautoscaling.PutScalingPolicyInput, ...request.Option) (*applicationautoscaling.PutScalingPolicyOutput, error)
PutScalingPolicyRequest(*applicationautoscaling.PutScalingPolicyInput) (*request.Request, *applicationautoscaling.PutScalingPolicyOutput)
PutScheduledAction(*applicationautoscaling.PutScheduledActionInput) (*applicationautoscaling.PutScheduledActionOutput, error)
PutScheduledActionWithContext(aws.Context, *applicationautoscaling.PutScheduledActionInput, ...request.Option) (*applicationautoscaling.PutScheduledActionOutput, error)
PutScheduledActionRequest(*applicationautoscaling.PutScheduledActionInput) (*request.Request, *applicationautoscaling.PutScheduledActionOutput)
RegisterScalableTarget(*applicationautoscaling.RegisterScalableTargetInput) (*applicationautoscaling.RegisterScalableTargetOutput, error)
RegisterScalableTargetWithContext(aws.Context, *applicationautoscaling.RegisterScalableTargetInput, ...request.Option) (*applicationautoscaling.RegisterScalableTargetOutput, error)
RegisterScalableTargetRequest(*applicationautoscaling.RegisterScalableTargetInput) (*request.Request, *applicationautoscaling.RegisterScalableTargetOutput)
}
var _ ApplicationAutoScalingAPI = (*applicationautoscaling.ApplicationAutoScaling)(nil)

View File

@@ -0,0 +1,75 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package applicationautoscaling provides the client and types for making API
// requests to Application Auto Scaling.
//
// With Application Auto Scaling, you can configure automatic scaling for your
// scalable AWS resources. You can use Application Auto Scaling to accomplish
// the following tasks:
//
// * Define scaling policies to automatically scale your AWS resources
//
// * Scale your resources in response to CloudWatch alarms
//
// * Schedule one-time or recurring scaling actions
//
// * View the history of your scaling events
//
// Application Auto Scaling can scale the following AWS resources:
//
// * Amazon ECS services. For more information, see Service Auto Scaling
// (http://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html)
// in the Amazon Elastic Container Service Developer Guide.
//
// * Amazon EC2 Spot fleets. For more information, see Automatic Scaling
// for Spot Fleet (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/fleet-auto-scaling.html)
// in the Amazon EC2 User Guide.
//
// * Amazon EMR clusters. For more information, see Using Automatic Scaling
// in Amazon EMR (http://docs.aws.amazon.com/ElasticMapReduce/latest/ManagementGuide/emr-automatic-scaling.html)
// in the Amazon EMR Management Guide.
//
// * AppStream 2.0 fleets. For more information, see Fleet Auto Scaling for
// Amazon AppStream 2.0 (http://docs.aws.amazon.com/appstream2/latest/developerguide/autoscaling.html)
// in the Amazon AppStream 2.0 Developer Guide.
//
// * Provisioned read and write capacity for Amazon DynamoDB tables and global
// secondary indexes. For more information, see Managing Throughput Capacity
// Automatically with DynamoDB Auto Scaling (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/AutoScaling.html)
// in the Amazon DynamoDB Developer Guide.
//
// * Amazon Aurora Replicas. For more information, see Using Amazon Aurora
// Auto Scaling with Aurora Replicas (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Integrating.AutoScaling.html).
//
// * Amazon SageMaker endpoints. For more information, see Automatically
// Scaling Amazon SageMaker Models (http://docs.aws.amazon.com/sagemaker/latest/dg/endpoint-auto-scaling.html).
//
// To configure automatic scaling for multiple resources across multiple services,
// use AWS Auto Scaling to create a scaling plan for your application. For more
// information, see AWS Auto Scaling (http://aws.amazon.com/autoscaling).
//
// For a list of supported regions, see AWS Regions and Endpoints: Application
// Auto Scaling (http://docs.aws.amazon.com/general/latest/gr/rande.html#as-app_region)
// in the AWS General Reference.
//
// See https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06 for more information on this service.
//
// See applicationautoscaling package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/applicationautoscaling/
//
// Using the Client
//
// To contact Application Auto Scaling with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Application Auto Scaling client ApplicationAutoScaling for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/applicationautoscaling/#New
package applicationautoscaling

View File

@@ -0,0 +1,60 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package applicationautoscaling
const (
// ErrCodeConcurrentUpdateException for service response error code
// "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.
ErrCodeConcurrentUpdateException = "ConcurrentUpdateException"
// ErrCodeFailedResourceAccessException for service response error code
// "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 (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html)
// on your behalf.
ErrCodeFailedResourceAccessException = "FailedResourceAccessException"
// ErrCodeInternalServiceException for service response error code
// "InternalServiceException".
//
// The service encountered an internal error.
ErrCodeInternalServiceException = "InternalServiceException"
// ErrCodeInvalidNextTokenException for service response error code
// "InvalidNextTokenException".
//
// The next token supplied was invalid.
ErrCodeInvalidNextTokenException = "InvalidNextTokenException"
// ErrCodeLimitExceededException for service response error code
// "LimitExceededException".
//
// A per-account resource limit is exceeded. For more information, see Application
// Auto Scaling Limits (http://docs.aws.amazon.com/ApplicationAutoScaling/latest/userguide/application-auto-scaling-limits.html).
ErrCodeLimitExceededException = "LimitExceededException"
// ErrCodeObjectNotFoundException for service response error code
// "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.
ErrCodeObjectNotFoundException = "ObjectNotFoundException"
// ErrCodeValidationException for service response error code
// "ValidationException".
//
// An exception was thrown for a validation issue. Review the available parameters
// for the API request.
ErrCodeValidationException = "ValidationException"
)

View File

@@ -0,0 +1,407 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package applicationautoscaling_test
import (
"fmt"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/applicationautoscaling"
)
var _ time.Duration
var _ strings.Reader
var _ aws.Config
func parseTime(layout, value string) *time.Time {
t, err := time.Parse(layout, value)
if err != nil {
panic(err)
}
return &t
}
// 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.
func ExampleApplicationAutoScaling_DeleteScalingPolicy_shared00() {
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 {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// 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.
func ExampleApplicationAutoScaling_DeregisterScalableTarget_shared00() {
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 {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To describe scalable targets
//
// This example describes the scalable targets for the ecs service namespace.
func ExampleApplicationAutoScaling_DescribeScalableTargets_shared00() {
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 {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// 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.
func ExampleApplicationAutoScaling_DescribeScalingActivities_shared00() {
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 {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To describe scaling policies
//
// This example describes the scaling policies for the ecs service namespace.
func ExampleApplicationAutoScaling_DescribeScalingPolicies_shared00() {
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 {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// 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.
func ExampleApplicationAutoScaling_PutScalingPolicy_shared00() {
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 {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// 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.",
//
//
func ExampleApplicationAutoScaling_PutScalingPolicy_shared01() {
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 {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// 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.
func ExampleApplicationAutoScaling_RegisterScalableTarget_shared00() {
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 {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// 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.
func ExampleApplicationAutoScaling_RegisterScalableTarget_shared01() {
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 {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}

View File

@@ -0,0 +1,98 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package applicationautoscaling
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// 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.
type ApplicationAutoScaling struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "autoscaling" // Service endpoint prefix API calls made to.
EndpointsID = "application-autoscaling" // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the ApplicationAutoScaling client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a ApplicationAutoScaling client from just a session.
// svc := applicationautoscaling.New(mySession)
//
// // Create a ApplicationAutoScaling client with additional configuration
// svc := applicationautoscaling.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *ApplicationAutoScaling {
c := p.ClientConfig(EndpointsID, cfgs...)
if c.SigningNameDerived || len(c.SigningName) == 0 {
c.SigningName = "application-autoscaling"
}
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *ApplicationAutoScaling {
svc := &ApplicationAutoScaling{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2016-02-06",
JSONVersion: "1.1",
TargetPrefix: "AnyScaleFrontendService",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a ApplicationAutoScaling operation and runs any
// custom request initialization.
func (c *ApplicationAutoScaling) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}