UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

117 lines • 6.12 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import * as PrioritizeAPI from "./prioritize.mjs"; import { BasePrioritize, Prioritize } from "./prioritize.mjs"; import { V4PagePaginationArray, } from "../../core/pagination.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseCustomCertificates = /* @__PURE__ */ (() => { class BaseCustomCertificates extends 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(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(path `/zones/${zone_id}/custom_certificates`, (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(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(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(path `/zones/${zone_id}/custom_certificates/${customCertificateID}`, options)._thenUnwrap((obj) => obj.result); } } BaseCustomCertificates._key = Object.freeze([ 'customCertificates', ]); return BaseCustomCertificates; })(); export var CustomCertificates = /* @__PURE__ */ (() => { class CustomCertificates extends BaseCustomCertificates { constructor() { super(...arguments); this.prioritize = new PrioritizeAPI.Prioritize(this._client); } } CustomCertificates.Prioritize = Prioritize; CustomCertificates.BasePrioritize = BasePrioritize; return CustomCertificates; })(); //# sourceMappingURL=custom-certificates.mjs.map