Create webhook
requires attribute: :name
@return [Boolean] returns true if webhook is being created
@raise [Fog::Rackspace::AutoScale:::NotFound] - HTTP 404 @raise [Fog::Rackspace::AutoScale:::BadRequest] - HTTP 400 @raise [Fog::Rackspace::AutoScale:::InternalServerError] - HTTP 500 @raise [Fog::Rackspace::AutoScale:::ServiceError]
@see Fog::Rackspace::AutoScale::Webhooks#create @see
# File lib/fog/rackspace/models/auto_scale/webhook.rb, line 43 def create requires :name options = {} options['name'] = name if name options['metadata'] = metadata if metadata data = service.create_webhook(group.id, policy.id, options) merge_attributes(data.body['webhooks'][0]) true end
Destroy the webhook
@return [Boolean] returns true if webhook has started deleting
@raise [Fog::Rackspace::AutoScale:::NotFound] - HTTP 404 @raise [Fog::Rackspace::AutoScale:::BadRequest] - HTTP 400 @raise [Fog::Rackspace::AutoScale:::InternalServerError] - HTTP 500 @raise [Fog::Rackspace::AutoScale:::ServiceError]
# File lib/fog/rackspace/models/auto_scale/webhook.rb, line 100 def destroy requires :identity service.delete_webhook(group.id, policy.id, identity) true end
Retrieves the URL for anonymously executing the policy webhook @return [String] the URL
# File lib/fog/rackspace/models/auto_scale/webhook.rb, line 108 def execution_url requires :links link = links.find { |l| l['rel'] == 'capability' } link['href'] rescue nil end
Saves the webhook Creates hook if it is new, otherwise it will update it @return [Boolean] true if policy has saved
# File lib/fog/rackspace/models/auto_scale/webhook.rb, line 81 def save if persisted? update else create end true end
Updates the webhook
@return [Boolean] returns true if webhook has started updating
@raise [Fog::Rackspace::AutoScale:::NotFound] - HTTP 404 @raise [Fog::Rackspace::AutoScale:::BadRequest] - HTTP 400 @raise [Fog::Rackspace::AutoScale:::InternalServerError] - HTTP 500 @raise [Fog::Rackspace::AutoScale:::ServiceError]
# File lib/fog/rackspace/models/auto_scale/webhook.rb, line 65 def update requires :identity options = { 'name' => name, 'metadata' => metadata } data = service.update_webhook(group.id, policy.id, identity, options) merge_attributes(data.body) true end