cloudflare
Version:
The official TypeScript library for the Cloudflare API
82 lines (72 loc) • 2.51 kB
text/typescript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as CustomCertificatesAPI from './custom-certificates';
import { CustomCertificatesSinglePage } from './custom-certificates';
import { PagePromise, SinglePage } from '../../core/pagination';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class BasePrioritize extends APIResource {
static override readonly _key: readonly ['customCertificates', 'prioritize'] = Object.freeze([
'customCertificates',
'prioritize',
] as const);
/**
* If a zone has multiple SSL certificates, you can set the order in which they
* should be used during a request. The higher priority will break ties across
* overlapping 'legacy_custom' certificates.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const customCertificate of client.customCertificates.prioritize.update(
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* certificates: [{}, {}],
* },
* )) {
* // ...
* }
* ```
*/
update(
params: PrioritizeUpdateParams,
options?: RequestOptions,
): PagePromise<CustomCertificatesSinglePage, CustomCertificatesAPI.CustomCertificate> {
const { zone_id, ...body } = params;
return this._client.getAPIList(
path`/zones/${zone_id}/custom_certificates/prioritize`,
SinglePage<CustomCertificatesAPI.CustomCertificate>,
{ body, method: 'put', ...options },
);
}
}
export class Prioritize extends BasePrioritize {}
export interface PrioritizeUpdateParams {
/**
* Path param: Identifier.
*/
zone_id: string;
/**
* Body param: Array of ordered certificates.
*/
certificates: Array<PrioritizeUpdateParams.Certificate>;
}
export namespace PrioritizeUpdateParams {
export interface Certificate {
/**
* Custom certificate identifier tag.
*/
id?: string;
/**
* The order/priority in which the certificate will be used in a request. The
* higher priority will break ties across overlapping 'legacy_custom' certificates,
* but 'legacy_custom' certificates will always supercede 'sni_custom'
* certificates.
*/
priority?: number;
}
}
export declare namespace Prioritize {
export { type PrioritizeUpdateParams as PrioritizeUpdateParams };
}
export { type CustomCertificatesSinglePage };