cloudflare
Version:
The official TypeScript library for the Cloudflare API
128 lines • 4.99 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddressMaps = exports.BaseAddressMaps = void 0;
const tslib_1 = require("../../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const AccountsAPI = tslib_1.__importStar(require("./accounts.js"));
const accounts_1 = require("./accounts.js");
const AddressMapsIPsAPI = tslib_1.__importStar(require("./ips.js"));
const ips_1 = require("./ips.js");
const ZonesAPI = tslib_1.__importStar(require("./zones.js"));
const zones_1 = require("./zones.js");
const pagination_1 = require("../../../core/pagination.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseAddressMaps = /* @__PURE__ */ (() => {
class BaseAddressMaps extends resource_1.APIResource {
/**
* Create a new address map under the account.
*
* @example
* ```ts
* const addressMap =
* await client.addressing.addressMaps.create({
* account_id: '258def64c72dae45f3e4c8516e2111f2',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/addressing/address_maps`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List all address maps owned by the account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const addressMap of client.addressing.addressMaps.list(
* { account_id: '258def64c72dae45f3e4c8516e2111f2' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/addressing/address_maps`, (pagination_1.SinglePage), options);
}
/**
* Delete a particular address map owned by the account. An Address Map must be
* disabled before it can be deleted.
*
* @example
* ```ts
* const addressMap =
* await client.addressing.addressMaps.delete(
* '055817b111884e0227e1be16a0be6ee0',
* { account_id: '258def64c72dae45f3e4c8516e2111f2' },
* );
* ```
*/
delete(addressMapID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/addressing/address_maps/${addressMapID}`, options);
}
/**
* Modify properties of an address map owned by the account.
*
* @example
* ```ts
* const addressMap = await client.addressing.addressMaps.edit(
* '055817b111884e0227e1be16a0be6ee0',
* { account_id: '258def64c72dae45f3e4c8516e2111f2' },
* );
* ```
*/
edit(addressMapID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/addressing/address_maps/${addressMapID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Show a particular address map owned by the account.
*
* @example
* ```ts
* const addressMap = await client.addressing.addressMaps.get(
* '055817b111884e0227e1be16a0be6ee0',
* { account_id: '258def64c72dae45f3e4c8516e2111f2' },
* );
* ```
*/
get(addressMapID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/addressing/address_maps/${addressMapID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseAddressMaps._key = Object.freeze([
'addressing',
'addressMaps',
]);
return BaseAddressMaps;
})();
exports.BaseAddressMaps = BaseAddressMaps;
var AddressMaps = /* @__PURE__ */ (() => {
class AddressMaps extends BaseAddressMaps {
constructor() {
super(...arguments);
this.accounts = new AccountsAPI.Accounts(this._client);
this.ips = new AddressMapsIPsAPI.IPs(this._client);
this.zones = new ZonesAPI.Zones(this._client);
}
}
AddressMaps.Accounts = accounts_1.Accounts;
AddressMaps.BaseAccounts = accounts_1.BaseAccounts;
AddressMaps.IPs = ips_1.IPs;
AddressMaps.BaseIPs = ips_1.BaseIPs;
AddressMaps.Zones = zones_1.Zones;
AddressMaps.BaseZones = zones_1.BaseZones;
return AddressMaps;
})();
exports.AddressMaps = AddressMaps;
//# sourceMappingURL=address-maps.js.map