cloudflare
Version:
The official TypeScript library for the Cloudflare API
62 lines • 2.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Hostnames = exports.BaseHostnames = 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 BaseHostnames = /* @__PURE__ */ (() => {
class BaseHostnames extends resource_1.APIResource {
/**
* Associate a hostname to a certificate and enable, disable or invalidate the
* association. If disabled, client certificate will not be sent to the hostname
* even if activated at the zone level. 100 maximum associations on a single
* certificate are allowed. Note: Use a null value for parameter _enabled_ to
* invalidate the association.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const hostnameUpdateResponse of client.originTLSClientAuth.hostnames.update(
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* config: [{}],
* },
* )) {
* // ...
* }
* ```
*/
update(params, options) {
const { zone_id, ...body } = params;
return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/origin_tls_client_auth/hostnames`, (pagination_1.SinglePage), { body, method: 'put', ...options });
}
/**
* Retrieves the client certificate authentication status for a specific hostname,
* showing whether authenticated origin pulls are enabled.
*
* @example
* ```ts
* const authenticatedOriginPull =
* await client.originTLSClientAuth.hostnames.get(
* 'app.example.com',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(hostname, params, options) {
const { zone_id } = params;
return this._client.get((0, path_1.path) `/zones/${zone_id}/origin_tls_client_auth/hostnames/${hostname}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseHostnames._key = Object.freeze([
'originTLSClientAuth',
'hostnames',
]);
return BaseHostnames;
})();
exports.BaseHostnames = BaseHostnames;
class Hostnames extends BaseHostnames {
}
exports.Hostnames = Hostnames;
//# sourceMappingURL=hostnames.js.map