|
| 1 | +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +import { APIResource } from '../../../resource'; |
| 4 | +import * as Core from '../../../core'; |
| 5 | + |
| 6 | +export class Alerting extends APIResource { |
| 7 | + /** |
| 8 | + * Create or update the Certificate Transparency alerting subscription for a zone. |
| 9 | + * Enables or disables email notifications when certificates are issued for the |
| 10 | + * zone's domains. For Free and Pro zones, the subscription is toggled on or off |
| 11 | + * using the enabled field. Notification emails are sent to all users with SSL |
| 12 | + * permissions on the zone. For Business and Enterprise zones, the emails field is |
| 13 | + * required and controls which addresses receive alerts. Setting emails to an empty |
| 14 | + * list disables the subscription regardless of the enabled field. A maximum of 10 |
| 15 | + * email addresses may be configured. |
| 16 | + * |
| 17 | + * @example |
| 18 | + * ```ts |
| 19 | + * const response = await client.zones.ct.alerting.edit({ |
| 20 | + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 21 | + * enabled: true, |
| 22 | + * }); |
| 23 | + * ``` |
| 24 | + */ |
| 25 | + edit(params: AlertingEditParams, options?: Core.RequestOptions): Core.APIPromise<AlertingEditResponse> { |
| 26 | + const { zone_id, ...body } = params; |
| 27 | + return ( |
| 28 | + this._client.patch(`/zones/${zone_id}/ct/alerting`, { body, ...options }) as Core.APIPromise<{ |
| 29 | + result: AlertingEditResponse; |
| 30 | + }> |
| 31 | + )._thenUnwrap((obj) => obj.result); |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * Retrieve the Certificate Transparency alerting subscription settings for a zone. |
| 36 | + * Returns whether CT monitoring is enabled and, for Business and Enterprise zones, |
| 37 | + * the list of email addresses that receive alerts. |
| 38 | + * |
| 39 | + * @example |
| 40 | + * ```ts |
| 41 | + * const alerting = await client.zones.ct.alerting.get({ |
| 42 | + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 43 | + * }); |
| 44 | + * ``` |
| 45 | + */ |
| 46 | + get(params: AlertingGetParams, options?: Core.RequestOptions): Core.APIPromise<AlertingGetResponse> { |
| 47 | + const { zone_id } = params; |
| 48 | + return ( |
| 49 | + this._client.get(`/zones/${zone_id}/ct/alerting`, options) as Core.APIPromise<{ |
| 50 | + result: AlertingGetResponse; |
| 51 | + }> |
| 52 | + )._thenUnwrap((obj) => obj.result); |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +/** |
| 57 | + * Certificate Transparency alerting subscription settings for a zone. |
| 58 | + */ |
| 59 | +export interface AlertingEditResponse { |
| 60 | + /** |
| 61 | + * Whether CT alerting is enabled for the zone. |
| 62 | + */ |
| 63 | + enabled: boolean; |
| 64 | + |
| 65 | + /** |
| 66 | + * Email addresses that receive CT alert notifications. Only present and |
| 67 | + * configurable for Business and Enterprise zones. Maximum of 10 addresses. For |
| 68 | + * Free and Pro zones, notifications are sent to all users with SSL permissions on |
| 69 | + * the zone. |
| 70 | + */ |
| 71 | + emails?: Array<string>; |
| 72 | +} |
| 73 | + |
| 74 | +/** |
| 75 | + * Certificate Transparency alerting subscription settings for a zone. |
| 76 | + */ |
| 77 | +export interface AlertingGetResponse { |
| 78 | + /** |
| 79 | + * Whether CT alerting is enabled for the zone. |
| 80 | + */ |
| 81 | + enabled: boolean; |
| 82 | + |
| 83 | + /** |
| 84 | + * Email addresses that receive CT alert notifications. Only present and |
| 85 | + * configurable for Business and Enterprise zones. Maximum of 10 addresses. For |
| 86 | + * Free and Pro zones, notifications are sent to all users with SSL permissions on |
| 87 | + * the zone. |
| 88 | + */ |
| 89 | + emails?: Array<string>; |
| 90 | +} |
| 91 | + |
| 92 | +export interface AlertingEditParams { |
| 93 | + /** |
| 94 | + * Path param: Identifier. |
| 95 | + */ |
| 96 | + zone_id: string; |
| 97 | + |
| 98 | + /** |
| 99 | + * Body param: Whether CT alerting is enabled for the zone. |
| 100 | + */ |
| 101 | + enabled: boolean; |
| 102 | + |
| 103 | + /** |
| 104 | + * Body param: Email addresses that receive CT alert notifications. Only present |
| 105 | + * and configurable for Business and Enterprise zones. Maximum of 10 addresses. For |
| 106 | + * Free and Pro zones, notifications are sent to all users with SSL permissions on |
| 107 | + * the zone. |
| 108 | + */ |
| 109 | + emails?: Array<string>; |
| 110 | +} |
| 111 | + |
| 112 | +export interface AlertingGetParams { |
| 113 | + /** |
| 114 | + * Identifier. |
| 115 | + */ |
| 116 | + zone_id: string; |
| 117 | +} |
| 118 | + |
| 119 | +export declare namespace Alerting { |
| 120 | + export { |
| 121 | + type AlertingEditResponse as AlertingEditResponse, |
| 122 | + type AlertingGetResponse as AlertingGetResponse, |
| 123 | + type AlertingEditParams as AlertingEditParams, |
| 124 | + type AlertingGetParams as AlertingGetParams, |
| 125 | + }; |
| 126 | +} |
0 commit comments