vendor: update all dependencies

This commit is contained in:
Nick Craig-Wood
2017-07-23 08:51:42 +01:00
parent 0b6fba34a3
commit eb87cf6f12
2008 changed files with 352617 additions and 1004734 deletions
+594 -24
View File
@@ -596,12 +596,11 @@ func (c *ApplicationAutoScaling) DescribeScalingPoliciesRequest(input *DescribeS
// for the API request.
//
// * ErrCodeFailedResourceAccessException "FailedResourceAccessException"
// Failed access to resources caused an exception. This exception currently
// only applies to DescribeScalingPolicies. It 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 the proper permissions to call the CloudWatch DescribeAlarms
// (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html)
// 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)
// API operation on behalf of your account.
//
// * ErrCodeInvalidNextTokenException "InvalidNextTokenException"
@@ -774,6 +773,14 @@ func (c *ApplicationAutoScaling) PutScalingPolicyRequest(input *PutScalingPolicy
// 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 (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html)
// API operation on behalf of your account.
//
// * ErrCodeInternalServiceException "InternalServiceException"
// The service encountered an internal error.
//
@@ -938,6 +945,102 @@ func (s *Alarm) SetAlarmName(v string) *Alarm {
return s
}
// Configures a customized metric for a target tracking policy.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/CustomizedMetricSpecification
type CustomizedMetricSpecification struct {
_ struct{} `type:"structure"`
// The dimensions of the metric.
Dimensions []*MetricDimension `type:"list"`
// The name of the metric.
//
// MetricName is a required field
MetricName *string `type:"string" required:"true"`
// The namespace of the metric.
//
// Namespace is a required field
Namespace *string `type:"string" required:"true"`
// The statistic of the metric.
//
// Statistic is a required field
Statistic *string `type:"string" required:"true" enum:"MetricStatistic"`
// The unit of the metric.
Unit *string `type:"string"`
}
// String returns the string representation
func (s CustomizedMetricSpecification) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s CustomizedMetricSpecification) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *CustomizedMetricSpecification) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "CustomizedMetricSpecification"}
if s.MetricName == nil {
invalidParams.Add(request.NewErrParamRequired("MetricName"))
}
if s.Namespace == nil {
invalidParams.Add(request.NewErrParamRequired("Namespace"))
}
if s.Statistic == nil {
invalidParams.Add(request.NewErrParamRequired("Statistic"))
}
if s.Dimensions != nil {
for i, v := range s.Dimensions {
if v == nil {
continue
}
if err := v.Validate(); err != nil {
invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Dimensions", i), err.(request.ErrInvalidParams))
}
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetDimensions sets the Dimensions field's value.
func (s *CustomizedMetricSpecification) SetDimensions(v []*MetricDimension) *CustomizedMetricSpecification {
s.Dimensions = v
return s
}
// SetMetricName sets the MetricName field's value.
func (s *CustomizedMetricSpecification) SetMetricName(v string) *CustomizedMetricSpecification {
s.MetricName = &v
return s
}
// SetNamespace sets the Namespace field's value.
func (s *CustomizedMetricSpecification) SetNamespace(v string) *CustomizedMetricSpecification {
s.Namespace = &v
return s
}
// SetStatistic sets the Statistic field's value.
func (s *CustomizedMetricSpecification) SetStatistic(v string) *CustomizedMetricSpecification {
s.Statistic = &v
return s
}
// SetUnit sets the Unit field's value.
func (s *CustomizedMetricSpecification) SetUnit(v string) *CustomizedMetricSpecification {
s.Unit = &v
return s
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/DeleteScalingPolicyRequest
type DeleteScalingPolicyInput struct {
_ struct{} `type:"structure"`
@@ -962,6 +1065,12 @@ type DeleteScalingPolicyInput struct {
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
//
// ResourceId is a required field
ResourceId *string `min:"1" type:"string" required:"true"`
@@ -979,6 +1088,18 @@ type DeleteScalingPolicyInput struct {
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
//
// ScalableDimension is a required field
ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"`
@@ -1086,6 +1207,12 @@ type DeregisterScalableTargetInput struct {
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
//
// ResourceId is a required field
ResourceId *string `min:"1" type:"string" required:"true"`
@@ -1103,6 +1230,18 @@ type DeregisterScalableTargetInput struct {
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
//
// ScalableDimension is a required field
ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"`
@@ -1210,6 +1349,12 @@ type DescribeScalableTargetsInput struct {
//
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
ResourceIds []*string `type:"list"`
// The scalable dimension associated with the scalable target. This string consists
@@ -1226,6 +1371,18 @@ type DescribeScalableTargetsInput struct {
//
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
ScalableDimension *string `type:"string" enum:"ScalableDimension"`
// The namespace of the AWS service. For more information, see AWS Service Namespaces
@@ -1354,6 +1511,12 @@ type DescribeScalingActivitiesInput struct {
//
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
ResourceId *string `min:"1" type:"string"`
// The scalable dimension. This string consists of the service namespace, resource
@@ -1370,6 +1533,18 @@ type DescribeScalingActivitiesInput struct {
//
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
ScalableDimension *string `type:"string" enum:"ScalableDimension"`
// The namespace of the AWS service. For more information, see AWS Service Namespaces
@@ -1504,6 +1679,12 @@ type DescribeScalingPoliciesInput struct {
//
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
ResourceId *string `min:"1" type:"string"`
// The scalable dimension. This string consists of the service namespace, resource
@@ -1520,6 +1701,18 @@ type DescribeScalingPoliciesInput struct {
//
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
ScalableDimension *string `type:"string" enum:"ScalableDimension"`
// The namespace of the AWS service. For more information, see AWS Service Namespaces
@@ -1626,6 +1819,112 @@ func (s *DescribeScalingPoliciesOutput) SetScalingPolicies(v []*ScalingPolicy) *
return s
}
// Describes the dimension of a metric.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/MetricDimension
type MetricDimension struct {
_ struct{} `type:"structure"`
// The name of the dimension.
//
// Name is a required field
Name *string `type:"string" required:"true"`
// The value of the dimension.
//
// Value is a required field
Value *string `type:"string" required:"true"`
}
// String returns the string representation
func (s MetricDimension) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s MetricDimension) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *MetricDimension) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "MetricDimension"}
if s.Name == nil {
invalidParams.Add(request.NewErrParamRequired("Name"))
}
if s.Value == nil {
invalidParams.Add(request.NewErrParamRequired("Value"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetName sets the Name field's value.
func (s *MetricDimension) SetName(v string) *MetricDimension {
s.Name = &v
return s
}
// SetValue sets the Value field's value.
func (s *MetricDimension) SetValue(v string) *MetricDimension {
s.Value = &v
return s
}
// Configures a predefined metric for a target tracking policy.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PredefinedMetricSpecification
type PredefinedMetricSpecification struct {
_ struct{} `type:"structure"`
// The metric type.
//
// PredefinedMetricType is a required field
PredefinedMetricType *string `type:"string" required:"true" enum:"MetricType"`
// Reserved for future use.
ResourceLabel *string `min:"1" type:"string"`
}
// String returns the string representation
func (s PredefinedMetricSpecification) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s PredefinedMetricSpecification) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *PredefinedMetricSpecification) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "PredefinedMetricSpecification"}
if s.PredefinedMetricType == nil {
invalidParams.Add(request.NewErrParamRequired("PredefinedMetricType"))
}
if s.ResourceLabel != nil && len(*s.ResourceLabel) < 1 {
invalidParams.Add(request.NewErrParamMinLen("ResourceLabel", 1))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetPredefinedMetricType sets the PredefinedMetricType field's value.
func (s *PredefinedMetricSpecification) SetPredefinedMetricType(v string) *PredefinedMetricSpecification {
s.PredefinedMetricType = &v
return s
}
// SetResourceLabel sets the ResourceLabel field's value.
func (s *PredefinedMetricSpecification) SetResourceLabel(v string) *PredefinedMetricSpecification {
s.ResourceLabel = &v
return s
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PutScalingPolicyRequest
type PutScalingPolicyInput struct {
_ struct{} `type:"structure"`
@@ -1637,6 +1936,9 @@ type PutScalingPolicyInput struct {
// The policy type. If you are creating a new policy, this parameter is required.
// If you are updating a policy, this parameter is not required.
//
// For DynamoDB, only TargetTrackingScaling is supported. For any other service,
// only StepScaling is supported.
PolicyType *string `type:"string" enum:"PolicyType"`
// The identifier of the resource associated with the scaling policy. This string
@@ -1654,6 +1956,12 @@ type PutScalingPolicyInput struct {
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
//
// ResourceId is a required field
ResourceId *string `min:"1" type:"string" required:"true"`
@@ -1671,6 +1979,18 @@ type PutScalingPolicyInput struct {
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
//
// ScalableDimension is a required field
ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"`
@@ -1681,11 +2001,17 @@ type PutScalingPolicyInput struct {
// ServiceNamespace is a required field
ServiceNamespace *string `type:"string" required:"true" enum:"ServiceNamespace"`
// The configuration for the step scaling policy. If you are creating a new
// policy, this parameter is required. If you are updating a policy, this parameter
// is not required. For more information, see StepScalingPolicyConfiguration
// and StepAdjustment.
// A step scaling policy.
//
// This parameter is required if you are creating a policy and the policy type
// is StepScaling.
StepScalingPolicyConfiguration *StepScalingPolicyConfiguration `type:"structure"`
// A target tracking policy.
//
// This parameter is required if you are creating a new policy and the policy
// type is TargetTrackingScaling.
TargetTrackingScalingPolicyConfiguration *TargetTrackingScalingPolicyConfiguration `type:"structure"`
}
// String returns the string representation
@@ -1724,6 +2050,11 @@ func (s *PutScalingPolicyInput) Validate() error {
invalidParams.AddNested("StepScalingPolicyConfiguration", err.(request.ErrInvalidParams))
}
}
if s.TargetTrackingScalingPolicyConfiguration != nil {
if err := s.TargetTrackingScalingPolicyConfiguration.Validate(); err != nil {
invalidParams.AddNested("TargetTrackingScalingPolicyConfiguration", err.(request.ErrInvalidParams))
}
}
if invalidParams.Len() > 0 {
return invalidParams
@@ -1767,10 +2098,19 @@ func (s *PutScalingPolicyInput) SetStepScalingPolicyConfiguration(v *StepScaling
return s
}
// SetTargetTrackingScalingPolicyConfiguration sets the TargetTrackingScalingPolicyConfiguration field's value.
func (s *PutScalingPolicyInput) SetTargetTrackingScalingPolicyConfiguration(v *TargetTrackingScalingPolicyConfiguration) *PutScalingPolicyInput {
s.TargetTrackingScalingPolicyConfiguration = v
return s
}
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/PutScalingPolicyResponse
type PutScalingPolicyOutput struct {
_ struct{} `type:"structure"`
// The CloudWatch alarms created for the target tracking policy.
Alarms []*Alarm `type:"list"`
// The Amazon Resource Name (ARN) of the resulting scaling policy.
//
// PolicyARN is a required field
@@ -1787,6 +2127,12 @@ func (s PutScalingPolicyOutput) GoString() string {
return s.String()
}
// SetAlarms sets the Alarms field's value.
func (s *PutScalingPolicyOutput) SetAlarms(v []*Alarm) *PutScalingPolicyOutput {
s.Alarms = v
return s
}
// SetPolicyARN sets the PolicyARN field's value.
func (s *PutScalingPolicyOutput) SetPolicyARN(v string) *PutScalingPolicyOutput {
s.PolicyARN = &v
@@ -1822,6 +2168,12 @@ type RegisterScalableTargetInput struct {
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
//
// ResourceId is a required field
ResourceId *string `min:"1" type:"string" required:"true"`
@@ -1844,6 +2196,18 @@ type RegisterScalableTargetInput struct {
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
//
// ScalableDimension is a required field
ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"`
@@ -1976,6 +2340,12 @@ type ScalableTarget struct {
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
//
// ResourceId is a required field
ResourceId *string `min:"1" type:"string" required:"true"`
@@ -1999,6 +2369,18 @@ type ScalableTarget struct {
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
//
// ScalableDimension is a required field
ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"`
@@ -2103,6 +2485,12 @@ type ScalingActivity struct {
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
//
// ResourceId is a required field
ResourceId *string `min:"1" type:"string" required:"true"`
@@ -2120,6 +2508,18 @@ type ScalingActivity struct {
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
//
// ScalableDimension is a required field
ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"`
@@ -2263,6 +2663,12 @@ type ScalingPolicy struct {
// * AppStream 2.0 fleet - The resource type is fleet and the unique identifier
// is the fleet name. Example: fleet/sample-fleet.
//
// * DynamoDB table - The resource type is table and the unique identifier
// is the resource ID. Example: table/my-table.
//
// * DynamoDB global secondary index - The resource type is index and the
// unique identifier is the resource ID. Example: table/my-table/index/my-table-index.
//
// ResourceId is a required field
ResourceId *string `min:"1" type:"string" required:"true"`
@@ -2280,6 +2686,18 @@ type ScalingPolicy struct {
// * appstream:fleet:DesiredCapacity - The desired capacity of an AppStream
// 2.0 fleet.
//
// * dynamodb:table:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB table.
//
// * dynamodb:table:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB table.
//
// * dynamodb:index:ReadCapacityUnits - The provisioned read capacity for
// a DynamoDB global secondary index.
//
// * dynamodb:index:WriteCapacityUnits - The provisioned write capacity for
// a DynamoDB global secondary index.
//
// ScalableDimension is a required field
ScalableDimension *string `type:"string" required:"true" enum:"ScalableDimension"`
@@ -2290,8 +2708,11 @@ type ScalingPolicy struct {
// ServiceNamespace is a required field
ServiceNamespace *string `type:"string" required:"true" enum:"ServiceNamespace"`
// The configuration for the step scaling policy.
// A step scaling policy.
StepScalingPolicyConfiguration *StepScalingPolicyConfiguration `type:"structure"`
// A target tracking policy.
TargetTrackingScalingPolicyConfiguration *TargetTrackingScalingPolicyConfiguration `type:"structure"`
}
// String returns the string representation
@@ -2358,6 +2779,12 @@ func (s *ScalingPolicy) SetStepScalingPolicyConfiguration(v *StepScalingPolicyCo
return s
}
// SetTargetTrackingScalingPolicyConfiguration sets the TargetTrackingScalingPolicyConfiguration field's value.
func (s *ScalingPolicy) SetTargetTrackingScalingPolicyConfiguration(v *TargetTrackingScalingPolicyConfiguration) *ScalingPolicy {
s.TargetTrackingScalingPolicyConfiguration = v
return s
}
// Represents a step adjustment for a StepScalingPolicyConfiguration. Describes
// an adjustment based on the difference between the value of the aggregated
// CloudWatch metric and the breach threshold that you've defined for the alarm.
@@ -2469,22 +2896,22 @@ type StepScalingPolicyConfiguration struct {
// previous trigger-related scaling activities can influence future scaling
// events.
//
// For scale out policies, while Cooldown is in effect, the capacity that has
// been added by the previous scale out event that initiated the Cooldown is
// calculated as part of the desired capacity for the next scale out. The intention
// is to continuously (but not excessively) scale out. For example, an alarm
// triggers a step scaling policy to scale out an Amazon ECS service by 2 tasks,
// the scaling activity completes successfully, and a Cooldown period of 5 minutes
// starts. During the Cooldown period, if the alarm triggers the same policy
// again but at a more aggressive step adjustment to scale out the service by
// 3 tasks, the 2 tasks that were added in the previous scale out event are
// considered part of that capacity and only 1 additional task is added to the
// desired count.
// For scale out policies, while the cooldown period is in effect, the capacity
// that has been added by the previous scale out event that initiated the cooldown
// is calculated as part of the desired capacity for the next scale out. The
// intention is to continuously (but not excessively) scale out. For example,
// an alarm triggers a step scaling policy to scale out an Amazon ECS service
// by 2 tasks, the scaling activity completes successfully, and a cooldown period
// of 5 minutes starts. During the Cooldown period, if the alarm triggers the
// same policy again but at a more aggressive step adjustment to scale out the
// service by 3 tasks, the 2 tasks that were added in the previous scale out
// event are considered part of that capacity and only 1 additional task is
// added to the desired count.
//
// For scale in policies, the Cooldown period is used to block subsequent scale
// For scale in policies, the cooldown period is used to block subsequent scale
// in requests until it has expired. The intention is to scale in conservatively
// to protect your application's availability. However, if another alarm triggers
// a scale out policy during the Cooldown period after a scale-in, Application
// a scale out policy during the cooldown period after a scale-in, Application
// Auto Scaling scales out your scalable target immediately.
Cooldown *int64 `type:"integer"`
@@ -2562,6 +2989,106 @@ func (s *StepScalingPolicyConfiguration) SetStepAdjustments(v []*StepAdjustment)
return s
}
// Represents a target tracking scaling policy configuration.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/application-autoscaling-2016-02-06/TargetTrackingScalingPolicyConfiguration
type TargetTrackingScalingPolicyConfiguration struct {
_ struct{} `type:"structure"`
// Reserved for future use.
CustomizedMetricSpecification *CustomizedMetricSpecification `type:"structure"`
// A predefined metric.
PredefinedMetricSpecification *PredefinedMetricSpecification `type:"structure"`
// The amount of time, in seconds, after a scale in activity completes before
// another scale in activity can start.
//
// The cooldown period is used to block subsequent scale in requests until it
// has expired. The intention is to scale in conservatively to protect your
// application's availability. However, if another alarm triggers a scale out
// policy during the cooldown period after a scale-in, Application Auto Scaling
// scales out your scalable target immediately.
ScaleInCooldown *int64 `type:"integer"`
// The amount of time, in seconds, after a scale out activity completes before
// another scale out activity can start.
//
// While the cooldown period is in effect, the capacity that has been added
// by the previous scale out event that initiated the cooldown is calculated
// as part of the desired capacity for the next scale out. The intention is
// to continuously (but not excessively) scale out.
ScaleOutCooldown *int64 `type:"integer"`
// The target value for the metric. The range is 8.515920e-109 to 1.174271e+108
// (Base 10) or 2e-360 to 2e360 (Base 2).
//
// TargetValue is a required field
TargetValue *float64 `type:"double" required:"true"`
}
// String returns the string representation
func (s TargetTrackingScalingPolicyConfiguration) String() string {
return awsutil.Prettify(s)
}
// GoString returns the string representation
func (s TargetTrackingScalingPolicyConfiguration) GoString() string {
return s.String()
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *TargetTrackingScalingPolicyConfiguration) Validate() error {
invalidParams := request.ErrInvalidParams{Context: "TargetTrackingScalingPolicyConfiguration"}
if s.TargetValue == nil {
invalidParams.Add(request.NewErrParamRequired("TargetValue"))
}
if s.CustomizedMetricSpecification != nil {
if err := s.CustomizedMetricSpecification.Validate(); err != nil {
invalidParams.AddNested("CustomizedMetricSpecification", err.(request.ErrInvalidParams))
}
}
if s.PredefinedMetricSpecification != nil {
if err := s.PredefinedMetricSpecification.Validate(); err != nil {
invalidParams.AddNested("PredefinedMetricSpecification", err.(request.ErrInvalidParams))
}
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// SetCustomizedMetricSpecification sets the CustomizedMetricSpecification field's value.
func (s *TargetTrackingScalingPolicyConfiguration) SetCustomizedMetricSpecification(v *CustomizedMetricSpecification) *TargetTrackingScalingPolicyConfiguration {
s.CustomizedMetricSpecification = v
return s
}
// SetPredefinedMetricSpecification sets the PredefinedMetricSpecification field's value.
func (s *TargetTrackingScalingPolicyConfiguration) SetPredefinedMetricSpecification(v *PredefinedMetricSpecification) *TargetTrackingScalingPolicyConfiguration {
s.PredefinedMetricSpecification = v
return s
}
// SetScaleInCooldown sets the ScaleInCooldown field's value.
func (s *TargetTrackingScalingPolicyConfiguration) SetScaleInCooldown(v int64) *TargetTrackingScalingPolicyConfiguration {
s.ScaleInCooldown = &v
return s
}
// SetScaleOutCooldown sets the ScaleOutCooldown field's value.
func (s *TargetTrackingScalingPolicyConfiguration) SetScaleOutCooldown(v int64) *TargetTrackingScalingPolicyConfiguration {
s.ScaleOutCooldown = &v
return s
}
// SetTargetValue sets the TargetValue field's value.
func (s *TargetTrackingScalingPolicyConfiguration) SetTargetValue(v float64) *TargetTrackingScalingPolicyConfiguration {
s.TargetValue = &v
return s
}
const (
// AdjustmentTypeChangeInCapacity is a AdjustmentType enum value
AdjustmentTypeChangeInCapacity = "ChangeInCapacity"
@@ -2584,9 +3111,37 @@ const (
MetricAggregationTypeMaximum = "Maximum"
)
const (
// MetricStatisticAverage is a MetricStatistic enum value
MetricStatisticAverage = "Average"
// MetricStatisticMinimum is a MetricStatistic enum value
MetricStatisticMinimum = "Minimum"
// MetricStatisticMaximum is a MetricStatistic enum value
MetricStatisticMaximum = "Maximum"
// MetricStatisticSampleCount is a MetricStatistic enum value
MetricStatisticSampleCount = "SampleCount"
// MetricStatisticSum is a MetricStatistic enum value
MetricStatisticSum = "Sum"
)
const (
// MetricTypeDynamoDbreadCapacityUtilization is a MetricType enum value
MetricTypeDynamoDbreadCapacityUtilization = "DynamoDBReadCapacityUtilization"
// MetricTypeDynamoDbwriteCapacityUtilization is a MetricType enum value
MetricTypeDynamoDbwriteCapacityUtilization = "DynamoDBWriteCapacityUtilization"
)
const (
// PolicyTypeStepScaling is a PolicyType enum value
PolicyTypeStepScaling = "StepScaling"
// PolicyTypeTargetTrackingScaling is a PolicyType enum value
PolicyTypeTargetTrackingScaling = "TargetTrackingScaling"
)
const (
@@ -2601,6 +3156,18 @@ const (
// ScalableDimensionAppstreamFleetDesiredCapacity is a ScalableDimension enum value
ScalableDimensionAppstreamFleetDesiredCapacity = "appstream:fleet:DesiredCapacity"
// ScalableDimensionDynamodbTableReadCapacityUnits is a ScalableDimension enum value
ScalableDimensionDynamodbTableReadCapacityUnits = "dynamodb:table:ReadCapacityUnits"
// ScalableDimensionDynamodbTableWriteCapacityUnits is a ScalableDimension enum value
ScalableDimensionDynamodbTableWriteCapacityUnits = "dynamodb:table:WriteCapacityUnits"
// ScalableDimensionDynamodbIndexReadCapacityUnits is a ScalableDimension enum value
ScalableDimensionDynamodbIndexReadCapacityUnits = "dynamodb:index:ReadCapacityUnits"
// ScalableDimensionDynamodbIndexWriteCapacityUnits is a ScalableDimension enum value
ScalableDimensionDynamodbIndexWriteCapacityUnits = "dynamodb:index:WriteCapacityUnits"
)
const (
@@ -2635,4 +3202,7 @@ const (
// ServiceNamespaceAppstream is a ServiceNamespace enum value
ServiceNamespaceAppstream = "appstream"
// ServiceNamespaceDynamodb is a ServiceNamespace enum value
ServiceNamespaceDynamodb = "dynamodb"
)
+7 -2
View File
@@ -27,10 +27,15 @@
// 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 Autoscaling Amazon AppStream
// 2.0 Resources (http://docs.aws.amazon.com/appstream2/latest/developerguide/autoscaling.html)
// * 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 Auto Scaling for DynamoDB
// (http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TargetTracking.html)
// in the Amazon DynamoDB Developer Guide.
//
// 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.
+5 -6
View File
@@ -14,12 +14,11 @@ const (
// ErrCodeFailedResourceAccessException for service response error code
// "FailedResourceAccessException".
//
// Failed access to resources caused an exception. This exception currently
// only applies to DescribeScalingPolicies. It 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 the proper permissions to call the CloudWatch DescribeAlarms
// (http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_DescribeAlarms.html)
// 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)
// API operation on behalf of your account.
ErrCodeFailedResourceAccessException = "FailedResourceAccessException"
@@ -3,208 +3,405 @@
package applicationautoscaling_test
import (
"bytes"
"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 _ bytes.Buffer
func ExampleApplicationAutoScaling_DeleteScalingPolicy() {
sess := session.Must(session.NewSession())
svc := applicationautoscaling.New(sess)
params := &applicationautoscaling.DeleteScalingPolicyInput{
PolicyName: aws.String("ResourceIdMaxLen1600"), // Required
ResourceId: aws.String("ResourceIdMaxLen1600"), // Required
ScalableDimension: aws.String("ScalableDimension"), // Required
ServiceNamespace: aws.String("ServiceNamespace"), // Required
}
resp, err := svc.DeleteScalingPolicy(params)
var _ strings.Reader
var _ aws.Config
func parseTime(layout, value string) *time.Time {
t, err := time.Parse(layout, value)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
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
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExampleApplicationAutoScaling_DeregisterScalableTarget() {
sess := session.Must(session.NewSession())
svc := applicationautoscaling.New(sess)
params := &applicationautoscaling.DeregisterScalableTargetInput{
ResourceId: aws.String("ResourceIdMaxLen1600"), // Required
ScalableDimension: aws.String("ScalableDimension"), // Required
ServiceNamespace: aws.String("ServiceNamespace"), // Required
// 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"),
}
resp, err := svc.DeregisterScalableTarget(params)
result, err := svc.DeregisterScalableTarget(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
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
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExampleApplicationAutoScaling_DescribeScalableTargets() {
sess := session.Must(session.NewSession())
svc := applicationautoscaling.New(sess)
params := &applicationautoscaling.DescribeScalableTargetsInput{
ServiceNamespace: aws.String("ServiceNamespace"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("XmlString"),
ResourceIds: []*string{
aws.String("ResourceIdMaxLen1600"), // Required
// More values...
},
ScalableDimension: aws.String("ScalableDimension"),
// 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"),
}
resp, err := svc.DescribeScalableTargets(params)
result, err := svc.DescribeScalableTargets(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
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
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExampleApplicationAutoScaling_DescribeScalingActivities() {
sess := session.Must(session.NewSession())
svc := applicationautoscaling.New(sess)
params := &applicationautoscaling.DescribeScalingActivitiesInput{
ServiceNamespace: aws.String("ServiceNamespace"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("XmlString"),
ResourceId: aws.String("ResourceIdMaxLen1600"),
ScalableDimension: aws.String("ScalableDimension"),
// 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"),
}
resp, err := svc.DescribeScalingActivities(params)
result, err := svc.DescribeScalingActivities(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
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
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExampleApplicationAutoScaling_DescribeScalingPolicies() {
sess := session.Must(session.NewSession())
svc := applicationautoscaling.New(sess)
params := &applicationautoscaling.DescribeScalingPoliciesInput{
ServiceNamespace: aws.String("ServiceNamespace"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("XmlString"),
PolicyNames: []*string{
aws.String("ResourceIdMaxLen1600"), // Required
// More values...
},
ResourceId: aws.String("ResourceIdMaxLen1600"),
ScalableDimension: aws.String("ScalableDimension"),
// 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"),
}
resp, err := svc.DescribeScalingPolicies(params)
result, err := svc.DescribeScalingPolicies(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
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
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExampleApplicationAutoScaling_PutScalingPolicy() {
sess := session.Must(session.NewSession())
svc := applicationautoscaling.New(sess)
params := &applicationautoscaling.PutScalingPolicyInput{
PolicyName: aws.String("PolicyName"), // Required
ResourceId: aws.String("ResourceIdMaxLen1600"), // Required
ScalableDimension: aws.String("ScalableDimension"), // Required
ServiceNamespace: aws.String("ServiceNamespace"), // Required
PolicyType: aws.String("PolicyType"),
// 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("AdjustmentType"),
Cooldown: aws.Int64(1),
MetricAggregationType: aws.String("MetricAggregationType"),
MinAdjustmentMagnitude: aws.Int64(1),
AdjustmentType: aws.String("PercentChangeInCapacity"),
Cooldown: aws.Int64(60),
StepAdjustments: []*applicationautoscaling.StepAdjustment{
{ // Required
ScalingAdjustment: aws.Int64(1), // Required
MetricIntervalLowerBound: aws.Float64(1.0),
MetricIntervalUpperBound: aws.Float64(1.0),
{
MetricIntervalLowerBound: aws.Float64(0.000000),
ScalingAdjustment: aws.Int64(200),
},
// More values...
},
},
}
resp, err := svc.PutScalingPolicy(params)
result, err := svc.PutScalingPolicy(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
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
}
// Pretty-print the response data.
fmt.Println(resp)
fmt.Println(result)
}
func ExampleApplicationAutoScaling_RegisterScalableTarget() {
sess := session.Must(session.NewSession())
// 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),
},
},
},
}
svc := applicationautoscaling.New(sess)
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
}
params := &applicationautoscaling.RegisterScalableTargetInput{
ResourceId: aws.String("ResourceIdMaxLen1600"), // Required
ScalableDimension: aws.String("ScalableDimension"), // Required
ServiceNamespace: aws.String("ServiceNamespace"), // Required
MaxCapacity: aws.Int64(1),
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),
RoleARN: aws.String("ResourceIdMaxLen1600"),
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"),
}
resp, err := svc.RegisterScalableTarget(params)
result, err := svc.RegisterScalableTarget(input)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
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
}
// Pretty-print the response data.
fmt.Println(resp)
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)
}