Webhooks.md
1008 Bytes
Webhooks
Setup
To interact with the webhooks of a group's scaling policy, you will need to setup the group and policy objects beforehand.
$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
$webhooks = $policy->getWebookList();
Create a new webhook
$policy->getWebhook()->create(array(
(object) array(
'name' => 'Alice',
'metadata' => array(
'firstKey' => 'foo',
'secondKey' => 'bar'
)
)
));
Get, update and delete an individual webhook
$webhookId = 'baz';
$webhook = $policy->getWebhook($webhookId);
// Update the metadata
$metadata = $webhook->metadata;
$metadata->thirdKey = 'blah';
$webhook->update(array(
'metadata' => $metadata
));
// Delete it
$webhook->delete();