Class: Fog::Rackspace::AutoScale::Policies
- Inherits:
-
Collection
- Object
- Array
- Collection
- Fog::Rackspace::AutoScale::Policies
- Defined in:
- lib/fog/rackspace/models/auto_scale/policies.rb
Instance Attribute Summary collapse
-
#group ⇒ Object
Returns the value of attribute group.
Attributes inherited from Collection
Instance Method Summary collapse
-
#all ⇒ Fog::Rackspace::AutoScale::Policies
Returns list of autoscale policies.
-
#create(attributes = {}) ⇒ Fog::Rackspace::AutoScale::Policy
Create an autoscale policy.
-
#get(policy_id) ⇒ Fog::Rackspace::AutoScale::Group
Returns an individual autoscale policy.
- #new(attributes = {}) ⇒ Object
Methods inherited from Collection
#clear, #destroy, #initialize, #inspect, #load, model, #model, #reload, #table, #to_json
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Collection
Instance Attribute Details
#group ⇒ Object
Returns the value of attribute group.
11 12 13 |
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 11 def group @group end |
Instance Method Details
#all ⇒ Fog::Rackspace::AutoScale::Policies
Returns list of autoscale policies
23 24 25 26 |
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 23 def all data = service.list_policies(group.id).body['policies'] load(data) end |
#create(attributes = {}) ⇒ Fog::Rackspace::AutoScale::Policy
Create an autoscale policy
56 57 58 |
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 56 def create(attributes = {}) super(attributes) end |
#get(policy_id) ⇒ Fog::Rackspace::AutoScale::Group
Returns an individual autoscale policy
39 40 41 42 43 44 |
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 39 def get(policy_id) data = service.get_policy(group.id, policy_id).body['policy'] new(data) rescue Fog::Rackspace::AutoScale::NotFound nil end |
#new(attributes = {}) ⇒ Object
60 61 62 |
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 60 def new(attributes = {}) super({:group => group}.merge(attributes)) end |