Parent

Class/Module Index [+]

Quicksearch

Fog::Rackspace::AutoScale::Webhook

Public Instance Methods

create() click to toggle source

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 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() click to toggle source

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]

@see docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/DELETE_deleteWebhook_v1.0__tenantId__groups__groupId__policies__policyId__webhooks__webhookId__Webhooks.html

# 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
execution_url() click to toggle source

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
save() click to toggle source

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
update() click to toggle source

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]

@see docs.rackspace.com/cas/api/v1.0/autoscale-devguide/content/PUT_putWebhook_v1.0__tenantId__groups__groupId__policies__policyId__webhooks__webhookId__Webhooks.html

# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.