Class: Ey::Core::Client::BaseAutoScalingPolicy
- Extended by:
- Associations
- Defined in:
- lib/ey-core/models/base_auto_scaling_policy.rb
Direct Known Subclasses
SimpleAutoScalingPolicy, StepAutoScalingPolicy, TargetAutoScalingPolicy
Instance Method Summary collapse
Methods included from Associations
assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader
Methods inherited from Model
#destroy, range_parser, #save, #to_s, #update!, #url
Instance Method Details
#alarm ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/ey-core/models/base_auto_scaling_policy.rb', line 42 def alarm requires :identity data = self.connection.get_auto_scaling_alarms( "auto_scaling_policy_id" => identity ).body["auto_scaling_alarms"] self.connection.auto_scaling_alarms.load(data).first end |
#destroy! ⇒ Object
36 37 38 39 40 |
# File 'lib/ey-core/models/base_auto_scaling_policy.rb', line 36 def destroy! connection.requests.new( self.connection.destroy_auto_scaling_policy("id" => self.id).body["request"] ) end |
#save! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ey-core/models/base_auto_scaling_policy.rb', line 15 def save! requires :auto_scaling_group_id, :type params = { "url" => self.collection.url, "auto_scaling_policy" => { "name" => self.name }.merge(policy_params), "auto_scaling_group_id" => self.auto_scaling_group_id } if new_record? policy_requires requires :name connection.requests.new(connection.create_auto_scaling_policy(params).body["request"]) else requires :identity params.merge("id" => identity) connection.requests.new(connection.update_auto_scaling_policy(params).body["request"]) end end |