cloudflare
Version:
The official TypeScript library for the Cloudflare API
114 lines • 4.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrefixBindings = exports.BasePrefixBindings = 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 BasePrefixBindings = /* @__PURE__ */ (() => {
class BasePrefixBindings extends resource_1.APIResource {
/**
* Create a DLS prefix binding
*
* @example
* ```ts
* const prefixBinding =
* await client.dls.regionalServices.prefixBindings.create({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* cidr: '10.0.1.0/24',
* prefix_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
* region_key: 'eu',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/dls/regional_services/prefix_bindings`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List DLS prefix bindings for an account
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const prefixBindingListResponse of client.dls.regionalServices.prefixBindings.list(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/dls/regional_services/prefix_bindings`, (pagination_1.CursorPagination), { query, ...options });
}
/**
* Delete a DLS prefix binding
*
* @example
* ```ts
* const prefixBinding =
* await client.dls.regionalServices.prefixBindings.delete(
* 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(bindingID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/dls/regional_services/prefix_bindings/${bindingID}`, options);
}
/**
* Update a DLS prefix binding
*
* @example
* ```ts
* const response =
* await client.dls.regionalServices.prefixBindings.edit(
* 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
* {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* region_key: 'eu',
* },
* );
* ```
*/
edit(bindingID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/dls/regional_services/prefix_bindings/${bindingID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Get a DLS prefix binding
*
* @example
* ```ts
* const prefixBinding =
* await client.dls.regionalServices.prefixBindings.get(
* 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(bindingID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/dls/regional_services/prefix_bindings/${bindingID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BasePrefixBindings._key = Object.freeze([
'dls',
'regionalServices',
'prefixBindings',
]);
return BasePrefixBindings;
})();
exports.BasePrefixBindings = BasePrefixBindings;
class PrefixBindings extends BasePrefixBindings {
}
exports.PrefixBindings = PrefixBindings;
//# sourceMappingURL=prefix-bindings.js.map