UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

99 lines • 3.69 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { SinglePage } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseRamps = /* @__PURE__ */ (() => { class BaseRamps extends APIResource { /** * Creates ramps (network connections) for a CF1 Site. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const ramp of client.magicTransit.cf1Sites.ramps.create( * '023e105f4ecef8ad9ca31a8372d0c353', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * body: [ * { * source_ramp_id: '023e105f4ecef8ad9ca31a8372d0c353', * type: 'gre', * }, * ], * }, * )) { * // ... * } * ``` */ create(cf1SiteID, params, options) { const { account_id, body } = params; return this._client.getAPIList(path `/accounts/${account_id}/magic/cf1_sites/${cf1SiteID}/ramps`, (SinglePage), { body: body, method: 'post', ...options }); } /** * Lists ramps (network connections) associated with a CF1 Site. Ramps represent * GRE tunnels, IPsec tunnels, interconnects, or MCONN links. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const ramp of client.magicTransit.cf1Sites.ramps.list( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(cf1SiteID, params, options) { const { account_id } = params; return this._client.getAPIList(path `/accounts/${account_id}/magic/cf1_sites/${cf1SiteID}/ramps`, (SinglePage), options); } /** * Deletes a specific ramp from a CF1 Site. * * @example * ```ts * const ramp = * await client.magicTransit.cf1Sites.ramps.delete( * '023e105f4ecef8ad9ca31a8372d0c353', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * cf1_site_id: '023e105f4ecef8ad9ca31a8372d0c353', * }, * ); * ``` */ delete(rampID, params, options) { const { account_id, cf1_site_id } = params; return this._client.delete(path `/accounts/${account_id}/magic/cf1_sites/${cf1_site_id}/ramps/${rampID}`, options)._thenUnwrap((obj) => obj.result); } /** * Gets a specific ramp for a CF1 Site. * * @example * ```ts * const ramp = await client.magicTransit.cf1Sites.ramps.get( * '023e105f4ecef8ad9ca31a8372d0c353', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * cf1_site_id: '023e105f4ecef8ad9ca31a8372d0c353', * }, * ); * ``` */ get(rampID, params, options) { const { account_id, cf1_site_id } = params; return this._client.get(path `/accounts/${account_id}/magic/cf1_sites/${cf1_site_id}/ramps/${rampID}`, options)._thenUnwrap((obj) => obj.result); } } BaseRamps._key = Object.freeze([ 'magicTransit', 'cf1Sites', 'ramps', ]); return BaseRamps; })(); export class Ramps extends BaseRamps { } //# sourceMappingURL=ramps.mjs.map