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
-
#adjustment_type ⇒ String
readonly
The current value of adjustment_type.
-
#alarms ⇒ Hash
readonly
Returns a hash of alarms names (keys) to alarm ARNs (values).
-
#arn ⇒ String
readonly
The current value of arn.
-
#cooldown ⇒ Integer
readonly
The current value of cooldown.
- #group ⇒ Group (also: #auto_scaling_group) readonly
-
#min_adjustment_step ⇒ Integer
readonly
The current value of min_adjustment_step.
- #name ⇒ String readonly
-
#scaling_adjustment ⇒ Integer
readonly
The current value of scaling_adjustment.
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
#adjustment_type ⇒ String (readonly)
Returns the current value of adjustment_type.
31 32 33 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 31 def adjustment_type @adjustment_type end |
#alarms ⇒ Hash (readonly)
Returns a hash of alarms names (keys) to alarm ARNs (values).
31 32 33 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 31 def alarms @alarms end |
#arn ⇒ String (readonly)
Returns the current value of arn.
31 32 33 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 31 def arn @arn end |
#cooldown ⇒ Integer (readonly)
Returns the current value of cooldown.
31 32 33 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 31 def cooldown @cooldown end |
#group ⇒ Group (readonly) Also known as: auto_scaling_group
43 44 45 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 43 def group @group end |
#min_adjustment_step ⇒ Integer (readonly)
Returns the current value of min_adjustment_step.
31 32 33 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 31 def min_adjustment_step @min_adjustment_step end |
#name ⇒ String (readonly)
48 49 50 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 48 def name @name end |
#scaling_adjustment ⇒ Integer (readonly)
Returns the current value of scaling_adjustment.
31 32 33 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 31 def scaling_adjustment @scaling_adjustment end |
Instance Method Details
#delete ⇒ nil
Deletes this scaling policy.
110 111 112 113 114 115 116 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 110 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.
99 100 101 102 103 104 105 106 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 99 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.
119 120 121 122 123 124 125 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 119 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.
79 80 81 82 83 84 |
# File 'lib/aws/auto_scaling/scaling_policy.rb', line 79 def update = {} client_opts = (group, name, ) resp = client.put_scaling_policy(client_opts) static_attributes[:arn] = resp.policy_arn nil end |