cloudflare
Version:
The official TypeScript library for the Cloudflare API
71 lines • 3.6 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 path_1 = require("../../../internal/utils/path.js");
var BaseCertificates = /* @__PURE__ */ (() => {
class BaseCertificates extends resource_1.APIResource {
/**
* Replace a single custom certificate within a certificate pack that contains two
* bundled certificates. The replacement must adhere to the following constraints.
* You can only replace an RSA certificate with another RSA certificate or an ECDSA
* certificate with another ECDSA certificate.
*
* @example
* ```ts
* const certificate =
* await client.customHostnames.certificatePack.certificates.update(
* '0d89c70d-ad9f-4843-b99f-6cc0252067e9',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* custom_hostname_id:
* '0d89c70d-ad9f-4843-b99f-6cc0252067e9',
* certificate_pack_id:
* '0d89c70d-ad9f-4843-b99f-6cc0252067e9',
* custom_certificate:
* '-----BEGIN CERTIFICATE-----\nMIIDdjCCAl6gAwIBAgIJAPnMg0Fs+/B0MA0GCSqGSIb3DQEBCwUAMFsx...\n-----END CERTIFICATE-----\n',
* custom_key:
* '-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC/SCB5...\n-----END PRIVATE KEY-----\n',
* },
* );
* ```
*/
update(certificateID, params, options) {
const { zone_id, custom_hostname_id, certificate_pack_id, ...body } = params;
return this._client.put((0, path_1.path) `/zones/${zone_id}/custom_hostnames/${custom_hostname_id}/certificate_pack/${certificate_pack_id}/certificates/${certificateID}`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Delete a single custom certificate from a certificate pack that contains two
* bundled certificates. Deletion is subject to the following constraints. You
* cannot delete a certificate if it is the only remaining certificate in the pack.
* At least one certificate must remain in the pack.
*
* @example
* ```ts
* const certificate =
* await client.customHostnames.certificatePack.certificates.delete(
* '0d89c70d-ad9f-4843-b99f-6cc0252067e9',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* custom_hostname_id:
* '0d89c70d-ad9f-4843-b99f-6cc0252067e9',
* certificate_pack_id:
* '0d89c70d-ad9f-4843-b99f-6cc0252067e9',
* },
* );
* ```
*/
delete(certificateID, params, options) {
const { zone_id, custom_hostname_id, certificate_pack_id } = params;
return this._client.delete((0, path_1.path) `/zones/${zone_id}/custom_hostnames/${custom_hostname_id}/certificate_pack/${certificate_pack_id}/certificates/${certificateID}`, options);
}
}
BaseCertificates._key = Object.freeze(['customHostnames', 'certificatePack', 'certificates']);
return BaseCertificates;
})();
exports.BaseCertificates = BaseCertificates;
class Certificates extends BaseCertificates {
}
exports.Certificates = Certificates;
//# sourceMappingURL=certificates.js.map