UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

106 lines • 4.04 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 BaseBGPFilterProfiles = /* @__PURE__ */ (() => { class BaseBGPFilterProfiles extends APIResource { /** * Creates a new BGP filter profile for an account. * * @example * ```ts * const bgpFilterProfile = * await client.magicTransit.bgpFilterProfiles.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * match_action: 'allow', * name: 'Allowed On-Prem Imports', * targets: ['10.0.0.0/8{8,32}'], * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/magic/bgp/filter_profiles`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Updates a BGP filter profile. Omitted properties are left unchanged. To clear an * existing description send `description: ""`. * * @example * ```ts * const bgpFilterProfile = * await client.magicTransit.bgpFilterProfiles.update( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ update(profileID, params, options) { const { account_id, ...body } = params; return this._client.put(path `/accounts/${account_id}/magic/bgp/filter_profiles/${profileID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists all BGP filter profiles for an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const bgpFilterProfileListResponse of client.magicTransit.bgpFilterProfiles.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id } = params; return this._client.getAPIList(path `/accounts/${account_id}/magic/bgp/filter_profiles`, (SinglePage), options); } /** * Deletes a BGP filter profile. * * @example * ```ts * const bgpFilterProfile = * await client.magicTransit.bgpFilterProfiles.delete( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(profileID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/magic/bgp/filter_profiles/${profileID}`, options)._thenUnwrap((obj) => obj.result); } /** * Gets a specific BGP filter profile for an account. * * @example * ```ts * const bgpFilterProfile = * await client.magicTransit.bgpFilterProfiles.get( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(profileID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/magic/bgp/filter_profiles/${profileID}`, options)._thenUnwrap((obj) => obj.result); } } BaseBGPFilterProfiles._key = Object.freeze([ 'magicTransit', 'bgpFilterProfiles', ]); return BaseBGPFilterProfiles; })(); export class BGPFilterProfiles extends BaseBGPFilterProfiles { } //# sourceMappingURL=bgp-filter-profiles.mjs.map