import { AwsCredentialIdentityProvider } from '@aws-sdk/types'; import { Config } from '@backstage/config'; /** * A set of credentials information for an AWS account. * * @public */ type AwsCredentialProvider = { /** * The AWS account ID of these credentials */ accountId?: string; /** * The STS region used with these credentials */ stsRegion?: string; /** * The ARN of the IAM role that these credentials are for, when they are * obtained by assuming a role, e.g. 'arn:aws:iam::123456789012:role/my-role' */ roleArn?: string; /** * The credential identity provider to use when creating AWS SDK for Javascript V3 clients */ sdkCredentialProvider: AwsCredentialIdentityProvider; }; /** * The options for specifying the AWS credentials to retrieve. * * @public */ type AwsCredentialProviderOptions = { /** * The AWS account ID, e.g. '0123456789012' */ accountId?: string; /** * The resource ARN that will be accessed with the returned credentials. * If account ID or region are not specified, they will be inferred from the ARN. */ arn?: string; }; /** * This allows implementations to be provided to retrieve AWS credentials. * * @public */ interface AwsCredentialsManager { /** * Get credentials for an AWS account. */ getCredentialProvider(opts?: AwsCredentialProviderOptions): Promise; } /** * Handles the creation and caching of credential providers for AWS accounts. * * @public */ declare class DefaultAwsCredentialsManager implements AwsCredentialsManager { static fromConfig(config: Config): DefaultAwsCredentialsManager; private readonly accountCredentialProviders; private readonly accountDefaults; private readonly mainAccountCredentialProvider; private readonly connections?; private mainAccountProviderFromConnections?; private constructor(); /** * Returns an {@link AwsCredentialProvider} for a given AWS account. * * @example * ```ts * const { provider } = await getCredentialProvider({ * accountId: '0123456789012', * }) * * const { provider } = await getCredentialProvider({ * arn: 'arn:aws:ecs:us-west-2:123456789012:service/my-http-service' * }) * ``` * * @param opts - the AWS account ID or AWS resource ARN * @returns A promise of {@link AwsCredentialProvider}. */ getCredentialProvider(opts?: AwsCredentialProviderOptions): Promise; private getMainAccountProviderFromConnections; private getCredentialProviderFromConnections; } export { DefaultAwsCredentialsManager }; export type { AwsCredentialProvider, AwsCredentialProviderOptions, AwsCredentialsManager };