cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v5.1.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

191lines · 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.delete({
19 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
20 * });
21 * ```
22 */
23 delete(
24 params: SmartTieredCacheDeleteParams,
25 options?: Core.RequestOptions,
26 ): Core.APIPromise<SmartTieredCacheDeleteResponse> {
27 const { zone_id } = params;
28 return (
29 this._client.delete(
30 `/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`,
31 options,
32 ) as Core.APIPromise<{ result: SmartTieredCacheDeleteResponse }>
33 )._thenUnwrap((obj) => obj.result);
34 }
35
36 /**
37 * Smart Tiered Cache dynamically selects the single closest upper tier for each of
38 * your website’s origins with no configuration required, using our in-house
39 * performance and routing data. Cloudflare collects latency data for each request
40 * to an origin, and uses the latency data to determine how well any upper-tier
41 * data center is connected with an origin. As a result, Cloudflare can select the
42 * data center with the lowest latency to be the upper-tier for an origin.
43 *
44 * @example
45 * ```ts
46 * const response = await client.cache.smartTieredCache.edit({
47 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
48 * value: 'on',
49 * });
50 * ```
51 */
52 edit(
53 params: SmartTieredCacheEditParams,
54 options?: Core.RequestOptions,
55 ): Core.APIPromise<SmartTieredCacheEditResponse> {
56 const { zone_id, ...body } = params;
57 return (
58 this._client.patch(`/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, {
59 body,
60 ...options,
61 }) as Core.APIPromise<{ result: SmartTieredCacheEditResponse }>
62 )._thenUnwrap((obj) => obj.result);
63 }
64
65 /**
66 * Smart Tiered Cache dynamically selects the single closest upper tier for each of
67 * your website’s origins with no configuration required, using our in-house
68 * performance and routing data. Cloudflare collects latency data for each request
69 * to an origin, and uses the latency data to determine how well any upper-tier
70 * data center is connected with an origin. As a result, Cloudflare can select the
71 * data center with the lowest latency to be the upper-tier for an origin.
72 *
73 * @example
74 * ```ts
75 * const smartTieredCache =
76 * await client.cache.smartTieredCache.get({
77 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
78 * });
79 * ```
80 */
81 get(
82 params: SmartTieredCacheGetParams,
83 options?: Core.RequestOptions,
84 ): Core.APIPromise<SmartTieredCacheGetResponse> {
85 const { zone_id } = params;
86 return (
87 this._client.get(
88 `/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`,
89 options,
90 ) as Core.APIPromise<{ result: SmartTieredCacheGetResponse }>
91 )._thenUnwrap((obj) => obj.result);
92 }
93}
94
95export interface SmartTieredCacheDeleteResponse {
96 /**
97 * The identifier of the caching setting.
98 */
99 id: 'tiered_cache_smart_topology_enable';
100
101 /**
102 * Whether the setting is editable.
103 */
104 editable: boolean;
105
106 /**
107 * Last time this setting was modified.
108 */
109 modified_on?: string | null;
110}
111
112export interface SmartTieredCacheEditResponse {
113 /**
114 * The identifier of the caching setting.
115 */
116 id: 'tiered_cache_smart_topology_enable';
117
118 /**
119 * Whether the setting is editable.
120 */
121 editable: boolean;
122
123 /**
124 * Value of the Smart Tiered Cache zone setting.
125 */
126 value: 'on' | 'off';
127
128 /**
129 * Last time this setting was modified.
130 */
131 modified_on?: string | null;
132}
133
134export interface SmartTieredCacheGetResponse {
135 /**
136 * The identifier of the caching setting.
137 */
138 id: 'tiered_cache_smart_topology_enable';
139
140 /**
141 * Whether the setting is editable.
142 */
143 editable: boolean;
144
145 /**
146 * Value of the Smart Tiered Cache zone setting.
147 */
148 value: 'on' | 'off';
149
150 /**
151 * Last time this setting was modified.
152 */
153 modified_on?: string | null;
154}
155
156export interface SmartTieredCacheDeleteParams {
157 /**
158 * Identifier.
159 */
160 zone_id: string;
161}
162
163export interface SmartTieredCacheEditParams {
164 /**
165 * Path param: Identifier.
166 */
167 zone_id: string;
168
169 /**
170 * Body param: Enable or disable the Smart Tiered Cache.
171 */
172 value: 'on' | 'off';
173}
174
175export interface SmartTieredCacheGetParams {
176 /**
177 * Identifier.
178 */
179 zone_id: string;
180}
181
182export declare namespace SmartTieredCache {
183 export {
184 type SmartTieredCacheDeleteResponse as SmartTieredCacheDeleteResponse,
185 type SmartTieredCacheEditResponse as SmartTieredCacheEditResponse,
186 type SmartTieredCacheGetResponse as SmartTieredCacheGetResponse,
187 type SmartTieredCacheDeleteParams as SmartTieredCacheDeleteParams,
188 type SmartTieredCacheEditParams as SmartTieredCacheEditParams,
189 type SmartTieredCacheGetParams as SmartTieredCacheGetParams,
190 };
191}
192