cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v3.0.0-beta.13

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/cache-reserve.ts

243lines · 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 CacheReserve 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 } = params;
19 return (
20 this._client.post(`/zones/${zone_id}/cache/cache_reserve_clear`, options) as Core.APIPromise<{
21 result: CacheReserveClearResponse;
22 }>
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 * You can use Cache Reserve Clear to clear your Cache Reserve, but you must first
87 * disable Cache Reserve. In most cases, this will be accomplished within 24 hours.
88 * You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind
89 * that you cannot undo or cancel this operation.
90 */
91export interface CacheReserveClearResponse {
92 /**
93 * ID of the zone setting.
94 */
95 id: 'cache_reserve_clear';
96
97 /**
98 * last time this setting was modified.
99 */
100 modified_on: string | null;
101
102 /**
103 * The time that the latest Cache Reserve Clear operation started.
104 */
105 start_ts: string;
106
107 /**
108 * The current state of the Cache Reserve Clear operation.
109 */
110 state: 'In-progress' | 'Completed';
111
112 /**
113 * The time that the latest Cache Reserve Clear operation completed.
114 */
115 end_ts?: string;
116}
117
118/**
119 * Increase cache lifetimes by automatically storing all cacheable files into
120 * Cloudflare's persistent object storage buckets. Requires Cache Reserve
121 * subscription. Note: using Tiered Cache with Cache Reserve is highly recommended
122 * to reduce Reserve operations costs. See the
123 * [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve)
124 * for more information.
125 */
126export interface CacheReserveEditResponse {
127 /**
128 * ID of the zone setting.
129 */
130 id: 'cache_reserve';
131
132 /**
133 * last time this setting was modified.
134 */
135 modified_on: string | null;
136
137 /**
138 * Value of the Cache Reserve zone setting.
139 */
140 value: 'on' | 'off';
141}
142
143/**
144 * Increase cache lifetimes by automatically storing all cacheable files into
145 * Cloudflare's persistent object storage buckets. Requires Cache Reserve
146 * subscription. Note: using Tiered Cache with Cache Reserve is highly recommended
147 * to reduce Reserve operations costs. See the
148 * [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve)
149 * for more information.
150 */
151export interface CacheReserveGetResponse {
152 /**
153 * ID of the zone setting.
154 */
155 id: 'cache_reserve';
156
157 /**
158 * last time this setting was modified.
159 */
160 modified_on: string | null;
161
162 /**
163 * Value of the Cache Reserve zone setting.
164 */
165 value: 'on' | 'off';
166}
167
168/**
169 * You can use Cache Reserve Clear to clear your Cache Reserve, but you must first
170 * disable Cache Reserve. In most cases, this will be accomplished within 24 hours.
171 * You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind
172 * that you cannot undo or cancel this operation.
173 */
174export interface CacheReserveStatusResponse {
175 /**
176 * ID of the zone setting.
177 */
178 id: 'cache_reserve_clear';
179
180 /**
181 * last time this setting was modified.
182 */
183 modified_on: string | null;
184
185 /**
186 * The time that the latest Cache Reserve Clear operation started.
187 */
188 start_ts: string;
189
190 /**
191 * The current state of the Cache Reserve Clear operation.
192 */
193 state: 'In-progress' | 'Completed';
194
195 /**
196 * The time that the latest Cache Reserve Clear operation completed.
197 */
198 end_ts?: string;
199}
200
201export interface CacheReserveClearParams {
202 /**
203 * Identifier
204 */
205 zone_id: string;
206}
207
208export interface CacheReserveEditParams {
209 /**
210 * Path param: Identifier
211 */
212 zone_id: string;
213
214 /**
215 * Body param: Value of the Cache Reserve zone setting.
216 */
217 value: 'on' | 'off';
218}
219
220export interface CacheReserveGetParams {
221 /**
222 * Identifier
223 */
224 zone_id: string;
225}
226
227export interface CacheReserveStatusParams {
228 /**
229 * Identifier
230 */
231 zone_id: string;
232}
233
234export namespace CacheReserve {
235 export import CacheReserveClearResponse = CacheReserveAPI.CacheReserveClearResponse;
236 export import CacheReserveEditResponse = CacheReserveAPI.CacheReserveEditResponse;
237 export import CacheReserveGetResponse = CacheReserveAPI.CacheReserveGetResponse;
238 export import CacheReserveStatusResponse = CacheReserveAPI.CacheReserveStatusResponse;
239 export import CacheReserveClearParams = CacheReserveAPI.CacheReserveClearParams;
240 export import CacheReserveEditParams = CacheReserveAPI.CacheReserveEditParams;
241 export import CacheReserveGetParams = CacheReserveAPI.CacheReserveGetParams;
242 export import CacheReserveStatusParams = CacheReserveAPI.CacheReserveStatusParams;
243}
244