cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v5.2.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

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

136lines · 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 RegionalTieredCacheResource extends APIResource {
7 /**
8 * Instructs Cloudflare to check a regional hub data center on the way to your
9 * upper tier. This can help improve performance for smart and custom tiered cache
10 * topologies.
11 *
12 * @example
13 * ```ts
14 * const response =
15 * await client.cache.regionalTieredCache.edit({
16 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
17 * value: 'on',
18 * });
19 * ```
20 */
21 edit(
22 params: RegionalTieredCacheEditParams,
23 options?: Core.RequestOptions,
24 ): Core.APIPromise<RegionalTieredCacheEditResponse> {
25 const { zone_id, ...body } = params;
26 return (
27 this._client.patch(`/zones/${zone_id}/cache/regional_tiered_cache`, {
28 body,
29 ...options,
30 }) as Core.APIPromise<{ result: RegionalTieredCacheEditResponse }>
31 )._thenUnwrap((obj) => obj.result);
32 }
33
34 /**
35 * Instructs Cloudflare to check a regional hub data center on the way to your
36 * upper tier. This can help improve performance for smart and custom tiered cache
37 * topologies.
38 *
39 * @example
40 * ```ts
41 * const regionalTieredCache =
42 * await client.cache.regionalTieredCache.get({
43 * zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
44 * });
45 * ```
46 */
47 get(
48 params: RegionalTieredCacheGetParams,
49 options?: Core.RequestOptions,
50 ): Core.APIPromise<RegionalTieredCacheGetResponse> {
51 const { zone_id } = params;
52 return (
53 this._client.get(`/zones/${zone_id}/cache/regional_tiered_cache`, options) as Core.APIPromise<{
54 result: RegionalTieredCacheGetResponse;
55 }>
56 )._thenUnwrap((obj) => obj.result);
57 }
58}
59
60/**
61 * The identifier of the caching setting.
62 */
63export type RegionalTieredCache = 'tc_regional';
64
65export interface RegionalTieredCacheEditResponse {
66 /**
67 * The identifier of the caching setting.
68 */
69 id: RegionalTieredCache;
70
71 /**
72 * Whether the setting is editable.
73 */
74 editable: boolean;
75
76 /**
77 * Value of the Regional Tiered Cache zone setting.
78 */
79 value: 'on' | 'off';
80
81 /**
82 * Last time this setting was modified.
83 */
84 modified_on?: string | null;
85}
86
87export interface RegionalTieredCacheGetResponse {
88 /**
89 * The identifier of the caching setting.
90 */
91 id: RegionalTieredCache;
92
93 /**
94 * Whether the setting is editable.
95 */
96 editable: boolean;
97
98 /**
99 * Value of the Regional Tiered Cache zone setting.
100 */
101 value: 'on' | 'off';
102
103 /**
104 * Last time this setting was modified.
105 */
106 modified_on?: string | null;
107}
108
109export interface RegionalTieredCacheEditParams {
110 /**
111 * Path param: Identifier.
112 */
113 zone_id: string;
114
115 /**
116 * Body param: Value of the Regional Tiered Cache zone setting.
117 */
118 value: 'on' | 'off';
119}
120
121export interface RegionalTieredCacheGetParams {
122 /**
123 * Identifier.
124 */
125 zone_id: string;
126}
127
128export declare namespace RegionalTieredCacheResource {
129 export {
130 type RegionalTieredCache as RegionalTieredCache,
131 type RegionalTieredCacheEditResponse as RegionalTieredCacheEditResponse,
132 type RegionalTieredCacheGetResponse as RegionalTieredCacheGetResponse,
133 type RegionalTieredCacheEditParams as RegionalTieredCacheEditParams,
134 type RegionalTieredCacheGetParams as RegionalTieredCacheGetParams,
135 };
136}
137