cloudflare
Version:
The official TypeScript library for the Cloudflare API
122 lines • 4.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Certificates = exports.BaseCertificates = 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 BaseCertificates = /* @__PURE__ */ (() => {
class BaseCertificates extends resource_1.APIResource {
/**
* Create a new Zero Trust certificate.
*
* @example
* ```ts
* const certificate =
* await client.zeroTrust.gateway.certificates.create({
* account_id: '699d98642c564d2e855e9661899b7252',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/gateway/certificates`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List all Zero Trust certificates for an account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const certificateListResponse of client.zeroTrust.gateway.certificates.list(
* { account_id: '699d98642c564d2e855e9661899b7252' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/gateway/certificates`, (pagination_1.SinglePage), options);
}
/**
* Delete a gateway-managed Zero Trust certificate. You must deactivate the
* certificate from the edge (inactive) before deleting it.
*
* @example
* ```ts
* const certificate =
* await client.zeroTrust.gateway.certificates.delete(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
delete(certificateID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/gateway/certificates/${certificateID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Bind a single Zero Trust certificate to the edge.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.gateway.certificates.activate(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
activate(certificateID, params, options) {
const { account_id } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/gateway/certificates/${certificateID}/activate`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Unbind a single Zero Trust certificate from the edge.
*
* @example
* ```ts
* const response =
* await client.zeroTrust.gateway.certificates.deactivate(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
deactivate(certificateID, params, options) {
const { account_id } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/gateway/certificates/${certificateID}/deactivate`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Get a single Zero Trust certificate.
*
* @example
* ```ts
* const certificate =
* await client.zeroTrust.gateway.certificates.get(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '699d98642c564d2e855e9661899b7252' },
* );
* ```
*/
get(certificateID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/gateway/certificates/${certificateID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseCertificates._key = Object.freeze([
'zeroTrust',
'gateway',
'certificates',
]);
return BaseCertificates;
})();
exports.BaseCertificates = BaseCertificates;
class Certificates extends BaseCertificates {
}
exports.Certificates = Certificates;
//# sourceMappingURL=certificates.js.map