cloudflare
Version:
The official TypeScript library for the Cloudflare API
61 lines • 2.48 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../resource.mjs";
import { SinglePage } from "../../../pagination.mjs";
export class Certificates extends APIResource {
/**
* Creates a new Zero Trust certificate.
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(`/accounts/${account_id}/gateway/certificates`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches all Zero Trust certificates for an account.
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList(`/accounts/${account_id}/gateway/certificates`, CertificateListResponsesSinglePage, options);
}
/**
* Deletes a gateway-managed Zero Trust certificate. A certificate must be
* deactivated from the edge (inactive) before it is deleted.
*/
delete(certificateId, params, options) {
const { account_id } = params;
return this._client.delete(`/accounts/${account_id}/gateway/certificates/${certificateId}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Binds a single Zero Trust certificate to the edge.
*/
activate(certificateId, params, options) {
const { account_id, body } = params;
return this._client.post(`/accounts/${account_id}/gateway/certificates/${certificateId}/activate`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Unbinds a single Zero Trust certificate from the edge
*/
deactivate(certificateId, params, options) {
const { account_id, body } = params;
return this._client.post(`/accounts/${account_id}/gateway/certificates/${certificateId}/deactivate`, {
body: body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches a single Zero Trust certificate.
*/
get(certificateId, params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/gateway/certificates/${certificateId}`, options)._thenUnwrap((obj) => obj.result);
}
}
export class CertificateListResponsesSinglePage extends SinglePage {
}
Certificates.CertificateListResponsesSinglePage = CertificateListResponsesSinglePage;
//# sourceMappingURL=certificates.mjs.map