UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

63 lines 2.62 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import * as PrefixesAPI from 'cloudflare/resources/addressing/prefixes/prefixes'; import * as DelegationsAPI from 'cloudflare/resources/addressing/prefixes/delegations'; import * as BGPAPI from 'cloudflare/resources/addressing/prefixes/bgp/bgp'; import { SinglePage } from 'cloudflare/pagination'; export class Prefixes extends APIResource { constructor() { super(...arguments); this.bgp = new BGPAPI.BGP(this._client); this.delegations = new DelegationsAPI.Delegations(this._client); } /** * Add a new prefix under the account. */ create(params, options) { const { account_id, ...body } = params; return this._client.post(`/accounts/${account_id}/addressing/prefixes`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List all prefixes owned by the account. */ list(params, options) { const { account_id } = params; return this._client.getAPIList(`/accounts/${account_id}/addressing/prefixes`, AddressingIpamPrefixesSinglePage, options); } /** * Delete an unapproved prefix owned by the account. */ delete(prefixId, params, options) { const { account_id } = params; return this._client.delete(`/accounts/${account_id}/addressing/prefixes/${prefixId}`, options)._thenUnwrap((obj) => obj.result); } /** * Modify the description for a prefix owned by the account. */ edit(prefixId, params, options) { const { account_id, ...body } = params; return this._client.patch(`/accounts/${account_id}/addressing/prefixes/${prefixId}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List a particular prefix owned by the account. */ get(prefixId, params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/addressing/prefixes/${prefixId}`, options)._thenUnwrap((obj) => obj.result); } } export class AddressingIpamPrefixesSinglePage extends SinglePage { } (function (Prefixes) { Prefixes.AddressingIpamPrefixesSinglePage = PrefixesAPI.AddressingIpamPrefixesSinglePage; Prefixes.BGP = BGPAPI.BGP; Prefixes.Delegations = DelegationsAPI.Delegations; Prefixes.AddressingIpamDelegationsSinglePage = DelegationsAPI.AddressingIpamDelegationsSinglePage; })(Prefixes || (Prefixes = {})); //# sourceMappingURL=prefixes.mjs.map