cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/ai-security/ai-security.ts
117lines · 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 | import * as CustomTopicsAPI from './custom-topics'; |
| 6 | import { |
| 7 | CustomTopicGetParams, |
| 8 | CustomTopicGetResponse, |
| 9 | CustomTopicUpdateParams, |
| 10 | CustomTopicUpdateResponse, |
| 11 | CustomTopics, |
| 12 | } from './custom-topics'; |
| 13 | |
| 14 | export class AISecurity extends APIResource { |
| 15 | customTopics: CustomTopicsAPI.CustomTopics = new CustomTopicsAPI.CustomTopics(this._client); |
| 16 | |
| 17 | /** |
| 18 | * Enable or disable AI Security for Apps for a zone. |
| 19 | * |
| 20 | * Changes can take up to a minute to propagate to the zone. |
| 21 | * |
| 22 | * @example |
| 23 | * ```ts |
| 24 | * const aiSecurity = await client.aiSecurity.update({ |
| 25 | * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 26 | * }); |
| 27 | * ``` |
| 28 | */ |
| 29 | update( |
| 30 | params: AISecurityUpdateParams, |
| 31 | options?: Core.RequestOptions, |
| 32 | ): Core.APIPromise<AISecurityUpdateResponse> { |
| 33 | const { zone_id, ...body } = params; |
| 34 | return ( |
| 35 | this._client.put(`/zones/${zone_id}/ai-security/settings`, { body, ...options }) as Core.APIPromise<{ |
| 36 | result: AISecurityUpdateResponse; |
| 37 | }> |
| 38 | )._thenUnwrap((obj) => obj.result); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Get whether AI Security for Apps is enabled or disabled for a zone. |
| 43 | * |
| 44 | * @example |
| 45 | * ```ts |
| 46 | * const aiSecurity = await client.aiSecurity.get({ |
| 47 | * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 48 | * }); |
| 49 | * ``` |
| 50 | */ |
| 51 | get(params: AISecurityGetParams, options?: Core.RequestOptions): Core.APIPromise<AISecurityGetResponse> { |
| 52 | const { zone_id } = params; |
| 53 | return ( |
| 54 | this._client.get(`/zones/${zone_id}/ai-security/settings`, options) as Core.APIPromise<{ |
| 55 | result: AISecurityGetResponse; |
| 56 | }> |
| 57 | )._thenUnwrap((obj) => obj.result); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * AI Security for Apps enablement status for a zone. |
| 63 | */ |
| 64 | export interface AISecurityUpdateResponse { |
| 65 | /** |
| 66 | * Whether AI Security for Apps is enabled on the zone. |
| 67 | */ |
| 68 | enabled?: boolean; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * AI Security for Apps enablement status for a zone. |
| 73 | */ |
| 74 | export interface AISecurityGetResponse { |
| 75 | /** |
| 76 | * Whether AI Security for Apps is enabled on the zone. |
| 77 | */ |
| 78 | enabled?: boolean; |
| 79 | } |
| 80 | |
| 81 | export interface AISecurityUpdateParams { |
| 82 | /** |
| 83 | * Path param: Defines the zone. |
| 84 | */ |
| 85 | zone_id: string; |
| 86 | |
| 87 | /** |
| 88 | * Body param: Whether AI Security for Apps is enabled on the zone. |
| 89 | */ |
| 90 | enabled?: boolean; |
| 91 | } |
| 92 | |
| 93 | export interface AISecurityGetParams { |
| 94 | /** |
| 95 | * Defines the zone. |
| 96 | */ |
| 97 | zone_id: string; |
| 98 | } |
| 99 | |
| 100 | AISecurity.CustomTopics = CustomTopics; |
| 101 | |
| 102 | export declare namespace AISecurity { |
| 103 | export { |
| 104 | type AISecurityUpdateResponse as AISecurityUpdateResponse, |
| 105 | type AISecurityGetResponse as AISecurityGetResponse, |
| 106 | type AISecurityUpdateParams as AISecurityUpdateParams, |
| 107 | type AISecurityGetParams as AISecurityGetParams, |
| 108 | }; |
| 109 | |
| 110 | export { |
| 111 | CustomTopics as CustomTopics, |
| 112 | type CustomTopicUpdateResponse as CustomTopicUpdateResponse, |
| 113 | type CustomTopicGetResponse as CustomTopicGetResponse, |
| 114 | type CustomTopicUpdateParams as CustomTopicUpdateParams, |
| 115 | type CustomTopicGetParams as CustomTopicGetParams, |
| 116 | }; |
| 117 | } |
| 118 | |