cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/alerting/available-alerts.ts
70lines · modecode
| 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 AvailableAlerts extends APIResource { |
| 7 | /** |
| 8 | * Gets a list of all alert types for which an account is eligible. |
| 9 | * |
| 10 | * @example |
| 11 | * ```ts |
| 12 | * const availableAlerts = |
| 13 | * await client.alerting.availableAlerts.list({ |
| 14 | * account_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 15 | * }); |
| 16 | * ``` |
| 17 | */ |
| 18 | list( |
| 19 | params: AvailableAlertListParams, |
| 20 | options?: Core.RequestOptions, |
| 21 | ): Core.APIPromise<AvailableAlertListResponse> { |
| 22 | const { account_id } = params; |
| 23 | return ( |
| 24 | this._client.get(`/accounts/${account_id}/alerting/v3/available_alerts`, options) as Core.APIPromise<{ |
| 25 | result: AvailableAlertListResponse; |
| 26 | }> |
| 27 | )._thenUnwrap((obj) => obj.result); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | export type AvailableAlertListResponse = { [key: string]: Array<AvailableAlertListResponse.Item> }; |
| 32 | |
| 33 | export namespace AvailableAlertListResponse { |
| 34 | export interface Item { |
| 35 | /** |
| 36 | * Describes the alert type. |
| 37 | */ |
| 38 | description?: string; |
| 39 | |
| 40 | /** |
| 41 | * Alert type name. |
| 42 | */ |
| 43 | display_name?: string; |
| 44 | |
| 45 | /** |
| 46 | * Format of additional configuration options (filters) for the alert type. Data |
| 47 | * type of filters during policy creation: Array of strings. |
| 48 | */ |
| 49 | filter_options?: Array<unknown>; |
| 50 | |
| 51 | /** |
| 52 | * Use this value when creating and updating a notification policy. |
| 53 | */ |
| 54 | type?: string; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | export interface AvailableAlertListParams { |
| 59 | /** |
| 60 | * The account id |
| 61 | */ |
| 62 | account_id: string; |
| 63 | } |
| 64 | |
| 65 | export declare namespace AvailableAlerts { |
| 66 | export { |
| 67 | type AvailableAlertListResponse as AvailableAlertListResponse, |
| 68 | type AvailableAlertListParams as AvailableAlertListParams, |
| 69 | }; |
| 70 | } |
| 71 | |