cloudflare
Version:
The official TypeScript library for the Cloudflare API
109 lines • 4.03 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { CursorPagination } from "../../../core/pagination.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BasePrefixBindings = /* @__PURE__ */ (() => {
class BasePrefixBindings extends 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(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(path `/accounts/${account_id}/dls/regional_services/prefix_bindings`, (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(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(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(path `/accounts/${account_id}/dls/regional_services/prefix_bindings/${bindingID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BasePrefixBindings._key = Object.freeze([
'dls',
'regionalServices',
'prefixBindings',
]);
return BasePrefixBindings;
})();
export class PrefixBindings extends BasePrefixBindings {
}
//# sourceMappingURL=prefix-bindings.mjs.map