cloudflare
Version:
The official TypeScript library for the Cloudflare API
105 lines • 3.5 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { SinglePage } from "../../../core/pagination.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseACLs = /* @__PURE__ */ (() => {
class BaseACLs extends 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(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(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(path `/accounts/${account_id}/secondary_dns/acls`, (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(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(path `/accounts/${account_id}/secondary_dns/acls/${aclID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseACLs._key = Object.freeze([
'dns',
'zoneTransfers',
'acls',
]);
return BaseACLs;
})();
export class ACLs extends BaseACLs {
}
//# sourceMappingURL=acls.mjs.map