1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/rackspace/models/auto_scale/webhooks.rb
jamiehannaford f4955dc207 Initial commit for Rackspace's new Autoscale features. Most functionality is incorporated, including:
- Scaling groups
- Configuration (group configuration and launch configuration)
- Scaling policies
- Webhooks

Work remaining includes:
- Mock request classes
- Unit test coverage
2013-08-28 13:49:03 +02:00

37 lines
No EOL
908 B
Ruby

require 'fog/core/collection'
require 'fog/rackspace/models/auto_scale/webhook'
module Fog
module Rackspace
class AutoScale
class Webhooks < Fog::Collection
model Fog::Rackspace::AutoScale::Webhook
attr_accessor :group_id
attr_accessor :policy_id
def all
data = service.list_webhooks(group_id, policy_id).body['webhooks']
load(data)
end
def get(webhook_id)
data = service.get_webhook(group_id, policy_id, webhook_id).body['webhook']
data['group_id'] = group_id
data['policy_id'] = policy_id
new(data)
rescue Fog::Rackspace::AutoScale::NotFound
nil
end
def create(attributes = {})
attributes['group_id'] = group_id
attributes['policy_id'] = policy_id
super(attributes)
end
end
end
end
end