UNPKG

@moonset/util

Version:
44 lines (43 loc) 1.7 kB
import { ISDK } from './sdk-utils'; import * as EC2 from 'aws-sdk/clients/ec2'; import * as IAM from 'aws-sdk/clients/iam'; /** * Moonset uses CDK to setup minimum required resources like VPC, role, s3 log * bucket etc, and then uses SDK to invoke the EMR. This helper class retrieve * the CDK generated resources for SDK's consumption. * */ export declare class CDKResourceReader { private readonly session; private sdk; /** * Constructor. * * Arguments: * session: To distinguish different moonset instances in the same * account. Usally different sessions are created by different users. * * sdk: The interface that represent AWS SDK. We need different sdk * instances for different accounts such as the working account and * reference accounts. * */ constructor(session: string, sdk: ISDK); findSecurityGroup(tag: string): Promise<EC2.Types.SecurityGroup>; findVpc(tag: string): Promise<EC2.Types.Vpc>; findSubnets(tag: string): Promise<EC2.Types.SubnetList>; findPrivateSubnet(tag: string): Promise<EC2.Types.Subnet>; /** * IAM Role API doesn't work well with Tag. * Check https://github.com/boto/boto3/issues/1855 * * ResourceGroupsTaggingAPI also doesn't work well with IAM Role Tag. Check * the support list: * https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/Welcome.html * * So we go through all roles and check the tag for each role. */ findRole(tag: string): Promise<IAM.Types.Role>; findS3Bucket(tag: string): Promise<string>; findResourceArn(tag: string): Promise<string>; }