Class: AWS::AutoScaling::ScalingPolicyCollection

Inherits:
Object
  • Object
show all
Includes:
Core::Collection::WithLimitAndNextToken
Defined in:
lib/aws/auto_scaling/scaling_policy_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Constructor Details

#initialize(auto_scaling_group, options = {}) ⇒ ScalingPolicyCollection

Returns a new instance of ScalingPolicyCollection.



21
22
23
24
# File 'lib/aws/auto_scaling/scaling_policy_collection.rb', line 21

def initialize auto_scaling_group, options = {}
  @group = auto_scaling_group
  super
end

Instance Attribute Details

#groupGroup (readonly) Also known as: auto_scaling_group

Returns:



27
28
29
# File 'lib/aws/auto_scaling/scaling_policy_collection.rb', line 27

def group
  @group
end

Instance Method Details

#[](policy_name) ⇒ ScalingPolicy

Parameters:

  • policy_name (String)

Returns:



45
46
47
# File 'lib/aws/auto_scaling/scaling_policy_collection.rb', line 45

def [] policy_name
  ScalingPolicy.new(group, policy_name)
end

#create(name, options = {}) ⇒ ScalingPolicy Also known as: put

Parameters:

  • name (String)

    The name of the policy you want to create or update.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :adjustment_type (required, String)

    Specifies whether the adjustment is an absolute number or a percentage of the current capacity. Valid values are:

    • ‘ChangeInCapacity’

    • ‘ExactCapacity’

    • ‘PercentChangeInCapacity’

  • :scaling_adjustment (required, Integer)

    The number of instances by which to scale. :adjustment_type determines the interpretation of this umber (e.g., as an absolute number or as a percentage of the existing Auto Scaling group size). A positive increment adds to the current capacity and a negative value removes from the current capacity.

  • :cooldown (Integer)

    The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.

  • :min_adjustment_magnitude (Integer)

Returns:



36
37
38
39
40
# File 'lib/aws/auto_scaling/scaling_policy_collection.rb', line 36

def create name, options = {}
  scaling_policy = self[name]
  scaling_policy.put(options)
  scaling_policy
end