cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v4.1.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/cache-reserve.ts

262lines · 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 CacheReserveResource extends APIResource {
7 /**
8 * You can use Cache Reserve Clear to clear your Cache Reserve, but you must first
9 * disable Cache Reserve. In most cases, this will be accomplished within 24 hours.
10 * You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind
11 * that you cannot undo or cancel this operation.
12 */
13 clear(
14 params: CacheReserveClearParams,
15 options?: Core.RequestOptions,
16 ): Core.APIPromise<CacheReserveClearResponse> {
17 const { zone_id, body } = params;
18 return (
19 this._client.post(`/zones/${zone_id}/cache/cache_reserve_clear`, {
20 body: body,
21 ...options,
22 }) as Core.APIPromise<{ result: CacheReserveClearResponse }>
23 )._thenUnwrap((obj) => obj.result);
24 }
25
26 /**
27 * Increase cache lifetimes by automatically storing all cacheable files into
28 * Cloudflare's persistent object storage buckets. Requires Cache Reserve
29 * subscription. Note: using Tiered Cache with Cache Reserve is highly recommended
30 * to reduce Reserve operations costs. See the
31 * [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve)
32 * for more information.
33 */
34 edit(
35 params: CacheReserveEditParams,
36 options?: Core.RequestOptions,
37 ): Core.APIPromise<CacheReserveEditResponse> {
38 const { zone_id, ...body } = params;
39 return (
40 this._client.patch(`/zones/${zone_id}/cache/cache_reserve`, { body, ...options }) as Core.APIPromise<{
41 result: CacheReserveEditResponse;
42 }>
43 )._thenUnwrap((obj) => obj.result);
44 }
45
46 /**
47 * Increase cache lifetimes by automatically storing all cacheable files into
48 * Cloudflare's persistent object storage buckets. Requires Cache Reserve
49 * subscription. Note: using Tiered Cache with Cache Reserve is highly recommended
50 * to reduce Reserve operations costs. See the
51 * [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve)
52 * for more information.
53 */
54 get(
55 params: CacheReserveGetParams,
56 options?: Core.RequestOptions,
57 ): Core.APIPromise<CacheReserveGetResponse> {
58 const { zone_id } = params;
59 return (
60 this._client.get(`/zones/${zone_id}/cache/cache_reserve`, options) as Core.APIPromise<{
61 result: CacheReserveGetResponse;
62 }>
63 )._thenUnwrap((obj) => obj.result);
64 }
65
66 /**
67 * You can use Cache Reserve Clear to clear your Cache Reserve, but you must first
68 * disable Cache Reserve. In most cases, this will be accomplished within 24 hours.
69 * You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind
70 * that you cannot undo or cancel this operation.
71 */
72 status(
73 params: CacheReserveStatusParams,
74 options?: Core.RequestOptions,
75 ): Core.APIPromise<CacheReserveStatusResponse> {
76 const { zone_id } = params;
77 return (
78 this._client.get(`/zones/${zone_id}/cache/cache_reserve_clear`, options) as Core.APIPromise<{
79 result: CacheReserveStatusResponse;
80 }>
81 )._thenUnwrap((obj) => obj.result);
82 }
83}
84
85/**
86 * ID of the zone setting.
87 */
88export type CacheReserve = 'cache_reserve';
89
90/**
91 * ID of the zone setting.
92 */
93export type CacheReserveClear = 'cache_reserve_clear';
94
95/**
96 * The current state of the Cache Reserve Clear operation.
97 */
98export type State = 'In-progress' | 'Completed';
99
100/**
101 * You can use Cache Reserve Clear to clear your Cache Reserve, but you must first
102 * disable Cache Reserve. In most cases, this will be accomplished within 24 hours.
103 * You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind
104 * that you cannot undo or cancel this operation.
105 */
106export interface CacheReserveClearResponse {
107 /**
108 * ID of the zone setting.
109 */
110 id: CacheReserveClear;
111
112 /**
113 * The time that the latest Cache Reserve Clear operation started.
114 */
115 start_ts: string;
116
117 /**
118 * The current state of the Cache Reserve Clear operation.
119 */
120 state: State;
121
122 /**
123 * The time that the latest Cache Reserve Clear operation completed.
124 */
125 end_ts?: string;
126
127 /**
128 * Last time this setting was modified.
129 */
130 modified_on?: string | null;
131}
132
133export interface CacheReserveEditResponse {
134 /**
135 * ID of the zone setting.
136 */
137 id: CacheReserve;
138
139 /**
140 * Whether the setting is editable
141 */
142 editable: boolean;
143
144 /**
145 * The value of the feature
146 */
147 value: 'on' | 'off';
148
149 /**
150 * Last time this setting was modified.
151 */
152 modified_on?: string | null;
153}
154
155export interface CacheReserveGetResponse {
156 /**
157 * ID of the zone setting.
158 */
159 id: CacheReserve;
160
161 /**
162 * Whether the setting is editable
163 */
164 editable: boolean;
165
166 /**
167 * The value of the feature
168 */
169 value: 'on' | 'off';
170
171 /**
172 * Last time this setting was modified.
173 */
174 modified_on?: string | null;
175}
176
177/**
178 * You can use Cache Reserve Clear to clear your Cache Reserve, but you must first
179 * disable Cache Reserve. In most cases, this will be accomplished within 24 hours.
180 * You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind
181 * that you cannot undo or cancel this operation.
182 */
183export interface CacheReserveStatusResponse {
184 /**
185 * ID of the zone setting.
186 */
187 id: CacheReserveClear;
188
189 /**
190 * The time that the latest Cache Reserve Clear operation started.
191 */
192 start_ts: string;
193
194 /**
195 * The current state of the Cache Reserve Clear operation.
196 */
197 state: State;
198
199 /**
200 * The time that the latest Cache Reserve Clear operation completed.
201 */
202 end_ts?: string;
203
204 /**
205 * Last time this setting was modified.
206 */
207 modified_on?: string | null;
208}
209
210export interface CacheReserveClearParams {
211 /**
212 * Path param: Identifier
213 */
214 zone_id: string;
215
216 /**
217 * Body param:
218 */
219 body: unknown;
220}
221
222export interface CacheReserveEditParams {
223 /**
224 * Path param: Identifier
225 */
226 zone_id: string;
227
228 /**
229 * Body param: Value of the Cache Reserve zone setting.
230 */
231 value: 'on' | 'off';
232}
233
234export interface CacheReserveGetParams {
235 /**
236 * Identifier
237 */
238 zone_id: string;
239}
240
241export interface CacheReserveStatusParams {
242 /**
243 * Identifier
244 */
245 zone_id: string;
246}
247
248export declare namespace CacheReserveResource {
249 export {
250 type CacheReserve as CacheReserve,
251 type CacheReserveClear as CacheReserveClear,
252 type State as State,
253 type CacheReserveClearResponse as CacheReserveClearResponse,
254 type CacheReserveEditResponse as CacheReserveEditResponse,
255 type CacheReserveGetResponse as CacheReserveGetResponse,
256 type CacheReserveStatusResponse as CacheReserveStatusResponse,
257 type CacheReserveClearParams as CacheReserveClearParams,
258 type CacheReserveEditParams as CacheReserveEditParams,
259 type CacheReserveGetParams as CacheReserveGetParams,
260 type CacheReserveStatusParams as CacheReserveStatusParams,
261 };
262}
263