71 lines
3.3 KiB
TypeScript
71 lines
3.3 KiB
TypeScript
import type { AssumeRoleCommandInput } from '@aws-sdk/client-sts';
|
|||
|
|
import type { CompleteMultipartUploadCommandOutput, DescribeImagesCommandInput, DescribeImagesCommandOutput, DescribeRepositoriesCommandInput, DescribeRepositoriesCommandOutput, GetAuthorizationTokenCommandInput, GetAuthorizationTokenCommandOutput, GetBucketEncryptionCommandInput, GetBucketEncryptionCommandOutput, GetBucketLocationCommandInput, GetBucketLocationCommandOutput, GetSecretValueCommandInput, GetSecretValueCommandOutput, ListObjectsV2CommandInput, ListObjectsV2CommandOutput, PutObjectCommandInput } from './aws-types';
|
||
|
|
export type AssumeRoleAdditionalOptions = Partial<Omit<AssumeRoleCommandInput, 'ExternalId' | 'RoleArn'>>;
|
||
|
|
export interface IS3Client {
|
||
|
|
getBucketEncryption(input: GetBucketEncryptionCommandInput): Promise<GetBucketEncryptionCommandOutput>;
|
||
|
|
getBucketLocation(input: GetBucketLocationCommandInput): Promise<GetBucketLocationCommandOutput>;
|
||
|
|
listObjectsV2(input: ListObjectsV2CommandInput): Promise<ListObjectsV2CommandOutput>;
|
||
|
|
upload(input: PutObjectCommandInput): Promise<CompleteMultipartUploadCommandOutput>;
|
||
|
|
}
|
||
|
|
export interface IECRClient {
|
||
|
|
describeImages(input: DescribeImagesCommandInput): Promise<DescribeImagesCommandOutput>;
|
||
|
|
describeRepositories(input: DescribeRepositoriesCommandInput): Promise<DescribeRepositoriesCommandOutput>;
|
||
|
|
getAuthorizationToken(input?: GetAuthorizationTokenCommandInput): Promise<GetAuthorizationTokenCommandOutput>;
|
||
|
|
}
|
||
|
|
export interface ISecretsManagerClient {
|
||
|
|
getSecretValue(input: GetSecretValueCommandInput): Promise<GetSecretValueCommandOutput>;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* AWS SDK operations required by Asset Publishing
|
||
|
|
*/
|
||
|
|
export interface IAws {
|
||
|
|
discoverPartition(): Promise<string>;
|
||
|
|
discoverDefaultRegion(): Promise<string>;
|
||
|
|
discoverCurrentAccount(): Promise<Account>;
|
||
|
|
discoverTargetAccount(options: ClientOptions): Promise<Account>;
|
||
|
|
s3Client(options: ClientOptions): Promise<IS3Client>;
|
||
|
|
ecrClient(options: ClientOptions): Promise<IECRClient>;
|
||
|
|
secretsManagerClient(options: ClientOptions): Promise<ISecretsManagerClient>;
|
||
|
|
}
|
||
|
|
export interface ClientOptions {
|
||
|
|
region?: string;
|
||
|
|
assumeRoleArn?: string;
|
||
|
|
assumeRoleExternalId?: string;
|
||
|
|
assumeRoleAdditionalOptions?: AssumeRoleAdditionalOptions;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* An AWS account
|
||
|
|
*
|
||
|
|
* An AWS account always exists in only one partition. Usually we don't care about
|
||
|
|
* the partition, but when we need to form ARNs we do.
|
||
|
|
*/
|
||
|
|
export interface Account {
|
||
|
|
/**
|
||
|
|
* The account number
|
||
|
|
*/
|
||
|
|
readonly accountId: string;
|
||
|
|
/**
|
||
|
|
* The partition ('aws' or 'aws-cn' or otherwise)
|
||
|
|
*/
|
||
|
|
readonly partition: string;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* AWS client using the AWS SDK for JS with no special configuration
|
||
|
|
*/
|
||
|
|
export declare class DefaultAwsClient implements IAws {
|
||
|
|
private readonly profile?;
|
||
|
|
private account?;
|
||
|
|
private config;
|
||
|
|
private readonly mainCredentials;
|
||
|
|
constructor(profile?: string | undefined);
|
||
|
|
s3Client(options: ClientOptions): Promise<IS3Client>;
|
||
|
|
ecrClient(options: ClientOptions): Promise<IECRClient>;
|
||
|
|
secretsManagerClient(options: ClientOptions): Promise<ISecretsManagerClient>;
|
||
|
|
discoverPartition(): Promise<string>;
|
||
|
|
discoverDefaultRegion(): Promise<string>;
|
||
|
|
discoverCurrentAccount(): Promise<Account>;
|
||
|
|
discoverTargetAccount(options: ClientOptions): Promise<Account>;
|
||
|
|
private getAccount;
|
||
|
|
private awsOptions;
|
||
|
|
}
|