cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
vaishak/changelog3

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/api-gateway/configurations.ts

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