Exemplo n.º 1
0
def get_subnets(subnet_ids: List[str], client: boto3.client) -> List[str]:
    try:
        response = client.describe_subnets(SubnetIds=subnet_ids)["Subnets"]
        results = [r["SubnetId"] for r in response]
    except ClientError as e:
        raise FailedActivity(e.response["Error"]["Message"])

    missing_subnets = [s for s in subnet_ids if s not in results]
    if missing_subnets:
        raise FailedActivity(f"Invalid subnet id(s): {missing_subnets}")
    return results
Exemplo n.º 2
0
def get_subnets(subnet_ids: List[str], client: boto3.client) -> List[str]:
    try:
        response = client.describe_subnets(SubnetIds=subnet_ids)['Subnets']
        results = [r['SubnetId'] for r in response]
    except ClientError as e:
        raise FailedActivity(e.response['Error']['Message'])

    missing_subnets = [s for s in subnet_ids if s not in results]
    if missing_subnets:
        raise FailedActivity('Invalid subnet id(s): {}'.format(
            missing_subnets))
    return results