/** * The minimal domain description needed to run a DNS diagnosis. */ export interface DomainDiagInfo { /** The domain hostname (e.g. `www.example.com`). */ hostname: string; /** The path prefix the domain is routed on (e.g. `/api`). */ pathPrefix: string; /** Whether the hostname is an apex domain (e.g. `example.com`, with no subdomain). */ isApex: boolean; } /** * The DNS records currently resolved for a domain. */ export interface ResolveDnsResult { /** The `A` records resolved for the domain. */ aRecords: Array; /** The `CNAME` records resolved for the domain. */ cnameRecords: Array; } /** * The DNS configuration expected by the Clever Cloud load balancer. */ export interface LoadBalancerDnsConfig { /** The `A` records the domain should point to. */ aRecords: Array; /** The `CNAME` record the domain should point to. */ cnameRecord: string; } /** * The result of a domain DNS diagnosis: the input {@link DomainDiagInfo} plus a summary and per-record details. */ export interface DomainDiag extends DomainDiagInfo { /** The overall diagnosis outcome. */ diagSummary: DiagSummary; /** The per-record diagnosis details. */ diagDetails: Array; } /** * The overall outcome of a domain diagnosis: * - `managed`: the domain is a Clever Cloud test domain, DNS is managed automatically. * - `no-config`: no relevant DNS record is configured. * - `invalid`: at least one resolved record points somewhere unexpected. * - `incomplete`: some expected records are missing but none are wrong. * - `valid`: DNS is correctly configured. */ export type DiagSummary = 'managed' | 'no-config' | 'invalid' | 'incomplete' | 'valid'; /** * The diagnosis of a single DNS record. */ export interface RecordDiag { /** The diagnosis code describing the record's status. */ code: 'valid-a' | 'unknown-a' | 'missing-a' | 'suggested-cname' | 'unknown-cname' | 'missing-cname' | 'test-only'; /** The record this diagnosis refers to, when applicable. */ record?: DomainRecord; } /** * A DNS record, either resolved from the domain or expected by the load balancer. */ export type DomainRecord = { /** Whether the record was `resolved` from DNS or is the `expected` configuration. */ source: 'resolved' | 'expected'; /** The record type. */ type: 'CNAME' | 'A'; /** The record value (an IP address for `A`, a hostname for `CNAME`). */ value: string; }; /** * Diagnoses the DNS configuration of a domain by comparing its resolved records against the * records expected by the Clever Cloud load balancer. * * Test domains (`*.cleverapps.io`) are managed automatically and always return a `managed` * summary with no details. For any other domain, both `resolveDnsResult` and * `loadBalancerDnsConfig` are required. * * @param domainInfo The domain to diagnose. * @param resolveDnsResult The DNS records currently resolved for the domain. Required for non-test domains. * @param loadBalancerDnsConfig The DNS records expected by the load balancer. Required for non-test domains. * @returns The diagnosis, with an overall summary and per-record details. * @throws {Error} If the domain is not a test domain and either `resolveDnsResult` or `loadBalancerDnsConfig` is missing. */ export declare function diagDomain(domainInfo: DomainDiagInfo, resolveDnsResult?: ResolveDnsResult, loadBalancerDnsConfig?: LoadBalancerDnsConfig): DomainDiag; //# sourceMappingURL=domain-diag.d.ts.map