/**
 * AWS CloudFront Operations
 * Direct API calls without AWS CLI dependency
 */
import type { AWSRequestOptions } from './client';
interface CloudFrontTransport {
    request: (options: AWSRequestOptions) => Promise<any>;
}
export interface CloudFrontPublicKey {
    Id: string;
    Name: string;
    EncodedKey?: string;
    Comment?: string;
}
export interface CloudFrontKeyGroup {
    Id: string;
    Name: string;
    Items: string[];
    Comment?: string;
}
export interface ExistingDistributionOriginInput {
    id: string;
    domainName: string;
    pathPattern: string;
    originPath?: string;
    protocolPolicy?: 'https-only' | 'http-only' | 'match-viewer';
    customHeaders?: Record<string, string>;
    originAccessControlId?: string;
    replaceExisting?: boolean;
    dryRun?: boolean;
}
export interface ExistingDistributionOriginResult {
    distributionId: string;
    originId: string;
    domainName: string;
    pathPattern: string;
    changed: boolean;
    applied: boolean;
    originRemoved?: boolean;
    etag: string;
}
export interface InvalidationOptions {
    distributionId: string;
    paths: string[];
    callerReference?: string;
}
export interface Distribution {
    Id: string;
    ARN: string;
    Status: string;
    DomainName: string;
    Aliases?: {
        Quantity?: number;
        Items?: string[];
    };
    Enabled: boolean;
}
/**
 * CloudFront client using direct API calls
 */
export declare class CloudFrontClient {
    private client;
    constructor(profile?: string, transport?: CloudFrontTransport);
    private collectionItems;
    private validateExistingOriginInput;
    /**
     * Add a custom backend origin and path behavior to a live distribution while
     * preserving the existing default S3 origin and every unrelated field.
     */
    upsertExistingDistributionOrigin(distributionId: string, rawInput: ExistingDistributionOriginInput): Promise<ExistingDistributionOriginResult>;
    /** Remove only the named path behavior and remove its origin if now unused. */
    removeExistingDistributionOrigin(distributionId: string, rawInput: Pick<ExistingDistributionOriginInput, 'id' | 'domainName' | 'pathPattern' | 'dryRun'>): Promise<ExistingDistributionOriginResult>;
    /**
     * Create cache invalidation
     */
    createInvalidation(options: InvalidationOptions): Promise<{
        Id: string;
        Status: string;
        CreateTime: string;
    }>;
    /**
     * Get invalidation status
     */
    getInvalidation(distributionId: string, invalidationId: string): Promise<{
        Id: string;
        Status: string;
        CreateTime: string;
    }>;
    /**
     * List invalidations
     */
    listInvalidations(distributionId: string): Promise<Array<{
        Id: string;
        Status: string;
        CreateTime: string;
    }>>;
    /**
     * Wait for invalidation to complete
     */
    waitForInvalidation(distributionId: string, invalidationId: string): Promise<void>;
    /**
     * List distributions
     */
    listDistributions(): Promise<Distribution[]>;
    /**
     * Get distribution by ID
     */
    getDistribution(distributionId: string): Promise<Distribution>;
    /**
     * Get distribution configuration (full config including origins and cache behaviors)
     */
    getDistributionConfig(distributionId: string): Promise<{
        ETag: string;
        DistributionConfig: {
            Origins: {
                Quantity: number;
                Items: any;
            };
            DefaultCacheBehavior: {
                TargetOriginId: string;
                ViewerProtocolPolicy: string;
                AllowedMethods?: {
                    Quantity: number;
                    Items: string[];
                };
                CachedMethods?: {
                    Quantity: number;
                    Items: string[];
                };
                ForwardedValues?: any;
                TrustedSigners?: any;
                MinTTL?: number;
                DefaultTTL?: number;
                MaxTTL?: number;
            };
            CacheBehaviors?: {
                Quantity: number;
                Items: Array<{
                    PathPattern: string;
                    TargetOriginId: string;
                    ViewerProtocolPolicy: string;
                    AllowedMethods?: {
                        Quantity: number;
                        Items: string[];
                    };
                    CachedMethods?: {
                        Quantity: number;
                        Items: string[];
                    };
                    ForwardedValues?: any;
                    MinTTL?: number;
                    DefaultTTL?: number;
                    MaxTTL?: number;
                }>;
            };
            Aliases?: {
                Quantity: number;
                Items: string[];
            };
            Comment?: string;
            Enabled: boolean;
        };
    }>;
    /**
     * Invalidate all files
     */
    invalidateAll(distributionId: string): Promise<{
        Id: string;
        Status: string;
        CreateTime: string;
    }>;
    /**
     * Invalidate specific paths
     */
    invalidatePaths(distributionId: string, paths: string[]): Promise<{
        Id: string;
        Status: string;
        CreateTime: string;
    }>;
    /**
     * Invalidate by pattern
     */
    invalidatePattern(distributionId: string, pattern: string): Promise<{
        Id: string;
        Status: string;
        CreateTime: string;
    }>;
    /**
     * Invalidate after deployment
     * Useful for CI/CD pipelines
     */
    invalidateAfterDeployment(options: {
        distributionId: string;
        changedPaths?: string[];
        invalidateAll?: boolean;
        wait?: boolean;
    }): Promise<{
        invalidationId: string;
        status: string;
    }>;
    /**
     * Find distribution by domain name or alias
     */
    findDistributionByDomain(domain: string): Promise<Distribution | null>;
    /**
     * Batch invalidate multiple distributions
     * Useful for multi-region or blue/green deployments
     */
    batchInvalidate(distributionIds: string[], paths?: string[]): Promise<Array<{
        distributionId: string;
        invalidationId: string;
        status: string;
    }>>;
    /**
     * Update custom error responses for a distribution
     * Use this to configure how CloudFront handles 4xx/5xx errors from origins
     */
    updateCustomErrorResponses(options: {
        distributionId: string;
        customErrorResponses: Array<{
            errorCode: number;
            responsePagePath?: string;
            responseCode?: number;
            errorCachingMinTTL?: number;
        }>;
    }): Promise<{
        Distribution: Distribution;
        ETag: string;
    }>;
    /**
     * Remove all custom error responses from a distribution
     * This will make CloudFront return actual 4xx/5xx errors instead of custom pages
     */
    removeCustomErrorResponses(distributionId: string): Promise<{
        Distribution: Distribution;
        ETag: string;
    }>;
    /**
     * Update distribution configuration
     * This method updates the CloudFront distribution with new settings like aliases and certificates
     */
    updateDistribution(options: {
        distributionId: string;
        aliases?: string[];
        certificateArn?: string;
        comment?: string;
    }): Promise<{
        Distribution: Distribution;
        ETag: string;
    }>;
    /**
     * Helper to build XML from distribution config object
     * CloudFront requires specific XML structures - this method handles the complex nesting
     */
    private buildDistributionConfigXml;
    /**
     * Allow POST/PUT/PATCH/DELETE on the default cache behavior (and API cache behaviors).
     * Required when CloudFront fronts a Bun/Node app on EC2 instead of a static S3 site.
     */
    ensureDynamicHttpMethods(distributionId: string): Promise<boolean>;
    /**
     * Add aliases to a distribution
     */
    addAliases(distributionId: string, aliases: string[], certificateArn: string): Promise<{
        Distribution: Distribution;
        ETag: string;
    }>;
    /**
     * Create a CloudFront Function
     * CloudFront Functions are lightweight JavaScript functions for viewer request/response manipulation
     */
    createFunction(options: {
        name: string;
        code: string;
        comment?: string;
        runtime?: 'cloudfront-js-1.0' | 'cloudfront-js-2.0';
    }): Promise<{
        FunctionARN: string;
        Name: string;
        Stage: string;
        ETag: string;
    }>;
    /**
     * List CloudFront Functions
     */
    listFunctions(): Promise<Array<{
        Name: string;
        FunctionARN: string;
        Stage: string;
        CreatedTime: string;
        LastModifiedTime: string;
    }>>;
    /**
     * Get a CloudFront Function
     */
    getFunction(name: string, stage?: 'DEVELOPMENT' | 'LIVE'): Promise<{
        FunctionARN: string;
        Name: string;
        Stage: string;
        ETag: string;
        FunctionCode?: string;
    } | null>;
    /**
     * Publish a CloudFront Function (move from DEVELOPMENT to LIVE stage)
     * Can be called with just the name (will auto-fetch ETag) or with options object
     */
    publishFunction(nameOrOptions: string | {
        Name: string;
        IfMatch: string;
    }, etag?: string): Promise<{
        FunctionARN: string;
        Stage: string;
        FunctionSummary?: {
            Name: string;
            FunctionMetadata: {
                FunctionARN: string;
                Stage: string;
            };
        };
    }>;
    /**
     * Describe a CloudFront Function (get metadata including ETag)
     */
    describeFunction(options: {
        Name: string;
        Stage?: 'DEVELOPMENT' | 'LIVE';
    }): Promise<{
        ETag: string;
        FunctionSummary: {
            Name: string;
            Status: string;
            FunctionConfig: {
                Comment: string;
                Runtime: string;
            };
            FunctionMetadata: {
                FunctionARN: string;
                Stage: string;
                CreatedTime: string;
                LastModifiedTime: string;
            };
        };
    }>;
    /**
     * Update a CloudFront Function
     */
    updateFunction(options: {
        Name: string;
        FunctionCode: string;
        FunctionConfig: {
            Comment: string;
            Runtime: 'cloudfront-js-1.0' | 'cloudfront-js-2.0';
        };
        IfMatch: string;
    }): Promise<{
        ETag: string;
        FunctionSummary: {
            Name: string;
            FunctionMetadata: {
                FunctionARN: string;
                Stage: string;
            };
        };
    }>;
    /**
     * Delete a CloudFront Function
     */
    deleteFunction(name: string, etag?: string): Promise<void>;
    /**
     * Create a standard index.html rewrite function for S3 static sites
     * This function rewrites directory requests to index.html
     */
    createIndexRewriteFunction(name: string): Promise<{
        FunctionARN: string;
        Name: string;
        Stage: string;
        ETag: string;
    }>;
    /**
     * Get origin access control configurations
     */
    listOriginAccessControls(): Promise<Array<{
        Id: string;
        Name: string;
        Description?: string;
        SigningProtocol: string;
        SigningBehavior: string;
        OriginAccessControlOriginType: string;
    }>>;
    /**
     * Create an Origin Access Control for S3
     */
    createOriginAccessControl(options: {
        name: string;
        description?: string;
        signingProtocol?: 'sigv4';
        signingBehavior?: 'always' | 'never' | 'no-override';
        originType?: 's3' | 'mediastore' | 'mediapackagev2' | 'lambda';
    }): Promise<{
        Id: string;
        Name: string;
        Description: string;
        SigningProtocol: string;
        SigningBehavior: string;
        OriginAccessControlOriginType: string;
        ETag: string;
    }>;
    /**
     * Find or create an Origin Access Control
     */
    findOrCreateOriginAccessControl(name: string, originType?: 's3' | 'mediastore' | 'mediapackagev2' | 'lambda'): Promise<{
        Id: string;
        Name: string;
        isNew: boolean;
    }>;
    /**
     * Create a CloudFront distribution for a static S3 website
     */
    createDistributionForS3(options: {
        bucketName: string;
        bucketRegion: string;
        originAccessControlId: string;
        aliases?: string[];
        certificateArn?: string;
        defaultRootObject?: string;
        comment?: string;
        priceClass?: 'PriceClass_100' | 'PriceClass_200' | 'PriceClass_All';
        enabled?: boolean;
        trustedKeyGroupIds?: string[];
        mediaDelivery?: boolean;
    }): Promise<{
        Id: string;
        ARN: string;
        DomainName: string;
        Status: string;
        ETag: string;
    }>;
    /** Create a private-origin distribution tuned for immutable media and optional signed viewers. */
    createMediaDistributionForS3(options: {
        bucketName: string;
        bucketRegion: string;
        originAccessControlId: string;
        aliases?: string[];
        certificateArn?: string;
        comment?: string;
        priceClass?: 'PriceClass_100' | 'PriceClass_200' | 'PriceClass_All';
        enabled?: boolean;
        trustedKeyGroupIds?: string[];
    }): Promise<{
        Id: string;
        ARN: string;
        DomainName: string;
        Status: string;
        ETag: string;
    }>;
    /** List viewer public keys used by trusted key groups. */
    listPublicKeys(): Promise<CloudFrontPublicKey[]>;
    /** Register an RSA public key for CloudFront signed URLs and cookies. */
    createPublicKey(options: {
        name: string;
        encodedKey: string;
        comment?: string;
        callerReference?: string;
    }): Promise<CloudFrontPublicKey>;
    /** List trusted viewer key groups. */
    listKeyGroups(): Promise<CloudFrontKeyGroup[]>;
    /** Create a trusted key group for one or more registered public keys. */
    createKeyGroup(options: {
        name: string;
        publicKeyIds: string[];
        comment?: string;
    }): Promise<CloudFrontKeyGroup>;
    /**
     * Get S3 bucket policy for CloudFront OAC access
     */
    static getS3BucketPolicyForCloudFront(bucketName: string, distributionArn: string): object;
    /**
     * Wait for distribution to be deployed
     */
    waitForDistributionDeployed(distributionId: string, maxAttempts?: number): Promise<boolean>;
    /**
     * Disable a CloudFront distribution
     * Must be disabled before it can be deleted
     */
    disableDistribution(distributionId: string): Promise<{
        ETag: string;
    }>;
    /**
     * Delete a CloudFront distribution
     * Distribution must be disabled first
     */
    deleteDistribution(distributionId: string, etag?: string): Promise<void>;
    /**
     * Wait for distribution to be disabled (ready for deletion)
     */
    waitForDistributionDisabled(distributionId: string, maxAttempts?: number): Promise<boolean>;
    /**
     * Remove a specific alias (CNAME) from a CloudFront distribution
     * This allows the alias to be used by another distribution
     */
    removeAlias(distributionId: string, alias: string): Promise<{
        ETag: string;
    }>;
}
export {};
