UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

68 lines • 2.66 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseFallbackOrigin = /* @__PURE__ */ (() => { class BaseFallbackOrigin extends APIResource { /** * Updates the fallback origin configuration for custom hostnames on a zone. Sets * the default origin server for custom hostname traffic. * * @example * ```ts * const fallbackOrigin = * await client.customHostnames.fallbackOrigin.update({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * origin: 'fallback.example.com', * }); * ``` */ update(params, options) { const { zone_id, ...body } = params; return this._client.put(path `/zones/${zone_id}/custom_hostnames/fallback_origin`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Removes the fallback origin configuration for custom hostnames on a zone. Custom * hostnames without specific origins will no longer have a fallback. * * @example * ```ts * const fallbackOrigin = * await client.customHostnames.fallbackOrigin.delete({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ delete(params, options) { const { zone_id } = params; return this._client.delete(path `/zones/${zone_id}/custom_hostnames/fallback_origin`, options)._thenUnwrap((obj) => obj.result); } /** * Retrieves the current fallback origin configuration for custom hostnames on a * zone. The fallback origin handles traffic when specific custom hostname origins * are unavailable. * * @example * ```ts * const fallbackOrigin = * await client.customHostnames.fallbackOrigin.get({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ get(params, options) { const { zone_id } = params; return this._client.get(path `/zones/${zone_id}/custom_hostnames/fallback_origin`, options)._thenUnwrap((obj) => obj.result); } } BaseFallbackOrigin._key = Object.freeze([ 'customHostnames', 'fallbackOrigin', ]); return BaseFallbackOrigin; })(); export class FallbackOrigin extends BaseFallbackOrigin { } //# sourceMappingURL=fallback-origin.mjs.map