Exemple #1
0
    def get_service_info(region):
        service_info_map = {
            'cn-north-1':
            ServiceInfo("vod.bytedanceapi.com", {'Accept': 'application/json'},
                        Credentials('', '', 'vod', 'cn-north-1'), 5, 5),
            'ap-singapore-1':
            ServiceInfo("vod.ap-singapore-1.bytedanceapi.com",
                        {'Accept': 'application/json'},
                        Credentials('', '', 'vod', 'ap-singapore-1'), 5, 5),
            'us-east-1':
            ServiceInfo("vod.us-east-1.bytedanceapi.com",
                        {'Accept': 'application/json'},
                        Credentials('', '', 'vod', 'us-east-1'), 5, 5),
        }
        service_info = service_info_map.get(region, None)
        if not service_info:
            raise Exception('Cant find the region, please check it carefully')

        return service_info
 def get_service_info():
     service_info = ServiceInfo("open.bytedanceapi.com",
                                {'Accept': 'application/json'},
                                Credentials('', '', 'edit',
                                            'cn-north-1'), 5000, 5000)
     return service_info
Exemple #3
0
IMAGEX_HOST_SG = "imagex.ap-singapore-1.bytedanceapi.com"

IMAGEX_INNER_HOST_CN = "imagex.byted.org"
IMAGEX_INNER_HOST_VA = "imagex.us-east-1.byted.org"
IMAGEX_INNER_HOST_SG = "imagex.ap-singapore-1.byted.org"

IMAGEX_SERVICE_NAME = "ImageX"
IMAGEX_API_VERSION = "2018-08-01"

ResourceServiceIdTRN = "trn:ImageX:*:*:ServiceId/%s"

service_info_map = {
    REGION_CN_NORTH1: ServiceInfo(
        IMAGEX_HOST_CN,
        {'Accept': 'application/json'},
        Credentials('', '', IMAGEX_SERVICE_NAME, REGION_CN_NORTH1),
        10, 10, "https"),
    REGION_AP_SINGAPORE1: ServiceInfo(
        IMAGEX_HOST_SG,
        {'Accept': 'application/json'},
        Credentials('', '', IMAGEX_SERVICE_NAME, REGION_AP_SINGAPORE1),
        10, 10, "https"),
    REGION_US_EAST1: ServiceInfo(
        IMAGEX_HOST_VA,
        {'Accept': 'application/json'},
        Credentials('', '', IMAGEX_SERVICE_NAME, REGION_US_EAST1),
        10, 10, "https"),
    INNER_REGION_CN_NORTH1: ServiceInfo(
        IMAGEX_INNER_HOST_CN,
        {'Accept': 'application/json'},
        Credentials('', '', IMAGEX_SERVICE_NAME, REGION_CN_NORTH1),
Exemple #4
0
 def get_service_info():
     service_info = ServiceInfo("iam.bytedanceapi.com",
                                {'Accept': 'application/json'},
                                Credentials('', '', 'iam',
                                            'cn-north-1'), 5, 5)
     return service_info