1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
# Webhooks
## Setup
To interact with the webhooks of a group's scaling policy, you will need to setup the group and policy objects beforehand.
```php
$groupId = 'foo';
$policyId = 'bar';
$group = $service->getGroup($groupId);
$policy = $group->getPolicy($policyId);
```
For more information about setting up the `$service` object, please see the userguide tutorial for [Autoscale groups]().
## Get all webhooks
```php
$webhooks = $policy->getWebookList();
```
## Create a new webhook
```php
$policy->getWebhook()->create(array(
(object) array(
'name' => 'Alice',
'metadata' => array(
'firstKey' => 'foo',
'secondKey' => 'bar'
)
)
));
```
## Get, update and delete an individual webhook
```php
$webhookId = 'baz';
$webhook = $policy->getWebhook($webhookId);
// Update the metadata
$metadata = $webhook->metadata;
$metadata->thirdKey = 'blah';
$webhook->update(array(
'metadata' => $metadata
));
// Delete it
$webhook->delete();
```
|