UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

103 lines • 4.51 kB
// 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 { buildHeaders } from "../../../internal/headers.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseSAMLCertificates = /* @__PURE__ */ (() => { class BaseSAMLCertificates extends APIResource { /** * Returns a paginated list of the organization's SAML encryption certificate sets. * Each certificate set includes the current and (if present) previous * certificates. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const samlCertificateListResponse of client.zeroTrust.access.samlCertificates.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/access/saml_certificates`, (V4PagePaginationArray), { query, ...options }); } /** * Retrieves a specific SAML encryption certificate set by its UID, including both * current and previous certificates if available. * * @example * ```ts * const samlCertificate = * await client.zeroTrust.access.samlCertificates.get( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(samlCERTSetID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/access/saml_certificates/${samlCERTSetID}`, options)._thenUnwrap((obj) => obj.result); } /** * Downloads the current SAML encryption certificate's public key in PEM format for * the specified certificate set. This endpoint is useful for providing the * certificate to Identity Providers for SAML assertion encryption configuration. * * @example * ```ts * const response = * await client.zeroTrust.access.samlCertificates.getPem( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * * const content = await response.blob(); * console.log(content); * ``` */ getPem(samlCERTSetID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/access/saml_certificates/${samlCERTSetID}/pem`, { ...options, headers: buildHeaders([{ Accept: 'application/x-pem-file' }, options?.headers]), __binaryResponse: true, }); } /** * Rotates the SAML encryption certificates within the specified certificate set. * This generates a new certificate and moves the current certificate to the * previous slot. If a previous certificate exists, it will be deactivated and * removed. * * This endpoint ensures zero-downtime rotation by maintaining both current and * previous certificates during the transition period, allowing IdPs time to update * their configurations. Automated rotation happens 30 days before a current * certificate's expiration. * * @example * ```ts * const response = * await client.zeroTrust.access.samlCertificates.rotate( * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ rotate(samlCERTSetID, params, options) { const { account_id } = params; return this._client.post(path `/accounts/${account_id}/access/saml_certificates/${samlCERTSetID}/rotate`, options)._thenUnwrap((obj) => obj.result); } } BaseSAMLCertificates._key = Object.freeze([ 'zeroTrust', 'access', 'samlCertificates', ]); return BaseSAMLCertificates; })(); export class SAMLCertificates extends BaseSAMLCertificates { } //# sourceMappingURL=saml-certificates.mjs.map