UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

110 lines • 5.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.KeylessCertificates = exports.BaseKeylessCertificates = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const pagination_1 = require("../../core/pagination.js"); const path_1 = require("../../internal/utils/path.js"); var BaseKeylessCertificates = /* @__PURE__ */ (() => { class BaseKeylessCertificates extends resource_1.APIResource { /** * Creates a Keyless SSL configuration that allows SSL/TLS termination without * exposing private keys to Cloudflare. Keys remain on your infrastructure. * * @example * ```ts * const keylessCertificate = * await client.keylessCertificates.create({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * certificate: * '-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAM15n7fdxhRtMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV\nBAYTAlVTMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTQwMzExMTkyMTU5WhcNMTQwNDEwMTkyMTU5WjBF\nMQswCQYDVQQGEwJVUzETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAvq3sKsHpeduJHimOK+fvQdKsI8z8A05MZyyLp2/R/GE8FjNv+hkVY1WQ\nLIyTNNQH7CJecE1nbTfo8Y56S7x/rhxC6/DJ8MIulapFPnorq46KU6yRxiM0MQ3N\nnTJHlHA2ozZta6YBBfVfhHWl1F0IfNbXCLKvGwWWMbCx43OfW6KTkbRnE6gFWKuO\nfSO5h2u5TaWVuSIzBvYs7Vza6m+gtYAvKAJV2nSZ+eSEFPDo29corOy8+huEOUL8\n5FAw4BFPsr1TlrlGPFitduQUHGrSL7skk1ESGza0to3bOtrodKei2s9bk5MXm7lZ\nqI+WZJX4Zu9+mzZhc9pCVi8r/qlXuQIDAQABo4GnMIGkMB0GA1UdDgQWBBRvavf+\nsWM4IwKiH9X9w1vl6nUVRDB1BgNVHSMEbjBsgBRvavf+sWM4IwKiH9X9w1vl6nUV\nRKFJpEcwRTELMAkGA1UEBhMCVVMxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAM15n7fdxhRtMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBABY2ZzBaW0dMsAAT7tPJzrVWVzQx6KU4\nUEBLudIlWPlkAwTnINCWR/8eNjCCmGA4heUdHmazdpPa8RzwOmc0NT1NQqzSyktt\nvTqb4iHD7+8f9MqJ9/FssCfTtqr/Qst/hGH4Wmdf1EJ/6FqYAAb5iRlPgshFZxU8\nuXtA8hWn6fK6eISD9HBdcAFToUvKNZ1BIDPvh9f95Ine8ar6yGd56TUNrHR8eHBs\nESxz5ddVR/oWRysNJ+aGAyYqHS8S/ttmC7r4XCAHqXptkHPCGRqkAhsterYhd4I8\n/cBzejUobNCjjHFbtkAL/SjxZOLW+pNkZwfeYdM8iPkD54Uua1v2tdw=\n-----END CERTIFICATE-----', * host: 'example.com', * port: 24008, * }); * ``` */ create(params, options) { const { zone_id, ...body } = params; return this._client.post((0, path_1.path) `/zones/${zone_id}/keyless_certificates`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * List all Keyless SSL configurations for a given zone. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const keylessCertificate of client.keylessCertificates.list( * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { zone_id } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/keyless_certificates`, (pagination_1.SinglePage), options); } /** * Removes a Keyless SSL configuration. SSL connections will no longer use the * keyless server for cryptographic operations. * * @example * ```ts * const keylessCertificate = * await client.keylessCertificates.delete( * '4d2844d2ce78891c34d0b6c0535a291e', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(keylessCertificateID, params, options) { const { zone_id } = params; return this._client.delete((0, path_1.path) `/zones/${zone_id}/keyless_certificates/${keylessCertificateID}`, options)._thenUnwrap((obj) => obj.result); } /** * This will update attributes of a Keyless SSL. Consists of one or more of the * following: host,name,port. * * @example * ```ts * const keylessCertificate = * await client.keylessCertificates.edit( * '4d2844d2ce78891c34d0b6c0535a291e', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ edit(keylessCertificateID, params, options) { const { zone_id, ...body } = params; return this._client.patch((0, path_1.path) `/zones/${zone_id}/keyless_certificates/${keylessCertificateID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Get details for one Keyless SSL configuration. * * @example * ```ts * const keylessCertificate = * await client.keylessCertificates.get( * '4d2844d2ce78891c34d0b6c0535a291e', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(keylessCertificateID, params, options) { const { zone_id } = params; return this._client.get((0, path_1.path) `/zones/${zone_id}/keyless_certificates/${keylessCertificateID}`, options)._thenUnwrap((obj) => obj.result); } } BaseKeylessCertificates._key = Object.freeze([ 'keylessCertificates', ]); return BaseKeylessCertificates; })(); exports.BaseKeylessCertificates = BaseKeylessCertificates; class KeylessCertificates extends BaseKeylessCertificates { } exports.KeylessCertificates = KeylessCertificates; //# sourceMappingURL=keyless-certificates.js.map