cloudflare/cloudflare-typescript
Publicmirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/analytics/colo.ts
348lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. |
| 2 | |
| 3 | import * as Core from 'cloudflare/core'; |
| 4 | import { APIResource } from 'cloudflare/resource'; |
| 5 | import { isRequestOptions } from 'cloudflare/core'; |
| 6 | import * as ColoAPI from 'cloudflare/resources/analytics/colo'; |
| 7 | |
| 8 | export class Colo extends APIResource { |
| 9 | /** |
| 10 | * This view provides a breakdown of analytics data by datacenter. Note: This is |
| 11 | * available to Enterprise customers only. |
| 12 | */ |
| 13 | zoneAnalyticsDeprecatedGetAnalyticsByCoLocations( |
| 14 | zoneIdentifier: string, |
| 15 | query?: ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams, |
| 16 | options?: Core.RequestOptions, |
| 17 | ): Core.APIPromise<ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse>; |
| 18 | zoneAnalyticsDeprecatedGetAnalyticsByCoLocations( |
| 19 | zoneIdentifier: string, |
| 20 | options?: Core.RequestOptions, |
| 21 | ): Core.APIPromise<ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse>; |
| 22 | zoneAnalyticsDeprecatedGetAnalyticsByCoLocations( |
| 23 | zoneIdentifier: string, |
| 24 | query: ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams | Core.RequestOptions = {}, |
| 25 | options?: Core.RequestOptions, |
| 26 | ): Core.APIPromise<ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse> { |
| 27 | if (isRequestOptions(query)) { |
| 28 | return this.zoneAnalyticsDeprecatedGetAnalyticsByCoLocations(zoneIdentifier, {}, query); |
| 29 | } |
| 30 | return ( |
| 31 | this._client.get(`/zones/${zoneIdentifier}/analytics/colos`, { query, ...options }) as Core.APIPromise<{ |
| 32 | result: ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse; |
| 33 | }> |
| 34 | )._thenUnwrap((obj) => obj.result); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * A breakdown of all dashboard analytics data by co-locations. This is limited to |
| 40 | * Enterprise zones only. |
| 41 | */ |
| 42 | export type ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse = |
| 43 | Array<ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse.ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseItem>; |
| 44 | |
| 45 | export namespace ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse { |
| 46 | export interface ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseItem { |
| 47 | /** |
| 48 | * The airport code identifer for the co-location. |
| 49 | */ |
| 50 | colo_id?: string; |
| 51 | |
| 52 | /** |
| 53 | * Time deltas containing metadata about each bucket of time. The number of buckets |
| 54 | * (resolution) is determined by the amount of time between the since and until |
| 55 | * parameters. |
| 56 | */ |
| 57 | timeseries?: Array<ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseItem.Timesery>; |
| 58 | |
| 59 | /** |
| 60 | * Breakdown of totals by data type. |
| 61 | */ |
| 62 | totals?: ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseItem.Totals; |
| 63 | } |
| 64 | |
| 65 | export namespace ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponseItem { |
| 66 | export interface Timesery { |
| 67 | /** |
| 68 | * Breakdown of totals for bandwidth in the form of bytes. |
| 69 | */ |
| 70 | bandwidth?: Timesery.Bandwidth; |
| 71 | |
| 72 | /** |
| 73 | * Breakdown of totals for requests. |
| 74 | */ |
| 75 | requests?: Timesery.Requests; |
| 76 | |
| 77 | /** |
| 78 | * The (inclusive) beginning of the requested time frame. This value can be a |
| 79 | * negative integer representing the number of minutes in the past relative to time |
| 80 | * the request is made, or can be an absolute timestamp that conforms to RFC 3339. |
| 81 | * At this point in time, it cannot exceed a time in the past greater than one |
| 82 | * year. |
| 83 | * |
| 84 | * Ranges that the Cloudflare web application provides will provide the following |
| 85 | * period length for each point: |
| 86 | * |
| 87 | * - Last 60 minutes (from -59 to -1): 1 minute resolution |
| 88 | * - Last 7 hours (from -419 to -60): 15 minutes resolution |
| 89 | * - Last 15 hours (from -899 to -420): 30 minutes resolution |
| 90 | * - Last 72 hours (from -4320 to -900): 1 hour resolution |
| 91 | * - Older than 3 days (-525600 to -4320): 1 day resolution. |
| 92 | */ |
| 93 | since?: string | number; |
| 94 | |
| 95 | /** |
| 96 | * Breakdown of totals for threats. |
| 97 | */ |
| 98 | threats?: Timesery.Threats; |
| 99 | |
| 100 | /** |
| 101 | * The (exclusive) end of the requested time frame. This value can be a negative |
| 102 | * integer representing the number of minutes in the past relative to time the |
| 103 | * request is made, or can be an absolute timestamp that conforms to RFC 3339. If |
| 104 | * omitted, the time of the request is used. |
| 105 | */ |
| 106 | until?: string | number; |
| 107 | } |
| 108 | |
| 109 | export namespace Timesery { |
| 110 | /** |
| 111 | * Breakdown of totals for bandwidth in the form of bytes. |
| 112 | */ |
| 113 | export interface Bandwidth { |
| 114 | /** |
| 115 | * The total number of bytes served within the time frame. |
| 116 | */ |
| 117 | all?: number; |
| 118 | |
| 119 | /** |
| 120 | * The number of bytes that were cached (and served) by Cloudflare. |
| 121 | */ |
| 122 | cached?: number; |
| 123 | |
| 124 | /** |
| 125 | * The number of bytes that were fetched and served from the origin server. |
| 126 | */ |
| 127 | uncached?: number; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Breakdown of totals for requests. |
| 132 | */ |
| 133 | export interface Requests { |
| 134 | /** |
| 135 | * Total number of requests served. |
| 136 | */ |
| 137 | all?: number; |
| 138 | |
| 139 | /** |
| 140 | * Total number of cached requests served. |
| 141 | */ |
| 142 | cached?: number; |
| 143 | |
| 144 | /** |
| 145 | * Key/value pairs where the key is a two-digit country code and the value is the |
| 146 | * number of requests served to that country. |
| 147 | */ |
| 148 | country?: Record<string, unknown>; |
| 149 | |
| 150 | /** |
| 151 | * A variable list of key/value pairs where the key is a HTTP status code and the |
| 152 | * value is the number of requests with that code served. |
| 153 | */ |
| 154 | http_status?: unknown; |
| 155 | |
| 156 | /** |
| 157 | * Total number of requests served from the origin. |
| 158 | */ |
| 159 | uncached?: number; |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Breakdown of totals for threats. |
| 164 | */ |
| 165 | export interface Threats { |
| 166 | /** |
| 167 | * The total number of identifiable threats received over the time frame. |
| 168 | */ |
| 169 | all?: number; |
| 170 | |
| 171 | /** |
| 172 | * A list of key/value pairs where the key is a two-digit country code and the |
| 173 | * value is the number of malicious requests received from that country. |
| 174 | */ |
| 175 | country?: unknown; |
| 176 | |
| 177 | /** |
| 178 | * The list of key/value pairs where the key is a threat category and the value is |
| 179 | * the number of requests. |
| 180 | */ |
| 181 | type?: unknown; |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * Breakdown of totals by data type. |
| 187 | */ |
| 188 | export interface Totals { |
| 189 | /** |
| 190 | * Breakdown of totals for bandwidth in the form of bytes. |
| 191 | */ |
| 192 | bandwidth?: Totals.Bandwidth; |
| 193 | |
| 194 | /** |
| 195 | * Breakdown of totals for requests. |
| 196 | */ |
| 197 | requests?: Totals.Requests; |
| 198 | |
| 199 | /** |
| 200 | * The (inclusive) beginning of the requested time frame. This value can be a |
| 201 | * negative integer representing the number of minutes in the past relative to time |
| 202 | * the request is made, or can be an absolute timestamp that conforms to RFC 3339. |
| 203 | * At this point in time, it cannot exceed a time in the past greater than one |
| 204 | * year. |
| 205 | * |
| 206 | * Ranges that the Cloudflare web application provides will provide the following |
| 207 | * period length for each point: |
| 208 | * |
| 209 | * - Last 60 minutes (from -59 to -1): 1 minute resolution |
| 210 | * - Last 7 hours (from -419 to -60): 15 minutes resolution |
| 211 | * - Last 15 hours (from -899 to -420): 30 minutes resolution |
| 212 | * - Last 72 hours (from -4320 to -900): 1 hour resolution |
| 213 | * - Older than 3 days (-525600 to -4320): 1 day resolution. |
| 214 | */ |
| 215 | since?: string | number; |
| 216 | |
| 217 | /** |
| 218 | * Breakdown of totals for threats. |
| 219 | */ |
| 220 | threats?: Totals.Threats; |
| 221 | |
| 222 | /** |
| 223 | * The (exclusive) end of the requested time frame. This value can be a negative |
| 224 | * integer representing the number of minutes in the past relative to time the |
| 225 | * request is made, or can be an absolute timestamp that conforms to RFC 3339. If |
| 226 | * omitted, the time of the request is used. |
| 227 | */ |
| 228 | until?: string | number; |
| 229 | } |
| 230 | |
| 231 | export namespace Totals { |
| 232 | /** |
| 233 | * Breakdown of totals for bandwidth in the form of bytes. |
| 234 | */ |
| 235 | export interface Bandwidth { |
| 236 | /** |
| 237 | * The total number of bytes served within the time frame. |
| 238 | */ |
| 239 | all?: number; |
| 240 | |
| 241 | /** |
| 242 | * The number of bytes that were cached (and served) by Cloudflare. |
| 243 | */ |
| 244 | cached?: number; |
| 245 | |
| 246 | /** |
| 247 | * The number of bytes that were fetched and served from the origin server. |
| 248 | */ |
| 249 | uncached?: number; |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * Breakdown of totals for requests. |
| 254 | */ |
| 255 | export interface Requests { |
| 256 | /** |
| 257 | * Total number of requests served. |
| 258 | */ |
| 259 | all?: number; |
| 260 | |
| 261 | /** |
| 262 | * Total number of cached requests served. |
| 263 | */ |
| 264 | cached?: number; |
| 265 | |
| 266 | /** |
| 267 | * Key/value pairs where the key is a two-digit country code and the value is the |
| 268 | * number of requests served to that country. |
| 269 | */ |
| 270 | country?: Record<string, unknown>; |
| 271 | |
| 272 | /** |
| 273 | * A variable list of key/value pairs where the key is a HTTP status code and the |
| 274 | * value is the number of requests with that code served. |
| 275 | */ |
| 276 | http_status?: unknown; |
| 277 | |
| 278 | /** |
| 279 | * Total number of requests served from the origin. |
| 280 | */ |
| 281 | uncached?: number; |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * Breakdown of totals for threats. |
| 286 | */ |
| 287 | export interface Threats { |
| 288 | /** |
| 289 | * The total number of identifiable threats received over the time frame. |
| 290 | */ |
| 291 | all?: number; |
| 292 | |
| 293 | /** |
| 294 | * A list of key/value pairs where the key is a two-digit country code and the |
| 295 | * value is the number of malicious requests received from that country. |
| 296 | */ |
| 297 | country?: unknown; |
| 298 | |
| 299 | /** |
| 300 | * The list of key/value pairs where the key is a threat category and the value is |
| 301 | * the number of requests. |
| 302 | */ |
| 303 | type?: unknown; |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | export interface ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams { |
| 310 | /** |
| 311 | * When set to true, the API will move the requested time window backward, until it |
| 312 | * finds a region with completely aggregated data. |
| 313 | * |
| 314 | * The API response _may not represent the requested time window_. |
| 315 | */ |
| 316 | continuous?: boolean; |
| 317 | |
| 318 | /** |
| 319 | * The (inclusive) beginning of the requested time frame. This value can be a |
| 320 | * negative integer representing the number of minutes in the past relative to time |
| 321 | * the request is made, or can be an absolute timestamp that conforms to RFC 3339. |
| 322 | * At this point in time, it cannot exceed a time in the past greater than one |
| 323 | * year. |
| 324 | * |
| 325 | * Ranges that the Cloudflare web application provides will provide the following |
| 326 | * period length for each point: |
| 327 | * |
| 328 | * - Last 60 minutes (from -59 to -1): 1 minute resolution |
| 329 | * - Last 7 hours (from -419 to -60): 15 minutes resolution |
| 330 | * - Last 15 hours (from -899 to -420): 30 minutes resolution |
| 331 | * - Last 72 hours (from -4320 to -900): 1 hour resolution |
| 332 | * - Older than 3 days (-525600 to -4320): 1 day resolution. |
| 333 | */ |
| 334 | since?: string | number; |
| 335 | |
| 336 | /** |
| 337 | * The (exclusive) end of the requested time frame. This value can be a negative |
| 338 | * integer representing the number of minutes in the past relative to time the |
| 339 | * request is made, or can be an absolute timestamp that conforms to RFC 3339. If |
| 340 | * omitted, the time of the request is used. |
| 341 | */ |
| 342 | until?: string | number; |
| 343 | } |
| 344 | |
| 345 | export namespace Colo { |
| 346 | export import ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse = ColoAPI.ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsResponse; |
| 347 | export import ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams = ColoAPI.ColoZoneAnalyticsDeprecatedGetAnalyticsByCoLocationsParams; |
| 348 | } |
| 349 | |