cloudflare
Version:
The official TypeScript library for the Cloudflare API
37 lines • 1.66 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as DelegationsAPI from 'cloudflare/resources/addressing/prefixes/delegations';
import { SinglePage } from 'cloudflare/pagination';
export class Delegations extends APIResource {
/**
* Create a new account delegation for a given IP prefix.
*/
create(prefixId, params, options) {
const { account_id, ...body } = params;
return this._client.post(`/accounts/${account_id}/addressing/prefixes/${prefixId}/delegations`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List all delegations for a given account IP prefix.
*/
list(prefixId, params, options) {
const { account_id } = params;
return this._client.getAPIList(`/accounts/${account_id}/addressing/prefixes/${prefixId}/delegations`, DelegationsSinglePage, options);
}
/**
* Delete an account delegation for a given IP prefix.
*/
delete(prefixId, delegationId, params, options) {
const { account_id, body } = params;
return this._client.delete(`/accounts/${account_id}/addressing/prefixes/${prefixId}/delegations/${delegationId}`, { body: body, ...options })._thenUnwrap((obj) => obj.result);
}
}
export class DelegationsSinglePage extends SinglePage {
}
(function (Delegations) {
Delegations.Delegations = DelegationsAPI.Delegations;
Delegations.DelegationsSinglePage = DelegationsAPI.DelegationsSinglePage;
})(Delegations || (Delegations = {}));
//# sourceMappingURL=delegations.mjs.map