mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|auto_scaling] support termination policies
This commit is contained in:
parent
55829e301b
commit
c65428c54f
4 changed files with 60 additions and 38 deletions
|
@ -23,20 +23,23 @@ module Fog
|
||||||
# * 'DefaultCooldown'<~Integer> - The amount of time, in seconds,
|
# * 'DefaultCooldown'<~Integer> - The amount of time, in seconds,
|
||||||
# after a scaling activity completes before any further trigger-
|
# after a scaling activity completes before any further trigger-
|
||||||
# related scaling activities can start.
|
# related scaling activities can start.
|
||||||
# * 'DesiredCapacity'<~Integer> - The number of EC2 instances that
|
# * 'DesiredCapacity'<~Integer> - The number of Amazon EC2 instances
|
||||||
# should be running in the group. For more information, see
|
# that should be running in the group.
|
||||||
# set_desired_capacity.
|
|
||||||
# * 'HealthCheckGracePeriod'<~Integer> - Length of time in seconds
|
# * 'HealthCheckGracePeriod'<~Integer> - Length of time in seconds
|
||||||
# after a new EC2 instance comes into service that Auto Scaling
|
# after a new Amazon EC2 instance comes into service that Auto
|
||||||
# starts checking its health.
|
# Scaling starts checking its health.
|
||||||
# * 'HealthCheckType'<~String> - The service you want the health
|
# * 'HealthCheckType'<~String> - The service you want the health
|
||||||
# status from, Amazon EC2 or Elastic Load Balancer. Valid values
|
# status from, Amazon EC2 or Elastic Load Balancer. Valid values
|
||||||
# are "EC2" or "ELB".
|
# are "EC2" or "ELB".
|
||||||
# * 'LoadBalancerNames'<~Array> - A list of LoadBalancers to use.
|
# * 'LoadBalancerNames'<~Array> - A list of LoadBalancers to use.
|
||||||
# * 'PlacementGroup'<~String> - Physical location of your cluster
|
# * 'PlacementGroup'<~String> - Physical location of your cluster
|
||||||
# placement group created in Amazon EC2.
|
# placement group created in Amazon EC2.
|
||||||
# * 'VPCZoneIdentifier'<~String> - Subnet identifier of the Virtual
|
# * 'TerminationPolicies'<~Array> - A standalone termination policy
|
||||||
# Private Cloud.
|
# or a list of termination policies used to select the instance to
|
||||||
|
# terminate. The policies are executed in the order that they are
|
||||||
|
# listed.
|
||||||
|
# * 'VPCZoneIdentifier'<~String> - A comma-separated list of subnet
|
||||||
|
# identifiers of Amazon Virtual Private Clouds (Amazon VPCs).
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
|
@ -60,6 +63,9 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if termination_policies = options.delete('TerminationPolicies')
|
||||||
|
options.merge!(AWS.indexed_param('TerminationPolicies.member.%d', [*termination_policies]))
|
||||||
|
end
|
||||||
request({
|
request({
|
||||||
'Action' => 'CreateAutoScalingGroup',
|
'Action' => 'CreateAutoScalingGroup',
|
||||||
'AutoScalingGroupName' => auto_scaling_group_name,
|
'AutoScalingGroupName' => auto_scaling_group_name,
|
||||||
|
@ -98,7 +104,7 @@ module Fog
|
||||||
'MinSize' => min_size,
|
'MinSize' => min_size,
|
||||||
'PlacementGroup' => nil,
|
'PlacementGroup' => nil,
|
||||||
'SuspendedProcesses' => [],
|
'SuspendedProcesses' => [],
|
||||||
'TerminationPolicies' => [],
|
'TerminationPolicies' => ['Default'],
|
||||||
'VPCZoneIdentifier' => nil
|
'VPCZoneIdentifier' => nil
|
||||||
}.merge!(options)
|
}.merge!(options)
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@ module Fog
|
||||||
# * 'AutoScalingGroupNames'<~Array> - A list of Auto Scaling group
|
# * 'AutoScalingGroupNames'<~Array> - A list of Auto Scaling group
|
||||||
# names.
|
# names.
|
||||||
# * 'MaxRecords'<~Integer> - The maximum number of records to return.
|
# * 'MaxRecords'<~Integer> - The maximum number of records to return.
|
||||||
# * 'NextToken'<~String> - The token returned by a previous call to
|
# * 'NextToken'<~String> - A string that marks the start of the next
|
||||||
# indicate that there is more data available.
|
# batch of returned results.
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
|
@ -39,11 +39,11 @@ module Fog
|
||||||
# availability zones for the group.
|
# availability zones for the group.
|
||||||
# * 'CreatedTime'<~Time> - Specifies the date and time the
|
# * 'CreatedTime'<~Time> - Specifies the date and time the
|
||||||
# Auto Scaling group was created.
|
# Auto Scaling group was created.
|
||||||
# * 'DefaultCooldown'<~Integer> - The umber of seconds after
|
# * 'DefaultCooldown'<~Integer> - The number of seconds after
|
||||||
# a scaling activity completes before any further scaling
|
# a scaling activity completes before any further scaling
|
||||||
# activities can start.
|
# activities can start.
|
||||||
# * 'DesiredCapacity'<~Integer> - Specifies the desired
|
# * 'DesiredCapacity'<~Integer> - Specifies the desired
|
||||||
# capacity of the AutoScalingGroup.
|
# capacity of the Auto Scaling group.
|
||||||
# * 'EnabledMetrics'<~Array>:
|
# * 'EnabledMetrics'<~Array>:
|
||||||
# * enabledmetric<~Hash>:
|
# * enabledmetric<~Hash>:
|
||||||
# * 'Granularity'<~String> - The granularity of the
|
# * 'Granularity'<~String> - The granularity of the
|
||||||
|
@ -71,8 +71,10 @@ module Fog
|
||||||
# of the associated launch configuration.
|
# of the associated launch configuration.
|
||||||
# * 'LoadBalancerNames'<~Array> - A list of load balancers
|
# * 'LoadBalancerNames'<~Array> - A list of load balancers
|
||||||
# associated with this Auto Scaling group.
|
# associated with this Auto Scaling group.
|
||||||
# * 'MaxSize'<~Integer> - The maximum size of the group.
|
# * 'MaxSize'<~Integer> - The maximum size of the Auto
|
||||||
# * 'MinSize'<~Integer> - The minimum size of the group.
|
# Scaling group.
|
||||||
|
# * 'MinSize'<~Integer> - The minimum size of the Auto
|
||||||
|
# Scaling group.
|
||||||
# * 'PlacementGroup'<~String> - The name of the cluster
|
# * 'PlacementGroup'<~String> - The name of the cluster
|
||||||
# placement group, if applicable.
|
# placement group, if applicable.
|
||||||
# * 'SuspendedProcesses'<~Array>:
|
# * 'SuspendedProcesses'<~Array>:
|
||||||
|
@ -81,12 +83,14 @@ module Fog
|
||||||
# process.
|
# process.
|
||||||
# * 'SuspensionReason'<~String> - The reason that the
|
# * 'SuspensionReason'<~String> - The reason that the
|
||||||
# process was suspended.
|
# process was suspended.
|
||||||
# * 'VPCZoneIdentifier'<~String> - The identifier for the VPC
|
# * 'TerminationPolicies'<~Array> - A standalone termination
|
||||||
# connection, if applicable.
|
# policy or a list of termination policies for this Auto
|
||||||
# * 'NextToken'<~String> - Acts as a paging mechanism for large
|
# Scaling group.
|
||||||
# result sets. Set to a non-empty string if there are
|
# * 'VPCZoneIdentifier'<~String> - The subnet identifier for
|
||||||
# additional results waiting to be returned. Pass this in to
|
# the Amazon VPC connection, if applicable. You can specify
|
||||||
# subsequent calls to return additional results.
|
# several subnets in a comma-separated list.
|
||||||
|
# * 'NextToken'<~String> - A string that marks the start of the
|
||||||
|
# next batch of returned results.
|
||||||
#
|
#
|
||||||
# ==== See Also
|
# ==== See Also
|
||||||
# http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_DescribeAutoScalingGroups.html
|
# http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_DescribeAutoScalingGroups.html
|
||||||
|
|
|
@ -17,22 +17,31 @@ module Fog
|
||||||
# * auto_scaling_group_name<~String> - The name of the Auto Scaling
|
# * auto_scaling_group_name<~String> - The name of the Auto Scaling
|
||||||
# group.
|
# group.
|
||||||
# * options<~Hash>:
|
# * options<~Hash>:
|
||||||
# * 'AvailabilityZones'<~Array>: Availability zones for the group
|
# * 'AvailabilityZones'<~Array> - Availability zones for the group.
|
||||||
# * 'DefaultCooldown'<~Integer> - Amount of time, in seconds, after a
|
# * 'DefaultCooldown'<~Integer> - The amount of time, in seconds,
|
||||||
# scaling activity completes before any further trigger-related
|
# after a scaling activity completes before any further trigger-
|
||||||
# scaling activities can start
|
# related scaling activities can start
|
||||||
# * 'DesiredCapacity'<~Integer> - Desired capacity for the scaling group
|
# * 'DesiredCapacity'<~Integer> - The desired capacity for the Auto
|
||||||
# * 'HealthCheckGracePeriod'<~Integer> - Length of time that Auto
|
# Scaling group.
|
||||||
# Scaling waits before checking an instance's health status
|
# * 'HealthCheckGracePeriod'<~Integer> - The length of time that Auto
|
||||||
# * 'HealthCheckType'<~String> - Service of interest for the health
|
# Scaling waits before checking an instance's health status.The
|
||||||
# status check, either "EC2" or "ELB".
|
# grace period begins when an instance comes into service.
|
||||||
# * 'LaunchConfigurationName'<~String> - Name of the launch configuration
|
# * 'HealthCheckType'<~String> - The service of interest for the
|
||||||
# * 'MaxSize'<~Integer> - Maximum size of the Auto Scaling group
|
# health status check, either "EC2" for Amazon EC2 or "ELB" for
|
||||||
# * 'MinSize'<~Integer> - Minimum size of the Auto Scaling group
|
# Elastic Load Balancing.
|
||||||
# * 'PlacementGroup'<~String> - Name of the cluster placement group,
|
# * 'LaunchConfigurationName'<~String> - The name of the launch
|
||||||
# if applicable
|
# configuration.
|
||||||
# * 'VPCZoneIdentifier'<~String> - Identifier for the VPC connection,
|
# * 'MaxSize'<~Integer> - The maximum size of the Auto Scaling group.
|
||||||
# if applicable
|
# * 'MinSize'<~Integer> - The minimum size of the Auto Scaling group.
|
||||||
|
# * 'PlacementGroup'<~String> - The name of the cluster placement
|
||||||
|
# group, if applicable.
|
||||||
|
# * 'TerminationPolicies'<~Array> - A standalone termination policy
|
||||||
|
# or a list of termination policies used to select the instance to
|
||||||
|
# terminate. The policies are executed in the order that they are
|
||||||
|
# listed.
|
||||||
|
# * 'VPCZoneIdentifier'<~String> - The subnet identifier for the
|
||||||
|
# Amazon VPC connection, if applicable. You can specify several
|
||||||
|
# subnets in a comma-separated list.
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# * response<~Excon::Response>:
|
# * response<~Excon::Response>:
|
||||||
|
@ -47,6 +56,9 @@ module Fog
|
||||||
if availability_zones = options.delete('AvailabilityZones')
|
if availability_zones = options.delete('AvailabilityZones')
|
||||||
options.merge!(AWS.indexed_param('AvailabilityZones.member.%d', [*availability_zones]))
|
options.merge!(AWS.indexed_param('AvailabilityZones.member.%d', [*availability_zones]))
|
||||||
end
|
end
|
||||||
|
if termination_policies = options.delete('TerminationPolicies')
|
||||||
|
options.merge!(AWS.indexed_param('TerminationPolicies.member.%d', [*termination_policies]))
|
||||||
|
end
|
||||||
request({
|
request({
|
||||||
'Action' => 'UpdateAutoScalingGroup',
|
'Action' => 'UpdateAutoScalingGroup',
|
||||||
'AutoScalingGroupName' => auto_scaling_group_name,
|
'AutoScalingGroupName' => auto_scaling_group_name,
|
||||||
|
|
|
@ -81,8 +81,8 @@ class AWS
|
||||||
'MinSize' => Integer,
|
'MinSize' => Integer,
|
||||||
'PlacementGroup' => Fog::Nullable::String,
|
'PlacementGroup' => Fog::Nullable::String,
|
||||||
'SuspendedProcesses' => [SUSPENDED_PROCESS],
|
'SuspendedProcesses' => [SUSPENDED_PROCESS],
|
||||||
'VPCZoneIdentifier' => Fog::Nullable::String,
|
'TerminationPolicies' => [String],
|
||||||
'TerminationPolicies' => [String]
|
'VPCZoneIdentifier' => Fog::Nullable::String
|
||||||
}
|
}
|
||||||
|
|
||||||
AUTO_SCALING_INSTANCE_DETAILS = INSTANCE.merge({
|
AUTO_SCALING_INSTANCE_DETAILS = INSTANCE.merge({
|
||||||
|
|
Loading…
Add table
Reference in a new issue