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