Adds a webhook to the specified policy.
183792
def add_webhook(self, policy, name, metadata=None):
        
        return self.manager.add_webhook(self, policy, name, metadata=metadata)
1166842
public void addPolicy(Policy policy) throws PolicyException {

        // Add BlueprintPolicy
        if (policy instanceof BlueprintPolicy) {
            if (erectors.get(policy.getTarget()) == null) {
                throw new PolicyException("Blueprint does not exist for BlueprintPolicy target: " + policy.getTarget());
            }

            List<BlueprintPolicy> policies = blueprintPolicies.get(policy.getTarget());
            if (policies == null) {
                policies = new ArrayList<BlueprintPolicy>();
            }

            policies.add((BlueprintPolicy) policy);

            logger.info("Setting BlueprintPolicy {} for {}", policy, policy.getTarget());

            blueprintPolicies.put(policy.getTarget(), policies);

            // Add FieldPolicy
        } else if (policy instanceof FieldPolicy) {

            // XXX: force FieldPolicy's to be mapped to a blueprint? Limits their scope, but enables validation
            if (erectors.get(policy.getTarget()) == null) {
                throw new PolicyException("Blueprint does not exist for FieldPolicy target: " + policy.getTarget());
            }

            List<FieldPolicy> policies = fieldPolicies.get(policy.getTarget());
            if (policies == null) {
                policies = new ArrayList<FieldPolicy>();
            }

            policies.add((FieldPolicy) policy);

            logger.info("Setting FieldPolicy {} for {}", policy, policy.getTarget());

            fieldPolicies.put(policy.getTarget(), policies);
        }
    }
386222
def put(self, request, bot_id, id, format=None):
              
        return super(HookDetail, self).put(request, bot_id, id, format)
326568
def deleteWebhook(self, hook_id):
        """"""
        path = '/'.join(['notification', 'webhook', hook_id])
        return self.rachio.delete(path)
853775
def replace_webhook(self, scaling_group, policy, webhook, name,
            metadata=None):
        
        uri = "/%s/%s/policies/%s/webhooks/%s" % (self.uri_base,
                utils.get_id(scaling_group), utils.get_id(policy),
                utils.get_id(webhook))
        group_id = utils.get_id(scaling_group)
        policy_id = utils.get_id(policy)
        webhook_id = utils.get_id(webhook)
        body = self._create_webhook_body(name, metadata=metadata)
        resp, resp_body = self.api.method_put(uri, body=body)
961174
def update_webhook_metadata(self, policy, webhook, metadata):
        
        return self.manager.update_webhook_metadata(self, policy, webhook,
                metadata)
877839
def add_policy(self, scaling_group, name, policy_type, cooldown,
            change=None, is_percent=False, desired_capacity=None, args=None):
        
        uri = "/%s/%s/policies" % (self.uri_base, utils.get_id(scaling_group))
        body = self._create_policy_body(name, policy_type, cooldown,
                change=change, is_percent=is_percent,
                desired_capacity=desired_capacity, args=args)
        # "body" needs to be a list
        body = [body]
        resp, resp_body = self.api.method_post(uri, body=body)
        pol_info = resp_body.get("policies")[0]
        return AutoScalePolicy(self, pol_info, scaling_group)
162549
public void addPolicy(final Enum name, final ExpirationPolicy policy) {
        LOGGER.trace("Adding expiration policy [{}] with name [{}]", policy, name);
        addPolicy(name.name(), policy);
    }
693370
function(webhookId, callback) {
      utils.debug('Webhooks disable: ' + webhookId);
      request.post({
        path: '/webhooks/' + utils.toUUID(webhookId) + '/deactivate',
      }, callback || utils.nop);
    }
433040
def _put_bucket_policy(self):
        """"""
        if self.s3props['bucket_policy']:
            policy_str = json.dumps(self.s3props['bucket_policy'])
            _response = self.s3client.put_bucket_policy(Bucket=self.bucket, Policy=policy_str)
        else:
            _response = self.s3client.delete_bucket_policy(Bucket=self.bucket)
        LOG.debug('Response adding bucket policy: %s', _response)
        LOG.info('S3 Bucket Policy Attached')
913022
def update_webhook_metadata(self, scaling_group, policy, webhook, metadata):
        
        return self._manager.update_webhook_metadata(scaling_group, policy,
                webhook, metadata)
748543
function addHook(hooks, type, weight, hook) {
    const length = arguments.length;
    let start = 2;

    if (typeof type !== 'string') {
        const err = Error('Expected first parameter to be a string. Received: ' + type);
        err.code = 'ESHOOK';
        throw err;
    }

    // handle variable input parameters
    if (typeof arguments[2] === 'number') {
        start = 3;
    } else {
        weight = 0;
    }

    if (!hooks[type]) hooks[type] = [];
    const store = hooks[type];
    for (let i = start; i < length; i++) {
        const hook = arguments[i];
        if (typeof hook !== 'function') {
            const err = Error('Invalid hook specified. Expected a function. Received: ' + hook);
            err.code = 'ESHOOK';
            throw err;
        }
        store.push({ weight: weight, hook: hook });
    }

    return this;
}
839840
public void addPolicies(final @NonNull RegisteredServiceSingleSignOnParticipationPolicy... policy) {
        policies.addAll(Arrays.stream(policy).collect(Collectors.toList()));
    }
700993
public void addOAuthParameter(String key, String value) {
        oauthParameters.put(checkKey(key), value);
    }
280155
def update!
      client.put("/webhooks/#{id}", {
        description: description,
        idModel: id_model,
        callbackURL: callback_url,
        active: active
      })
    end
700669
public void addShutdownHook() {
        shutdownHookThread = new Thread(new Runnable() {
            @Override
            public void run() {
                beforeShutdown();
            }
        });
        Runtime.getRuntime().addShutdownHook(shutdownHookThread);
    }
602727
def update_webhook(self, scaling_group, policy, webhook, name=None,
            metadata=None):
        
        return self._manager.update_webhook(scaling_group=scaling_group,
                policy=policy, webhook=webhook, name=name, metadata=metadata)