Class: AWS::AutoScaling::ScalingPolicy
- Inherits:
-
Core::Resource
- Object
- Core::Resource
- AWS::AutoScaling::ScalingPolicy
- Defined in:
- lib/aws/auto_scaling/scaling_policy.rb
Instance Attribute Summary collapse
- #group ⇒ Group (also: #auto_scaling_group) readonly
- #name ⇒ String readonly
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.
-
#update(options = {}) ⇒ nil
(also: #put)
Updates this scaling policy.
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 |