cloudflare/cloudflare-typescript
Publicmirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/cache/smart-tiered-cache.ts
157lines · 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 | |
| 6 | export class SmartTieredCache extends APIResource { |
| 7 | /** |
| 8 | * Remvoves enablement of Smart Tiered Cache |
| 9 | */ |
| 10 | delete( |
| 11 | params: SmartTieredCacheDeleteParams, |
| 12 | options?: Core.RequestOptions, |
| 13 | ): Core.APIPromise<SmartTieredCacheDeleteResponse> { |
| 14 | const { zone_id } = params; |
| 15 | return ( |
| 16 | this._client.delete( |
| 17 | `/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, |
| 18 | options, |
| 19 | ) as Core.APIPromise<{ result: SmartTieredCacheDeleteResponse }> |
| 20 | )._thenUnwrap((obj) => obj.result); |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Updates enablement of Tiered Cache |
| 25 | */ |
| 26 | edit( |
| 27 | params: SmartTieredCacheEditParams, |
| 28 | options?: Core.RequestOptions, |
| 29 | ): Core.APIPromise<SmartTieredCacheEditResponse> { |
| 30 | const { zone_id, ...body } = params; |
| 31 | return ( |
| 32 | this._client.patch(`/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, { |
| 33 | body, |
| 34 | ...options, |
| 35 | }) as Core.APIPromise<{ result: SmartTieredCacheEditResponse }> |
| 36 | )._thenUnwrap((obj) => obj.result); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Get Smart Tiered Cache setting |
| 41 | */ |
| 42 | get( |
| 43 | params: SmartTieredCacheGetParams, |
| 44 | options?: Core.RequestOptions, |
| 45 | ): Core.APIPromise<SmartTieredCacheGetResponse> { |
| 46 | const { zone_id } = params; |
| 47 | return ( |
| 48 | this._client.get( |
| 49 | `/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, |
| 50 | options, |
| 51 | ) as Core.APIPromise<{ result: SmartTieredCacheGetResponse }> |
| 52 | )._thenUnwrap((obj) => obj.result); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | export interface SmartTieredCacheDeleteResponse { |
| 57 | /** |
| 58 | * The identifier of the caching setting |
| 59 | */ |
| 60 | id: string; |
| 61 | |
| 62 | /** |
| 63 | * Whether the setting is editable |
| 64 | */ |
| 65 | editable: boolean; |
| 66 | |
| 67 | /** |
| 68 | * The time when the setting was last modified |
| 69 | */ |
| 70 | modified_on: string; |
| 71 | |
| 72 | /** |
| 73 | * The status of the feature being on / off |
| 74 | */ |
| 75 | value: 'on' | 'off'; |
| 76 | } |
| 77 | |
| 78 | export interface SmartTieredCacheEditResponse { |
| 79 | /** |
| 80 | * The identifier of the caching setting |
| 81 | */ |
| 82 | id: string; |
| 83 | |
| 84 | /** |
| 85 | * Whether the setting is editable |
| 86 | */ |
| 87 | editable: boolean; |
| 88 | |
| 89 | /** |
| 90 | * The time when the setting was last modified |
| 91 | */ |
| 92 | modified_on: string; |
| 93 | |
| 94 | /** |
| 95 | * The status of the feature being on / off |
| 96 | */ |
| 97 | value: 'on' | 'off'; |
| 98 | } |
| 99 | |
| 100 | export interface SmartTieredCacheGetResponse { |
| 101 | /** |
| 102 | * The identifier of the caching setting |
| 103 | */ |
| 104 | id: string; |
| 105 | |
| 106 | /** |
| 107 | * Whether the setting is editable |
| 108 | */ |
| 109 | editable: boolean; |
| 110 | |
| 111 | /** |
| 112 | * The time when the setting was last modified |
| 113 | */ |
| 114 | modified_on: string; |
| 115 | |
| 116 | /** |
| 117 | * The status of the feature being on / off |
| 118 | */ |
| 119 | value: 'on' | 'off'; |
| 120 | } |
| 121 | |
| 122 | export interface SmartTieredCacheDeleteParams { |
| 123 | /** |
| 124 | * Identifier |
| 125 | */ |
| 126 | zone_id: string; |
| 127 | } |
| 128 | |
| 129 | export interface SmartTieredCacheEditParams { |
| 130 | /** |
| 131 | * Path param: Identifier |
| 132 | */ |
| 133 | zone_id: string; |
| 134 | |
| 135 | /** |
| 136 | * Body param: Enable or disable the Smart Tiered Cache |
| 137 | */ |
| 138 | value: 'on' | 'off'; |
| 139 | } |
| 140 | |
| 141 | export interface SmartTieredCacheGetParams { |
| 142 | /** |
| 143 | * Identifier |
| 144 | */ |
| 145 | zone_id: string; |
| 146 | } |
| 147 | |
| 148 | export declare namespace SmartTieredCache { |
| 149 | export { |
| 150 | type SmartTieredCacheDeleteResponse as SmartTieredCacheDeleteResponse, |
| 151 | type SmartTieredCacheEditResponse as SmartTieredCacheEditResponse, |
| 152 | type SmartTieredCacheGetResponse as SmartTieredCacheGetResponse, |
| 153 | type SmartTieredCacheDeleteParams as SmartTieredCacheDeleteParams, |
| 154 | type SmartTieredCacheEditParams as SmartTieredCacheEditParams, |
| 155 | type SmartTieredCacheGetParams as SmartTieredCacheGetParams, |
| 156 | }; |
| 157 | } |
| 158 | |