Class: Fog::Rackspace::AutoScale::Policies

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/rackspace/models/auto_scale/policies.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#groupObject

Returns the value of attribute group.



10
11
12
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 10

def group
  @group
end

Instance Method Details

#allFog::Rackspace::AutoScale::Policies

Returns list of autoscale policies

Returns:

Raises:

  • (Fog::Rackspace::AutoScale:::NotFound)
    • HTTP 404

  • (Fog::Rackspace::AutoScale:::BadRequest)
    • HTTP 400

  • (Fog::Rackspace::AutoScale:::InternalServerError)
    • HTTP 500

  • (Fog::Rackspace::AutoScale:::ServiceError)

See Also:



22
23
24
25
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 22

def all
  data = service.list_policies(group.id).body['policies']
  load(data)
end

#create(attributes = {}) ⇒ Fog::Rackspace::AutoScale::Policy

Create an autoscale policy

Returns:

Raises:

  • (Fog::Rackspace::AutoScale:::NotFound)
    • HTTP 404

  • (Fog::Rackspace::AutoScale:::BadRequest)
    • HTTP 400

  • (Fog::Rackspace::AutoScale:::InternalServerError)
    • HTTP 500

  • (Fog::Rackspace::AutoScale:::ServiceError)

See Also:



55
56
57
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 55

def create(attributes = {})
  super(attributes)
end

#get(policy_id) ⇒ Fog::Rackspace::AutoScale::Group

Returns an individual autoscale policy

Returns:

Raises:

  • (Fog::Rackspace::AutoScale:::NotFound)
    • HTTP 404

  • (Fog::Rackspace::AutoScale:::BadRequest)
    • HTTP 400

  • (Fog::Rackspace::AutoScale:::InternalServerError)
    • HTTP 500

  • (Fog::Rackspace::AutoScale:::ServiceError)

See Also:



38
39
40
41
42
43
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 38

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



59
60
61
# File 'lib/fog/rackspace/models/auto_scale/policies.rb', line 59

def new(attributes = {})
  super({:group => group}.merge(attributes))
end