@aws/cloudfront-hosting-toolkit
Version:
CloudFront Hosting Toolkit offers the convenience of a managed frontend hosting service while retaining full control over the hosting and deployment infrastructure to make it your own.
84 lines (83 loc) • 4.53 kB
TypeScript
/**
* Checks the connection to the AWS account using AWS STS (Security Token Service).
* Returns true if the connection is successful, otherwise displays an error and exits.
*/
export default function checkAWSConnection(): Promise<boolean>;
/**
* Checks if a specified bucket exists in Amazon S3.
*
* @param {string} bucketName - The name of the bucket to check.
* @returns {Promise<boolean>} - Returns `true` if the bucket exists, `false` otherwise.
*/
export declare function checkBucketExists(bucketName: string): Promise<boolean>;
/**
* Checks if an ACM (AWS Certificate Manager) certificate exists for the specified domain name.
*
* @param {string} domainName - The primary domain name for which to check certificate existence.
* @returns {Promise<string | null>} - The ARN of the existing certificate, or null if not found.
*/
export declare const checkCertificateExists: (domainName: string) => Promise<{
certificateArn: string | undefined;
status: string | undefined;
}>;
/**
* Waits for an ACM (AWS Certificate Manager) certificate to be issued before proceeding.
*
* @param {string} certificateArn - The ARN (Amazon Resource Name) of the certificate to wait for.
* @param {string | undefined} hostedZoneId - The optional hosted zone ID associated with the certificate.
*/
export declare function waitCertificateToBeIssued(certificateArn: string, hostedZoneId: string | undefined): Promise<void>;
/**
* Creates or updates an Alias resource record set in Amazon Route 53 to associate a custom domain with a CloudFront distribution.
*
* @param {string} domainName - The custom domain name (CNAME) to be associated with the CloudFront distribution.
* @param {string} cloudFrontDomainName - The DNS name of the CloudFront distribution.
* @param {string} hostedZoneId - The ID of the Route 53 hosted zone where the Alias resource record will be created/updated.
*/
export declare function createCFARecord(domainName: string, cloudFrontDomainName: string, hostedZoneId: string): Promise<void>;
export declare function deleteCFCNAME(domainName: string, cloudFrontDomainName: string, hostedZoneId: string): Promise<void>;
export declare function checkCFARecordExists(domainName: string, cloudFrontDomainName: string, hostedZoneId: string): Promise<boolean>;
/**
* Creates an ACM (AWS Certificate Manager) certificate request for the specified domain name.
*
* @param {string} domainName - The primary domain name for which the certificate is requested.
* @returns {Promise<string>} - The ARN (Amazon Resource Name) of the created ACM certificate.
*/
export declare const createACMCertificate: (domainName: string) => Promise<string>;
/**
* Deletes an AWS ACM (Amazon Certificate Manager) certificate using its ARN (Amazon Resource Name).
*
* @param {string} certificateArn - The ARN of the ACM certificate to be deleted.
* @returns {Promise<void>} A Promise that resolves when the certificate is successfully deleted, or rejects on error.
*
* @throws {Error} If an error occurs during the deletion process.
*/
export declare const deleteACMCertificate: (certificateArn: string) => Promise<void>;
/**
* Validates an ACM (AWS Certificate Manager) certificate by ensuring the presence of a CNAME record.
* If the hostedZoneId is provided, it adds the CNAME record to the hosted zone for domain validation.
*
* @param {string} certificateArn - The ARN of the certificate to be validated.
* @param {string | undefined} hostedZoneId - The ID of the hosted zone where the CNAME record should be added.
*/
export declare function validateCertificate(certificateArn: string, hostedZoneId: string | undefined): Promise<void>;
/**
* Checks if there are any pending connections by querying the status of a CodeStar connection.
*
* @returns {Promise<boolean>} - True if there are pending connections, false otherwise.
*/
export declare function pendingConnections(): Promise<boolean>;
/**
* Retrieves the value of an AWS Systems Manager (SSM) parameter by name.
*
* @param {string} parameterName - The name of the SSM parameter to retrieve.
* @returns {Promise<string>} A Promise that resolves to the value of the SSM parameter.
* @throws {Error} If there is an error while retrieving the parameter.
*/
export declare function getSSMParameter(parameterName: string): Promise<string | undefined>;
export declare function startPipelineExecution(): Promise<void>;
export declare function getPipelineStatus(): Promise<{
status: string;
stageName: string;
}>;