cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.3.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/api-gateway/configurations.ts

179lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import { APIResource } from '../../resource';
4import * as Core from '../../core';
5import * as UserSchemasAPI from './user-schemas/user-schemas';
6
7export class Configurations extends APIResource {
8 /**
9 * Set configuration properties
10 *
11 * @example
12 * ```ts
13 * const configuration =
14 * await client.apiGateway.configurations.update({
15 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
16 * auth_id_characteristics: [
17 * { name: 'authorization', type: 'header' },
18 * ],
19 * });
20 * ```
21 */
22 update(
23 params: ConfigurationUpdateParams,
24 options?: Core.RequestOptions,
25 ): Core.APIPromise<ConfigurationUpdateResponse> {
26 const { zone_id, ...body } = params;
27 return this._client.put(`/zones/${zone_id}/api_gateway/configuration`, { body, ...options });
28 }
29
30 /**
31 * Retrieve information about specific configuration properties
32 *
33 * @example
34 * ```ts
35 * const configuration =
36 * await client.apiGateway.configurations.get({
37 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
38 * });
39 * ```
40 */
41 get(params: ConfigurationGetParams, options?: Core.RequestOptions): Core.APIPromise<Configuration> {
42 const { zone_id, ...query } = params;
43 return (
44 this._client.get(`/zones/${zone_id}/api_gateway/configuration`, {
45 query,
46 ...options,
47 }) as Core.APIPromise<{ result: Configuration }>
48 )._thenUnwrap((obj) => obj.result);
49 }
50}
51
52export interface Configuration {
53 auth_id_characteristics: Array<
54 Configuration.APIShieldAuthIDCharacteristic | Configuration.APIShieldAuthIDCharacteristicJWTClaim
55 >;
56}
57
58export namespace Configuration {
59 /**
60 * Auth ID Characteristic
61 */
62 export interface APIShieldAuthIDCharacteristic {
63 /**
64 * The name of the characteristic field, i.e., the header or cookie name.
65 */
66 name: string;
67
68 /**
69 * The type of characteristic.
70 */
71 type: 'header' | 'cookie';
72 }
73
74 /**
75 * Auth ID Characteristic extracted from JWT Token Claims
76 */
77 export interface APIShieldAuthIDCharacteristicJWTClaim {
78 /**
79 * Claim location expressed as `$(token_config_id):$(json_path)`, where
80 * `token_config_id` is the ID of the token configuration used in validating the
81 * JWT, and `json_path` is a RFC 9535 JSONPath
82 * (https://goessner.net/articles/JsonPath/,
83 * https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in
84 * dot or bracket notation, may only specify literal keys or array indexes, and
85 * must return a singleton value, which will be interpreted as a string.
86 */
87 name: string;
88
89 /**
90 * The type of characteristic.
91 */
92 type: 'jwt';
93 }
94}
95
96export interface ConfigurationUpdateResponse {
97 errors: UserSchemasAPI.Message;
98
99 messages: UserSchemasAPI.Message;
100
101 /**
102 * Whether the API call was successful.
103 */
104 success: true;
105}
106
107export interface ConfigurationUpdateParams {
108 /**
109 * Path param: Identifier.
110 */
111 zone_id: string;
112
113 /**
114 * Body param:
115 */
116 auth_id_characteristics: Array<
117 | ConfigurationUpdateParams.APIShieldAuthIDCharacteristic
118 | ConfigurationUpdateParams.APIShieldAuthIDCharacteristicJWTClaim
119 >;
120}
121
122export namespace ConfigurationUpdateParams {
123 /**
124 * Auth ID Characteristic
125 */
126 export interface APIShieldAuthIDCharacteristic {
127 /**
128 * The name of the characteristic field, i.e., the header or cookie name.
129 */
130 name: string;
131
132 /**
133 * The type of characteristic.
134 */
135 type: 'header' | 'cookie';
136 }
137
138 /**
139 * Auth ID Characteristic extracted from JWT Token Claims
140 */
141 export interface APIShieldAuthIDCharacteristicJWTClaim {
142 /**
143 * Claim location expressed as `$(token_config_id):$(json_path)`, where
144 * `token_config_id` is the ID of the token configuration used in validating the
145 * JWT, and `json_path` is a RFC 9535 JSONPath
146 * (https://goessner.net/articles/JsonPath/,
147 * https://www.rfc-editor.org/rfc/rfc9535.html). The JSONPath expression may be in
148 * dot or bracket notation, may only specify literal keys or array indexes, and
149 * must return a singleton value, which will be interpreted as a string.
150 */
151 name: string;
152
153 /**
154 * The type of characteristic.
155 */
156 type: 'jwt';
157 }
158}
159
160export interface ConfigurationGetParams {
161 /**
162 * Path param: Identifier.
163 */
164 zone_id: string;
165
166 /**
167 * Query param: Requests information about certain properties.
168 */
169 properties?: Array<'auth_id_characteristics'>;
170}
171
172export declare namespace Configurations {
173 export {
174 type Configuration as Configuration,
175 type ConfigurationUpdateResponse as ConfigurationUpdateResponse,
176 type ConfigurationUpdateParams as ConfigurationUpdateParams,
177 type ConfigurationGetParams as ConfigurationGetParams,
178 };
179}
180