cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
next

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/smart-tiered-cache.ts

257lines · 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 SmartTieredCache extends APIResource {
7 /**
8 * Smart Tiered Cache dynamically selects the single closest upper tier for each of
9 * your website's origins with no configuration required, using our in-house
10 * performance and routing data. Cloudflare collects latency data for each request
11 * to an origin, and uses the latency data to determine how well any upper-tier
12 * data center is connected with an origin. As a result, Cloudflare can select the
13 * data center with the lowest latency to be the upper-tier for an origin.
14 *
15 * @example
16 * ```ts
17 * const smartTieredCache =
18 * await client.cache.smartTieredCache.create({
19 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
20 * value: 'on',
21 * });
22 * ```
23 */
24 create(
25 params: SmartTieredCacheCreateParams,
26 options?: Core.RequestOptions,
27 ): Core.APIPromise<SmartTieredCacheCreateResponse> {
28 const { zone_id, ...body } = params;
29 return (
30 this._client.post(`/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, {
31 body,
32 ...options,
33 }) as Core.APIPromise<{ result: SmartTieredCacheCreateResponse }>
34 )._thenUnwrap((obj) => obj.result);
35 }
36
37 /**
38 * Smart Tiered Cache dynamically selects the single closest upper tier for each of
39 * your website’s origins with no configuration required, using our in-house
40 * performance and routing data. Cloudflare collects latency data for each request
41 * to an origin, and uses the latency data to determine how well any upper-tier
42 * data center is connected with an origin. As a result, Cloudflare can select the
43 * data center with the lowest latency to be the upper-tier for an origin.
44 *
45 * @example
46 * ```ts
47 * const smartTieredCache =
48 * await client.cache.smartTieredCache.delete({
49 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
50 * });
51 * ```
52 */
53 delete(
54 params: SmartTieredCacheDeleteParams,
55 options?: Core.RequestOptions,
56 ): Core.APIPromise<SmartTieredCacheDeleteResponse> {
57 const { zone_id } = params;
58 return (
59 this._client.delete(
60 `/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`,
61 options,
62 ) as Core.APIPromise<{ result: SmartTieredCacheDeleteResponse }>
63 )._thenUnwrap((obj) => obj.result);
64 }
65
66 /**
67 * Smart Tiered Cache dynamically selects the single closest upper tier for each of
68 * your website’s origins with no configuration required, using our in-house
69 * performance and routing data. Cloudflare collects latency data for each request
70 * to an origin, and uses the latency data to determine how well any upper-tier
71 * data center is connected with an origin. As a result, Cloudflare can select the
72 * data center with the lowest latency to be the upper-tier for an origin.
73 *
74 * @example
75 * ```ts
76 * const response = await client.cache.smartTieredCache.edit({
77 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
78 * value: 'on',
79 * });
80 * ```
81 */
82 edit(
83 params: SmartTieredCacheEditParams,
84 options?: Core.RequestOptions,
85 ): Core.APIPromise<SmartTieredCacheEditResponse> {
86 const { zone_id, ...body } = params;
87 return (
88 this._client.patch(`/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, {
89 body,
90 ...options,
91 }) as Core.APIPromise<{ result: SmartTieredCacheEditResponse }>
92 )._thenUnwrap((obj) => obj.result);
93 }
94
95 /**
96 * Smart Tiered Cache dynamically selects the single closest upper tier for each of
97 * your website’s origins with no configuration required, using our in-house
98 * performance and routing data. Cloudflare collects latency data for each request
99 * to an origin, and uses the latency data to determine how well any upper-tier
100 * data center is connected with an origin. As a result, Cloudflare can select the
101 * data center with the lowest latency to be the upper-tier for an origin.
102 *
103 * @example
104 * ```ts
105 * const smartTieredCache =
106 * await client.cache.smartTieredCache.get({
107 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
108 * });
109 * ```
110 */
111 get(
112 params: SmartTieredCacheGetParams,
113 options?: Core.RequestOptions,
114 ): Core.APIPromise<SmartTieredCacheGetResponse> {
115 const { zone_id } = params;
116 return (
117 this._client.get(
118 `/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`,
119 options,
120 ) as Core.APIPromise<{ result: SmartTieredCacheGetResponse }>
121 )._thenUnwrap((obj) => obj.result);
122 }
123}
124
125export interface SmartTieredCacheCreateResponse {
126 /**
127 * The identifier of the caching setting.
128 */
129 id: 'tiered_cache_smart_topology_enable';
130
131 /**
132 * Whether the setting is editable.
133 */
134 editable: boolean;
135
136 /**
137 * Value of the Smart Tiered Cache zone setting.
138 */
139 value: 'on' | 'off';
140
141 /**
142 * Last time this setting was modified.
143 */
144 modified_on?: string | null;
145}
146
147export interface SmartTieredCacheDeleteResponse {
148 /**
149 * The identifier of the caching setting.
150 */
151 id: 'tiered_cache_smart_topology_enable';
152
153 /**
154 * Whether the setting is editable.
155 */
156 editable: boolean;
157
158 /**
159 * Last time this setting was modified.
160 */
161 modified_on?: string | null;
162}
163
164export interface SmartTieredCacheEditResponse {
165 /**
166 * The identifier of the caching setting.
167 */
168 id: 'tiered_cache_smart_topology_enable';
169
170 /**
171 * Whether the setting is editable.
172 */
173 editable: boolean;
174
175 /**
176 * Value of the Smart Tiered Cache zone setting.
177 */
178 value: 'on' | 'off';
179
180 /**
181 * Last time this setting was modified.
182 */
183 modified_on?: string | null;
184}
185
186export interface SmartTieredCacheGetResponse {
187 /**
188 * The identifier of the caching setting.
189 */
190 id: 'tiered_cache_smart_topology_enable';
191
192 /**
193 * Whether the setting is editable.
194 */
195 editable: boolean;
196
197 /**
198 * Value of the Smart Tiered Cache zone setting.
199 */
200 value: 'on' | 'off';
201
202 /**
203 * Last time this setting was modified.
204 */
205 modified_on?: string | null;
206}
207
208export interface SmartTieredCacheCreateParams {
209 /**
210 * Path param: Identifier.
211 */
212 zone_id: string;
213
214 /**
215 * Body param: Enable or disable the Smart Tiered Cache.
216 */
217 value: 'on' | 'off';
218}
219
220export interface SmartTieredCacheDeleteParams {
221 /**
222 * Identifier.
223 */
224 zone_id: string;
225}
226
227export interface SmartTieredCacheEditParams {
228 /**
229 * Path param: Identifier.
230 */
231 zone_id: string;
232
233 /**
234 * Body param: Enable or disable the Smart Tiered Cache.
235 */
236 value: 'on' | 'off';
237}
238
239export interface SmartTieredCacheGetParams {
240 /**
241 * Identifier.
242 */
243 zone_id: string;
244}
245
246export declare namespace SmartTieredCache {
247 export {
248 type SmartTieredCacheCreateResponse as SmartTieredCacheCreateResponse,
249 type SmartTieredCacheDeleteResponse as SmartTieredCacheDeleteResponse,
250 type SmartTieredCacheEditResponse as SmartTieredCacheEditResponse,
251 type SmartTieredCacheGetResponse as SmartTieredCacheGetResponse,
252 type SmartTieredCacheCreateParams as SmartTieredCacheCreateParams,
253 type SmartTieredCacheDeleteParams as SmartTieredCacheDeleteParams,
254 type SmartTieredCacheEditParams as SmartTieredCacheEditParams,
255 type SmartTieredCacheGetParams as SmartTieredCacheGetParams,
256 };
257}
258