Class: Fog::Rackspace::AutoScale::Webhook

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

Instance Attribute Summary collapse

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

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::Model

Instance Attribute Details

#idString (readonly)

Returns The policy id (i.e. parent).

Returns:

  • (String)

    The policy id (i.e. parent)



# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 8

Returns The webhook links.

Returns:

  • (Array)

    The webhook links



30
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 30

attribute :links

#metadataHash (readonly)

Returns The metadata.

Returns:

  • (Hash)

    The metadata



26
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 26

attribute :metadata

#nameString (readonly)

Returns The webhook name.

Returns:

  • (String)

    The webhook name



# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 20

Instance Method Details

#destroyBoolean

Returns true if webhook has started deleting

Returns:

  • (Boolean)

    returns true if webhook has started deleting

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:



88
89
90
91
92
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 88

def destroy
	requires :identity 
	service.delete_webhook(group_id, policy_id, identity)
   true
end

#execution_urlString

Retrieves the URL for anonymously executing the policy webhook

Returns:



96
97
98
99
100
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 96

def execution_url
  requires :links
  link = links.find { |l| l['rel'] == 'capability' } 
  link['href'] rescue nil
end

#saveBoolean

Creates webhook

  • requires attribute: :name

Returns:

  • (Boolean)

    returns true if webhook is being created

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:



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 44

def save
  requires :name

  options = {}
  options['name'] = name if name
  options['metadata'] =  if 

  data = service.create_webhook(group_id, policy_id, options)
  merge_attributes(data.body['webhooks'][0])
  true
end

#updateBoolean

Returns true if webhook has started updating

Returns:

  • (Boolean)

    returns true if webhook has started updating

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:



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 66

def update
	requires :identity

	options = {
		'name' => name,
		'metadata' => 
	}

	data = service.update_webhook(group_id, policy_id, identity, options)
	merge_attributes(data.body)
end