class AWS::AutoScaling::ScalingPolicyCollection

Attributes

auto_scaling_group[R]

@return [Group]

group[R]

@return [Group]

Public Class Methods

new(auto_scaling_group, options = {}) click to toggle source
Calls superclass method
# File lib/aws/auto_scaling/scaling_policy_collection.rb, line 21
def initialize auto_scaling_group, options = {}
  @group = auto_scaling_group
  super
end

Public Instance Methods

[](policy_name) click to toggle source

@param [String] policy_name @return [ScalingPolicy]

# File lib/aws/auto_scaling/scaling_policy_collection.rb, line 45
def [] policy_name
  ScalingPolicy.new(group, policy_name)
end
create(name, options = {}) click to toggle source

@param [String] name The name of the policy you want to create or update. @param (see AWS::AutoScaling::ScalingPolicyOptions#scaling_policy_options) @option (see AWS::AutoScaling::ScalingPolicyOptions#scaling_policy_options) @return [ScalingPolicy]

# 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
Also aliased as: put
put(name, options = {})
Alias for: create

Protected Instance Methods

_each_item(next_token, limit, options = {}) { |scaling_policy| ... } click to toggle source
# File lib/aws/auto_scaling/scaling_policy_collection.rb, line 51
def _each_item next_token, limit, options = {}, &block

  options[:next_token] = next_token if next_token
  options[:max_records] = limit if limit
  options[:auto_scaling_group_name] = group.name

  resp = client.describe_policies(options)
  resp.scaling_policies.each do |details|

    scaling_policy = ScalingPolicy.new_from(
      :describe_policies, details,
      group, details.policy_name)

    yield(scaling_policy)

  end
  resp.data[:next_token]
end