def get_valid_workspaces_regions()

in source/ecs/workspaces_app.py [0:0]


def get_valid_workspaces_regions(partition):
    """
    :param: parition: AWS parition
    :return: List of supported AWS region
    This method returns the list of AWS regions where the Worskapces service is supported.
    """
    log.debug("Getting the regions where Workspace service is supported for partition {}".format(partition))
    list_valid_workspaces_regions = []
    if partition == 'aws-us-gov':
        list_valid_workspaces_regions = ['us-gov-west-1']
    elif partition == 'aws-cn':
        list_valid_workspaces_regions = ['cn-northwest-1']
    elif partition == 'aws':
        list_valid_workspaces_regions = ['ap-northeast-1', 'ap-northeast-2', 'ap-south-1', 'ap-southeast-1',
                                         'ap-southeast-2', 'ca-central-1', 'eu-central-1', 'eu-west-1', 'eu-west-2',
                                         'sa-east-1', 'us-east-1', 'us-west-2']
    try:
        list_valid_workspaces_regions = boto3.session.Session().get_available_regions('workspaces', partition)
    except Exception as e:
        log.error("Error getting the regions for the workspaces. Defaulting to set valid regions: {}".format(e))

    log.debug("Returning the regions where Workspace service is supported as {}".format(list_valid_workspaces_regions))
    return list_valid_workspaces_regions