@altostra/core
Version:
Core library for shared types and logic
70 lines (69 loc) • 2.28 kB
TypeScript
import type { NonEmptyString } from "../../../common/CustomTypes/NonEmptyString";
import type { Arn } from "../../CustomTypes/Arn";
import type { S3BucketName } from "../../CustomTypes/S3BucketName";
import { isBucketName } from "../../CustomTypes/S3BucketName";
export { isBucketName };
export declare function isBucketArn(value: unknown): boolean;
/**
* Checks if the provided value is an S3 bucket URL
* @param value A value to check if it is an S3 bucket URL
*/
export declare function isS3URL(value: unknown): boolean;
/**
* Converts the specified bucket id to an HTTPS bucket URL.
* @param arnOrS3Url An S3 bucket ARN, bucket-name, or an S3 Url (such as `s3://bucket-name`)
* @param region The bucket creation region
* @returns An HTTPS bucket URL
*/
export declare function toBucketHttpsUrl(arnOrS3Url: NonEmptyString | S3BucketName, region: NonEmptyString): NonEmptyString;
/**
* Specified various S3 bucket ids and its region
*/
export interface BucketIdentifiers {
/**
* Bucket's HTTPS URL
* @example `https://bucket-name.s3.us-west-1.amazonaws.com`
*/
httpsUrl: NonEmptyString;
/**
* The bucket global (region-less) domain
* @example `bucket-name.s3.amazonaws.com`
*/
domain: NonEmptyString;
/**
* The bucket regional domain
* @example `bucket-name.s3.us-west-1.amazonaws.com`
*/
regionalDomain: NonEmptyString;
/**
* Bucket's region
* @example `us-west-1`
*/
region: NonEmptyString;
/**
* Bucket's ARN
* @example `arn:aws:s3:::bucket-name`
*/
arn: Arn;
/**
* Bucket's S3 URL
* @example `s3://bucket-name
*/
s3Url: NonEmptyString;
/**
* The bucket's name
*/
bucketName: S3BucketName;
}
/**
* Checks if the provided value is an HTTPS bucket URL
* @param value A value to check if it is an HTTPS bucket URL
*/
export declare function isBucketHttpsUrl(value: unknown): boolean;
/**
* Returns an object containing various kinds of IDs for the bucket identified by
* the provided HTTPS bucket URL
* @param bucketHttpsUrl A bucket HTTPS URL such as `https://bucket-name.s3.us-west-1.amazonaws.com`
* @returns A `BucketIdentifiers` object
*/
export declare function getBucketIdentifiers(bucketHttpsUrl: NonEmptyString): BucketIdentifiers;