cloudflare
Version:
The official TypeScript library for the Cloudflare API
66 lines • 3.36 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseCertificates = /* @__PURE__ */ (() => {
class BaseCertificates extends 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(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(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;
})();
export class Certificates extends BaseCertificates {
}
//# sourceMappingURL=certificates.mjs.map