cloudflare
Version:
The official TypeScript library for the Cloudflare API
110 lines • 3.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ACLs = exports.BaseACLs = 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 BaseACLs = /* @__PURE__ */ (() => {
class BaseACLs extends resource_1.APIResource {
/**
* Create ACL.
*
* @example
* ```ts
* const acl = await client.dns.zoneTransfers.acls.create({
* account_id: '01a7362d577a6c3019a474fd6f485823',
* ip_range: '192.0.2.53/28',
* name: 'my-acl-1',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/secondary_dns/acls`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Modify ACL.
*
* @example
* ```ts
* const acl = await client.dns.zoneTransfers.acls.update(
* '23ff594956f20c2a721606e94745a8aa',
* {
* account_id: '01a7362d577a6c3019a474fd6f485823',
* ip_range: '192.0.2.53/28',
* name: 'my-acl-1',
* },
* );
* ```
*/
update(aclID, params, options) {
const { account_id, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/secondary_dns/acls/${aclID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List ACLs.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const acl of client.dns.zoneTransfers.acls.list({
* account_id: '01a7362d577a6c3019a474fd6f485823',
* })) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/secondary_dns/acls`, (pagination_1.SinglePage), options);
}
/**
* Delete ACL.
*
* @example
* ```ts
* const acl = await client.dns.zoneTransfers.acls.delete(
* '23ff594956f20c2a721606e94745a8aa',
* { account_id: '01a7362d577a6c3019a474fd6f485823' },
* );
* ```
*/
delete(aclID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/secondary_dns/acls/${aclID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Get ACL.
*
* @example
* ```ts
* const acl = await client.dns.zoneTransfers.acls.get(
* '23ff594956f20c2a721606e94745a8aa',
* { account_id: '01a7362d577a6c3019a474fd6f485823' },
* );
* ```
*/
get(aclID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/secondary_dns/acls/${aclID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseACLs._key = Object.freeze([
'dns',
'zoneTransfers',
'acls',
]);
return BaseACLs;
})();
exports.BaseACLs = BaseACLs;
class ACLs extends BaseACLs {
}
exports.ACLs = ACLs;
//# sourceMappingURL=acls.js.map