cloudflare
Version:
The official TypeScript library for the Cloudflare API
85 lines • 3.52 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { V4PagePaginationArray } from "../../core/pagination.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseCustomTrustStore = /* @__PURE__ */ (() => {
class BaseCustomTrustStore extends APIResource {
/**
* Upload a root CA certificate to the Custom Origin Trust Store for a Zone. Only
* root CA certificates are accepted.
*
* @example
* ```ts
* const customTrustStore =
* await client.acm.customTrustStore.create({
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* certificate:
* '-----BEGIN CERTIFICATE-----\nMIIDdjCCAl6gAwIBAgIJAPnMg0Fs+/B0MA0GCSqGSIb3DQEBCwUAMFsx...\n-----END CERTIFICATE-----\n',
* });
* ```
*/
create(params, options) {
const { zone_id, ...body } = params;
return this._client.post(path `/zones/${zone_id}/acm/custom_trust_store`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Get Custom Origin Trust Store for a Zone.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const customTrustStore of client.acm.customTrustStore.list(
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { zone_id, ...query } = params;
return this._client.getAPIList(path `/zones/${zone_id}/acm/custom_trust_store`, (V4PagePaginationArray), { query, ...options });
}
/**
* Removes a root CA certificate from the custom origin trust store. Origins using
* certificates signed by this CA will no longer be trusted.
*
* @example
* ```ts
* const customTrustStore =
* await client.acm.customTrustStore.delete(
* '2458ce5a-0c35-4c7f-82c7-8e9487d3ff60',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(customOriginTrustStoreID, params, options) {
const { zone_id } = params;
return this._client.delete(path `/zones/${zone_id}/acm/custom_trust_store/${customOriginTrustStoreID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves details about a specific root CA certificate in the custom origin
* trust store, including expiration and subject information.
*
* @example
* ```ts
* const customTrustStore =
* await client.acm.customTrustStore.get(
* '2458ce5a-0c35-4c7f-82c7-8e9487d3ff60',
* { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(customOriginTrustStoreID, params, options) {
const { zone_id } = params;
return this._client.get(path `/zones/${zone_id}/acm/custom_trust_store/${customOriginTrustStoreID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseCustomTrustStore._key = Object.freeze([
'acm',
'customTrustStore',
]);
return BaseCustomTrustStore;
})();
export class CustomTrustStore extends BaseCustomTrustStore {
}
//# sourceMappingURL=custom-trust-store.mjs.map