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