Class: AWS::AutoScaling::ScalingPolicy
- Inherits:
-
Core::Resource
- Object
- Core::Resource
- AWS::AutoScaling::ScalingPolicy
- Includes:
- ScalingPolicyOptions
- Defined in:
- lib/aws/auto_scaling/scaling_policy.rb
Instance Attribute Summary collapse
- #group ⇒ Group (also: #auto_scaling_group) readonly
- #name ⇒ String readonly
Attributes included from Core::Model
Instance Method Summary collapse
-
#delete ⇒ nil
Deletes this scaling policy.
-
#execute(options = {}) ⇒ nil
Runs this policy against it’s Auto Scaling group.
-
#exists? ⇒ Boolean
Returns true if the policy exists.
-
#initialize(auto_scaling_group, policy_name, options = {}) ⇒ ScalingPolicy
constructor
A new instance of ScalingPolicy.
-
#update(options = {}) ⇒ nil
(also: #put)
Updates this scaling policy.
Methods inherited from Core::Resource
attribute_providers, attribute_providers_for, attributes, #attributes_from_response, define_attribute_type, #eql?, #inspect, new_from
Methods included from Core::Cacheable
Methods included from Core::Model
#client, #config_prefix, #inspect
Constructor Details
#initialize(auto_scaling_group, policy_name, options = {}) ⇒ ScalingPolicy
Returns a new instance of ScalingPolicy.
21 22 23 24 25 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 21 def initialize auto_scaling_group, policy_name, = {} @group = auto_scaling_group @name = policy_name super end |
Instance Attribute Details
#group ⇒ Group (readonly) Also known as: auto_scaling_group
28 29 30 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 28 def group @group end |
#name ⇒ String (readonly)
33 34 35 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 33 def name @name end |
Instance Method Details
#delete ⇒ nil
Deletes this scaling policy.
93 94 95 96 97 98 99 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 93 def delete client_opts = {} client_opts[:auto_scaling_group_name] = group.name client_opts[:policy_name] = name client.delete_policy(client_opts) nil end |
#execute(options = {}) ⇒ nil
Runs this policy against it’s Auto Scaling group.
82 83 84 85 86 87 88 89 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 82 def execute = {} client_opts = {} client_opts[:auto_scaling_group_name] = group.name client_opts[:policy_name] = name client_opts[:honor_cooldown] = [:honor_cooldown] == true client.execute_policy(client_opts) nil end |
#exists? ⇒ Boolean
Returns true if the policy exists.
102 103 104 105 106 107 108 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 102 def exists? client_opts = {} client_opts[:auto_scaling_group_name] = group.name client_opts[:policy_names] = [name] resp = client.describe_policies(client_opts) !resp.scaling_policies.empty? end |
#update(options = {}) ⇒ nil Also known as: put
Updates this scaling policy.
62 63 64 65 66 67 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 62 def update = {} client_opts = (group, name, ) resp = client.put_scaling_policy(client_opts) static_attributes[:arn] = resp.policy_arn nil end |