cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
dbca88fe6b02ed3ec95ec31aedae077fa82f3391

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/cache-reserve.ts

261lines · modecode

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