cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v7

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/resources/alerting/available-alerts.ts

75lines · modecode

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