import type { SniEndpoint } from '@heroku/types/3.sdk'; import type { ResourceCtx } from '../../../core/extend-resource.js'; import type { SniCertificate } from './create-and-associate.js'; /** * Which of an app's SNI endpoints (SSL certificates) to select: by endpoint `name`, by a * `hostname` associated with it, or neither (`{}`) when the app has exactly one. Not both. */ export type SniEndpointSelector = { hostname: string; name?: never; } | { hostname?: never; name: string; } | { hostname?: never; name?: never; }; type ResolveOptions = { signal?: AbortSignal; }; export type SniEndpointInfoByAppOptions = ResolveOptions & { /** * Also fetch the hostname of each domain the endpoint is associated with, returned as * `domain_hostnames` in the same order as `domains` (which holds domain ids). */ includeDomainHostnames?: boolean; }; /** An SNI endpoint with the hostname of each associated domain, in `domains` order. */ export type SniEndpointWithDomainHostnames = SniEndpoint & { domain_hostnames: string[]; }; /** Thrown when no SNI endpoint on the app matches the selector. */ export declare class SniEndpointNotFoundError extends Error { readonly appIdentity: string; readonly selector: SniEndpointSelector; readonly id = "not_found"; readonly statusCode = 404; constructor(appIdentity: string, selector: SniEndpointSelector, message: string); get body(): { id: string; message: string; resource: string; }; } /** Thrown when the selector names nothing and the app has more than one SNI endpoint. */ export declare class SniEndpointAmbiguousError extends Error { readonly appIdentity: string; readonly matches: SniEndpoint[]; readonly id = "multiple_matches"; readonly statusCode = 422; constructor(appIdentity: string, matches: SniEndpoint[]); get body(): { id: string; matches: { id: string; name: string; }[]; message: string; }; } /** * One of an app's SNI endpoints, selected by `name`, by an associated `hostname`, or, with * `{}`, the app's only endpoint. With `includeDomainHostnames`, also the hostname of each * associated domain. * * API errors other than a 404 for the endpoint or domain, including a 404 for the app * itself, are rethrown as is. * * @throws `SniEndpointNotFoundError` when nothing matches: no endpoint by that name, the * hostname isn't a domain on the app or has no endpoint, or the app has no endpoints. * @throws `SniEndpointAmbiguousError` when the selector is `{}` and the app has several. * @throws `TypeError` when both `name` and `hostname` are given, or either is empty. */ export declare function infoByApp(ctx: Pick, appIdentity: string, selector: SniEndpointSelector | undefined, options: SniEndpointInfoByAppOptions & { includeDomainHostnames: true; }): Promise; export declare function infoByApp(ctx: Pick, appIdentity: string, selector?: SniEndpointSelector, options?: SniEndpointInfoByAppOptions): Promise; export type SniEndpointDeleteByAppOptions = ResolveOptions & { /** * Runs once the endpoint is selected, before it's deleted. Callers can confirm here; * a throw (or abort) prevents the delete. */ beforeDelete?: (preview: { sniEndpoint: SniEndpoint; }) => Promise | void; }; /** * Select an SNI endpoint as `infoByApp` does, with the same errors, and delete it. * @returns the deleted endpoint. */ export declare function deleteByApp(ctx: Pick, appIdentity: string, selector: SniEndpointSelector, options?: SniEndpointDeleteByAppOptions): Promise; export type SniEndpointUpdateByAppOptions = ResolveOptions & { /** * Runs once the endpoint is selected, before it's updated. Callers can confirm here; * a throw (or abort) prevents the update. */ beforeUpdate?: (preview: { sniEndpoint: SniEndpoint; }) => Promise | void; }; /** * Select an SNI endpoint as `infoByApp` does, with the same errors, and replace its * certificate. @returns the updated endpoint. */ export declare function updateByApp(ctx: Pick, appIdentity: string, selector: SniEndpointSelector, certificate: SniCertificate, options?: SniEndpointUpdateByAppOptions): Promise; export {};