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