cloudflare
Version:
The official TypeScript library for the Cloudflare API
111 lines • 4.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BGPFilterProfiles = exports.BaseBGPFilterProfiles = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BaseBGPFilterProfiles = /* @__PURE__ */ (() => {
class BaseBGPFilterProfiles extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/magic/bgp/filter_profiles`, (pagination_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/magic/bgp/filter_profiles/${profileID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseBGPFilterProfiles._key = Object.freeze([
'magicTransit',
'bgpFilterProfiles',
]);
return BaseBGPFilterProfiles;
})();
exports.BaseBGPFilterProfiles = BaseBGPFilterProfiles;
class BGPFilterProfiles extends BaseBGPFilterProfiles {
}
exports.BGPFilterProfiles = BGPFilterProfiles;
//# sourceMappingURL=bgp-filter-profiles.js.map