import type { SniEndpoint } from '@heroku/types/3.sdk'; import type { ResourceCtx } from '../../../core/extend-resource.js'; import type { Poller } from '../../../utils/poller.js'; export type CreateAndAssociateOptions = { /** * Progress hooks for the domain readiness wait: * `domainPoller.onStart()` before polling begins, `domainPoller.onStop()` * once the app's domains reach ready status. */ domainPoller?: Poller; intervalMs?: number; /** Required. Given the wildcard-matched candidate hostnames, returns the subset to associate. */ resolveDomains: (candidates: string[]) => Promise; signal?: AbortSignal; timeoutMs?: number; }; /** * Create an SNI endpoint (SSL certificate) on an app and associate it with the * app's matching domains. * * Ports the CLI `certs:add` business logic into the SDK. * * Steps: * 1. Create the SNI endpoint from the given certificate chain and private key. * 2. Wait for the app's domains to reach ready status (replaces the old CNAME poll). * The SDK waits on domain STATUS (`succeeded`/`none`) via `domain.waitForReady` * rather than the CLI's old `cname`-defined readiness check, polling at a default * 1000ms interval to mirror the CLI's `waitForDomains` cadence. `timeoutMs` * defaults to 30s and is applied per pending domain (not a single global budget), * so an app with several pending domains can wait longer than 30s overall. * 3. List the (now stable) app domains and wildcard-match them against the * certificate's `cert_domains`. * 4. If any domains matched, invoke `resolveDomains` — the interactive selection * hook the consumer supplies — to choose which matched hostnames to associate. * 5. Associate the selected hostnames with the endpoint in parallel via * `PATCH /apps/{app}/domains/{hostname}` (`domain.update`). * * If no domains match the certificate, neither `resolveDomains` nor any * association call is made. * * @throws if the domain readiness wait times out or a domain fails, or if any * association call rejects. * @returns the created SNI endpoint. */ export declare function createAndAssociate(ctx: Pick, appIdentity: string, certificateChain: string, privateKey: string, options: CreateAndAssociateOptions): Promise;