# Copyright (c) 2017 CloudZero - ALL RIGHTS RESERVED - PROPRIETARY AND CONFIDENTIAL
# Unauthorized copying of this file and/or project, via any medium is strictly prohibited.
# Direct all questions to legal@cloudzero.com

"""
Contains sets of regions that we know how to support in CZRNs and CZRELs.

The AWS list is taken from the regions supported by s3, which is known to be supported in all AWS regions.
"""

import boto3

REGION_TRANSFORMS = {
    'global': 'cross-region',  # Some resources have a region of 'global'
    'GLOBAL': 'cross-region',
    'EU': 'eu-west-1'
}

# Load the set of AWS regions dynamically.  Note: there are other ways to do this, but this particular one
# does not make any service calls which is ideal for a library.  It also is only for the `aws` provider,
# not aws-cn or aws-us-gov.
temp_session = boto3.Session()
AWS_REGION_IDS = {x for x in temp_session.get_available_regions('s3')}

# This covers aws-cn and aws-us-gov providers, really just here for completeness
# Also covers Osaka Local Region (ap-northeast-3), not returned by boto3 because it requires special permissions
OTHER_REGION_IDS = {'cn-north-1', 'cn-northwest-1', 'us-gov-west-1', 'us-gov-east-1', 'ap-northeast-3'}

CLOUDZERO_REGION_IDS = {
    'cross-region', 'no-region'
}

ALL_REGION_IDS = AWS_REGION_IDS.union(CLOUDZERO_REGION_IDS).union(OTHER_REGION_IDS)
