cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/api-gateway/schema-validation.ts
59lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import * as Core from '../../core'; |
| 4 | import { APIResource } from '../../resource'; |
| 5 | import * as SchemaValidationAPI from './schema-validation'; |
| 6 | import * as SettingsSchemaValidationAPI from './settings/schema-validation'; |
| 7 | |
| 8 | export class SchemaValidation extends APIResource { |
| 9 | /** |
| 10 | * Updates zone level schema validation settings on the zone |
| 11 | */ |
| 12 | edit( |
| 13 | params: SchemaValidationEditParams, |
| 14 | options?: Core.RequestOptions, |
| 15 | ): Core.APIPromise<SettingsSchemaValidationAPI.Settings> { |
| 16 | const { zone_id, ...body } = params; |
| 17 | return this._client.patch(`/zones/${zone_id}/api_gateway/settings/schema_validation`, { |
| 18 | body, |
| 19 | ...options, |
| 20 | }); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | export interface SchemaValidationEditParams { |
| 25 | /** |
| 26 | * Path param: Identifier |
| 27 | */ |
| 28 | zone_id: string; |
| 29 | |
| 30 | /** |
| 31 | * Body param: The default mitigation action used when there is no mitigation |
| 32 | * action defined on the operation Mitigation actions are as follows: |
| 33 | * |
| 34 | * - `log` - log request when request does not conform to schema |
| 35 | * - `block` - deny access to the site when request does not conform to schema |
| 36 | * |
| 37 | * A special value of of `none` will skip running schema validation entirely for |
| 38 | * the request when there is no mitigation action defined on the operation |
| 39 | * |
| 40 | * `null` will have no effect. |
| 41 | */ |
| 42 | validation_default_mitigation_action?: 'none' | 'log' | 'block' | null; |
| 43 | |
| 44 | /** |
| 45 | * Body param: When set, this overrides both zone level and operation level |
| 46 | * mitigation actions. |
| 47 | * |
| 48 | * - `none` will skip running schema validation entirely for the request |
| 49 | * |
| 50 | * To clear any override, use the special value `disable_override` |
| 51 | * |
| 52 | * `null` will have no effect. |
| 53 | */ |
| 54 | validation_override_mitigation_action?: 'none' | 'disable_override' | null; |
| 55 | } |
| 56 | |
| 57 | export namespace SchemaValidation { |
| 58 | export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams; |
| 59 | } |
| 60 | |