cloudflare
Version:
The official TypeScript library for the Cloudflare API
123 lines • 6.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomCertificates = exports.BaseCustomCertificates = void 0;
const tslib_1 = require("../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const PrioritizeAPI = tslib_1.__importStar(require("./prioritize.js"));
const prioritize_1 = require("./prioritize.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BaseCustomCertificates = /* @__PURE__ */ (() => {
class BaseCustomCertificates extends resource_1.APIResource {
/**
* Upload a new SSL certificate for a zone.
*
* @example
* ```ts
* const customCertificate =
* await client.customCertificates.create({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* certificate:
* '-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n',
* });
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.post((0, path_1.path) `/zones/${zone_id}/custom_certificates`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* List, search, and filter all of your custom SSL certificates. The higher
* priority will break ties across overlapping 'legacy_custom' certificates, but
* 'legacy_custom' certificates will always supercede 'sni_custom' certificates.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const customCertificate of client.customCertificates.list(
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { zone_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/custom_certificates`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Remove a SSL certificate from a zone.
*
* @example
* ```ts
* const customCertificate =
* await client.customCertificates.delete(
* '2458ce5a-0c35-4c7f-82c7-8e9487d3ff60',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(customCertificateID, params, options) {
const { zone_id } = params;
return this._client.delete((0, path_1.path) `/zones/${zone_id}/custom_certificates/${customCertificateID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Upload a new private key and/or PEM/CRT for the SSL certificate. Note: PATCHing
* a configuration for sni_custom certificates will result in a new resource id
* being returned, and the previous one being deleted.
*
* @example
* ```ts
* const customCertificate =
* await client.customCertificates.edit(
* '2458ce5a-0c35-4c7f-82c7-8e9487d3ff60',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
edit(customCertificateID, params, options) {
const { zone_id, ...body } = params;
return this._client.patch((0, path_1.path) `/zones/${zone_id}/custom_certificates/${customCertificateID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves details for a specific custom SSL certificate, including certificate
* metadata, bundle method, geographic restrictions, and associated keyless server
* configuration.
*
* @example
* ```ts
* const customCertificate =
* await client.customCertificates.get(
* '2458ce5a-0c35-4c7f-82c7-8e9487d3ff60',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(customCertificateID, params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/custom_certificates/${customCertificateID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseCustomCertificates._key = Object.freeze([
'customCertificates',
]);
return BaseCustomCertificates;
})();
exports.BaseCustomCertificates = BaseCustomCertificates;
var CustomCertificates = /* @__PURE__ */ (() => {
class CustomCertificates extends BaseCustomCertificates {
constructor() {
super(...arguments);
this.prioritize = new PrioritizeAPI.Prioritize(this._client);
}
}
CustomCertificates.Prioritize = prioritize_1.Prioritize;
CustomCertificates.BasePrioritize = prioritize_1.BasePrioritize;
return CustomCertificates;
})();
exports.CustomCertificates = CustomCertificates;
//# sourceMappingURL=custom-certificates.js.map