Class: Fog::Rackspace::AutoScale::Webhook
- Inherits:
-
Model
- Object
- Model
- Fog::Rackspace::AutoScale::Webhook
- Defined in:
- lib/fog/rackspace/models/auto_scale/webhook.rb
Instance Attribute Summary collapse
-
#group ⇒ String
readonly
The associated group.
-
#id ⇒ String
readonly
The webhook id.
-
#links ⇒ Array
readonly
The webhook links.
-
#metadata ⇒ Hash
readonly
The metadata.
-
#name ⇒ String
readonly
The webhook name.
-
#policy ⇒ String
readonly
The associated policy.
Instance Method Summary collapse
-
#create ⇒ Boolean
Create webhook * requires attribute: :name.
-
#destroy ⇒ Boolean
Destroy the webhook.
-
#execution_url ⇒ String
Retrieves the URL for anonymously executing the policy webhook.
-
#save ⇒ Boolean
Saves the webhook Creates hook if it is new, otherwise it will update it.
-
#update ⇒ Boolean
Updates the webhook.
Instance Attribute Details
#group ⇒ String (readonly)
Returns The associated group.
13 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 13 attribute :group |
#id ⇒ String (readonly)
Returns The webhook id.
9 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 9 identity :id |
#links ⇒ Array (readonly)
Returns The webhook links.
29 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 29 attribute :links |
#metadata ⇒ Hash (readonly)
Returns The metadata.
25 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 25 attribute :metadata |
#name ⇒ String (readonly)
Returns The webhook name.
21 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 21 attribute :name |
#policy ⇒ String (readonly)
Returns The associated policy.
17 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 17 attribute :policy |
Instance Method Details
#create ⇒ Boolean
Create webhook
-
requires attribute: :name
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 43 def create requires :name = {} ['name'] = name if name ['metadata'] = if data = service.create_webhook(group.id, policy.id, ) merge_attributes(data.body['webhooks'][0]) true end |
#destroy ⇒ Boolean
Destroy the webhook
100 101 102 103 104 |
# 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 ⇒ String
Retrieves the URL for anonymously executing the policy webhook
108 109 110 111 112 |
# 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 ⇒ Boolean
Saves the webhook Creates hook if it is new, otherwise it will update it
81 82 83 84 85 86 87 88 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 81 def save if persisted? update else create end true end |
#update ⇒ Boolean
Updates the webhook
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fog/rackspace/models/auto_scale/webhook.rb', line 65 def update requires :identity = { 'name' => name, 'metadata' => } data = service.update_webhook(group.id, policy.id, identity, ) merge_attributes(data.body) true end |