1
0
Fork 0
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:
Nick Osborn 2012-09-22 15:46:13 +01:00
parent 55829e301b
commit c65428c54f
4 changed files with 60 additions and 38 deletions

View file

@ -23,20 +23,23 @@ module Fog
# * 'DefaultCooldown'<~Integer> - The amount of time, in seconds,
# after a scaling activity completes before any further trigger-
# related scaling activities can start.
# * 'DesiredCapacity'<~Integer> - The number of EC2 instances that
# should be running in the group. For more information, see
# set_desired_capacity.
# * 'DesiredCapacity'<~Integer> - The number of Amazon EC2 instances
# that should be running in the group.
# * 'HealthCheckGracePeriod'<~Integer> - Length of time in seconds
# after a new EC2 instance comes into service that Auto Scaling
# starts checking its health.
# after a new Amazon EC2 instance comes into service that Auto
# Scaling starts checking its health.
# * 'HealthCheckType'<~String> - The service you want the health
# status from, Amazon EC2 or Elastic Load Balancer. Valid values
# are "EC2" or "ELB".
# * 'LoadBalancerNames'<~Array> - A list of LoadBalancers to use.
# * 'PlacementGroup'<~String> - Physical location of your cluster
# placement group created in Amazon EC2.
# * 'VPCZoneIdentifier'<~String> - Subnet identifier of the Virtual
# Private Cloud.
# * '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> - A comma-separated list of subnet
# identifiers of Amazon Virtual Private Clouds (Amazon VPCs).
#
# ==== Returns
# * response<~Excon::Response>:
@ -60,6 +63,9 @@ module Fog
end
end
end
if termination_policies = options.delete('TerminationPolicies')
options.merge!(AWS.indexed_param('TerminationPolicies.member.%d', [*termination_policies]))
end
request({
'Action' => 'CreateAutoScalingGroup',
'AutoScalingGroupName' => auto_scaling_group_name,
@ -98,7 +104,7 @@ module Fog
'MinSize' => min_size,
'PlacementGroup' => nil,
'SuspendedProcesses' => [],
'TerminationPolicies' => [],
'TerminationPolicies' => ['Default'],
'VPCZoneIdentifier' => nil
}.merge!(options)

View file

@ -20,8 +20,8 @@ module Fog
# * 'AutoScalingGroupNames'<~Array> - A list of Auto Scaling group
# names.
# * 'MaxRecords'<~Integer> - The maximum number of records to return.
# * 'NextToken'<~String> - The token returned by a previous call to
# indicate that there is more data available.
# * 'NextToken'<~String> - A string that marks the start of the next
# batch of returned results.
#
# ==== Returns
# * response<~Excon::Response>:
@ -39,11 +39,11 @@ module Fog
# availability zones for the group.
# * 'CreatedTime'<~Time> - Specifies the date and time the
# 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
# activities can start.
# * 'DesiredCapacity'<~Integer> - Specifies the desired
# capacity of the AutoScalingGroup.
# capacity of the Auto Scaling group.
# * 'EnabledMetrics'<~Array>:
# * enabledmetric<~Hash>:
# * 'Granularity'<~String> - The granularity of the
@ -71,8 +71,10 @@ module Fog
# of the associated launch configuration.
# * 'LoadBalancerNames'<~Array> - A list of load balancers
# associated with this Auto Scaling group.
# * 'MaxSize'<~Integer> - The maximum size of the group.
# * 'MinSize'<~Integer> - The minimum size of the group.
# * 'MaxSize'<~Integer> - The maximum size of the Auto
# Scaling group.
# * 'MinSize'<~Integer> - The minimum size of the Auto
# Scaling group.
# * 'PlacementGroup'<~String> - The name of the cluster
# placement group, if applicable.
# * 'SuspendedProcesses'<~Array>:
@ -81,12 +83,14 @@ module Fog
# process.
# * 'SuspensionReason'<~String> - The reason that the
# process was suspended.
# * 'VPCZoneIdentifier'<~String> - The identifier for the VPC
# connection, if applicable.
# * 'NextToken'<~String> - Acts as a paging mechanism for large
# result sets. Set to a non-empty string if there are
# additional results waiting to be returned. Pass this in to
# subsequent calls to return additional results.
# * 'TerminationPolicies'<~Array> - A standalone termination
# policy or a list of termination policies for this Auto
# Scaling group.
# * 'VPCZoneIdentifier'<~String> - The subnet identifier for
# the Amazon VPC connection, if applicable. You can specify
# several subnets in a comma-separated list.
# * 'NextToken'<~String> - A string that marks the start of the
# next batch of returned results.
#
# ==== See Also
# http://docs.amazonwebservices.com/AutoScaling/latest/APIReference/API_DescribeAutoScalingGroups.html

View file

@ -17,22 +17,31 @@ module Fog
# * auto_scaling_group_name<~String> - The name of the Auto Scaling
# group.
# * options<~Hash>:
# * 'AvailabilityZones'<~Array>: Availability zones for the group
# * 'DefaultCooldown'<~Integer> - Amount of time, in seconds, after a
# scaling activity completes before any further trigger-related
# scaling activities can start
# * 'DesiredCapacity'<~Integer> - Desired capacity for the scaling group
# * 'HealthCheckGracePeriod'<~Integer> - Length of time that Auto
# Scaling waits before checking an instance's health status
# * 'HealthCheckType'<~String> - Service of interest for the health
# status check, either "EC2" or "ELB".
# * 'LaunchConfigurationName'<~String> - Name of the launch configuration
# * 'MaxSize'<~Integer> - Maximum size of the Auto Scaling group
# * 'MinSize'<~Integer> - Minimum size of the Auto Scaling group
# * 'PlacementGroup'<~String> - Name of the cluster placement group,
# if applicable
# * 'VPCZoneIdentifier'<~String> - Identifier for the VPC connection,
# if applicable
# * 'AvailabilityZones'<~Array> - Availability zones for the group.
# * 'DefaultCooldown'<~Integer> - The amount of time, in seconds,
# after a scaling activity completes before any further trigger-
# related scaling activities can start
# * 'DesiredCapacity'<~Integer> - The desired capacity for the Auto
# Scaling group.
# * 'HealthCheckGracePeriod'<~Integer> - The length of time that Auto
# Scaling waits before checking an instance's health status.The
# grace period begins when an instance comes into service.
# * 'HealthCheckType'<~String> - The service of interest for the
# health status check, either "EC2" for Amazon EC2 or "ELB" for
# Elastic Load Balancing.
# * 'LaunchConfigurationName'<~String> - The name of the launch
# configuration.
# * 'MaxSize'<~Integer> - The maximum size of the Auto Scaling group.
# * '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
# * response<~Excon::Response>:
@ -47,6 +56,9 @@ module Fog
if availability_zones = options.delete('AvailabilityZones')
options.merge!(AWS.indexed_param('AvailabilityZones.member.%d', [*availability_zones]))
end
if termination_policies = options.delete('TerminationPolicies')
options.merge!(AWS.indexed_param('TerminationPolicies.member.%d', [*termination_policies]))
end
request({
'Action' => 'UpdateAutoScalingGroup',
'AutoScalingGroupName' => auto_scaling_group_name,

View file

@ -81,8 +81,8 @@ class AWS
'MinSize' => Integer,
'PlacementGroup' => Fog::Nullable::String,
'SuspendedProcesses' => [SUSPENDED_PROCESS],
'VPCZoneIdentifier' => Fog::Nullable::String,
'TerminationPolicies' => [String]
'TerminationPolicies' => [String],
'VPCZoneIdentifier' => Fog::Nullable::String
}
AUTO_SCALING_INSTANCE_DETAILS = INSTANCE.merge({