UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

63 lines • 2.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Alerting = exports.BaseAlerting = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseAlerting = /* @__PURE__ */ (() => { class BaseAlerting extends resource_1.APIResource { /** * Create or update the Certificate Transparency alerting subscription for a zone. * Enables or disables email notifications when certificates are issued for the * zone's domains. The `enabled` field is required on every request and controls * whether the subscription is active. The `emails` field is optional and, when * provided, replaces the stored recipient list for the zone. When `emails` is * omitted, the stored recipient list is preserved and only the enabled state is * toggled. A maximum of 100 email addresses may be configured per zone. Requests * that omit `enabled` are rejected with error code 1008. Subscribe and unsubscribe * notification emails are only sent for recipients whose effective subscription * state changes. Idempotent requests (no state change) send no notification email. * * @example * ```ts * const ctAlertingSubscription = * await client.zones.ct.alerting.edit({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * enabled: true, * }); * ``` */ edit(params, options) { const { zone_id, ...body } = params; return this._client.patch((0, path_1.path) `/zones/${zone_id}/ct/alerting`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieve the Certificate Transparency alerting subscription settings for a zone. * Returns whether CT monitoring is enabled and the list of email addresses that * receive alerts, if any have been configured. * * @example * ```ts * const ctAlertingSubscription = * await client.zones.ct.alerting.get({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ get(params, options) { const { zone_id } = params; return this._client.get((0, path_1.path) `/zones/${zone_id}/ct/alerting`, options)._thenUnwrap((obj) => obj.result); } } BaseAlerting._key = Object.freeze([ 'zones', 'ct', 'alerting', ]); return BaseAlerting; })(); exports.BaseAlerting = BaseAlerting; class Alerting extends BaseAlerting { } exports.Alerting = Alerting; //# sourceMappingURL=alerting.js.map