tccli 3.0.1274.1__py2.py3-none-any.whl → 3.0.1276.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tccli/__init__.py +1 -1
- tccli/services/__init__.py +0 -9
- tccli/services/ams/v20201229/api.json +82 -0
- tccli/services/asr/v20190614/api.json +1 -1
- tccli/services/batch/v20170312/api.json +24 -24
- tccli/services/cdwdoris/v20211228/api.json +19 -0
- tccli/services/cfw/v20190904/api.json +6 -6
- tccli/services/clb/v20180317/api.json +32 -4
- tccli/services/cloudstudio/v20230508/api.json +1 -1
- tccli/services/cvm/v20170312/api.json +48 -37
- tccli/services/cynosdb/v20190107/api.json +14 -4
- tccli/services/dlc/v20210125/api.json +17 -15
- tccli/services/dlc/v20210125/examples.json +4 -4
- tccli/services/dts/v20211206/api.json +1 -1
- tccli/services/emr/v20190103/api.json +24 -24
- tccli/services/es/v20180416/api.json +2 -2
- tccli/services/es/v20180416/examples.json +4 -4
- tccli/services/ess/ess_client.py +53 -0
- tccli/services/ess/v20201111/api.json +403 -322
- tccli/services/ess/v20201111/examples.json +16 -2
- tccli/services/essbasic/essbasic_client.py +53 -0
- tccli/services/essbasic/v20210526/api.json +310 -238
- tccli/services/essbasic/v20210526/examples.json +14 -0
- tccli/services/faceid/v20180301/api.json +3 -3
- tccli/services/lcic/v20220817/api.json +3 -3
- tccli/services/lighthouse/v20200324/api.json +6 -6
- tccli/services/live/v20180801/api.json +371 -380
- tccli/services/lke/lke_client.py +53 -0
- tccli/services/lke/v20231130/api.json +72 -2
- tccli/services/lke/v20231130/examples.json +8 -0
- tccli/services/ocr/v20181119/api.json +17 -7
- tccli/services/ocr/v20181119/examples.json +4 -4
- tccli/services/organization/v20210331/api.json +19 -0
- tccli/services/rce/v20201103/api.json +15 -15
- tccli/services/taf/v20200210/api.json +9 -9
- tccli/services/tcbr/v20220217/api.json +18 -0
- tccli/services/teo/v20220901/api.json +2 -2
- tccli/services/teo/v20220901/examples.json +1 -1
- tccli/services/tke/v20180525/api.json +328 -323
- tccli/services/tke/v20180525/examples.json +2 -2
- tccli/services/tke/v20220501/api.json +8 -8
- tccli/services/tse/v20201207/api.json +84 -4
- tccli/services/vm/v20201229/api.json +428 -78
- tccli/services/vm/v20210922/api.json +482 -82
- tccli/services/vpc/v20170312/api.json +2 -2
- tccli/services/weilingwith/v20230427/api.json +20 -20
- {tccli-3.0.1274.1.dist-info → tccli-3.0.1276.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1274.1.dist-info → tccli-3.0.1276.1.dist-info}/RECORD +51 -63
- tccli/services/lp/__init__.py +0 -4
- tccli/services/lp/lp_client.py +0 -207
- tccli/services/lp/v20200224/api.json +0 -311
- tccli/services/lp/v20200224/examples.json +0 -13
- tccli/services/rkp/__init__.py +0 -4
- tccli/services/rkp/rkp_client.py +0 -313
- tccli/services/rkp/v20191209/api.json +0 -564
- tccli/services/rkp/v20191209/examples.json +0 -29
- tccli/services/rp/__init__.py +0 -4
- tccli/services/rp/rp_client.py +0 -207
- tccli/services/rp/v20200224/api.json +0 -290
- tccli/services/rp/v20200224/examples.json +0 -13
- {tccli-3.0.1274.1.dist-info → tccli-3.0.1276.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1274.1.dist-info → tccli-3.0.1276.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1274.1.dist-info → tccli-3.0.1276.1.dist-info}/license_files/LICENSE +0 -0
    
        tccli/services/rkp/rkp_client.py
    DELETED
    
    | @@ -1,313 +0,0 @@ | |
| 1 | 
            -
            # -*- coding: utf-8 -*-
         | 
| 2 | 
            -
            import os
         | 
| 3 | 
            -
            import sys
         | 
| 4 | 
            -
            import six
         | 
| 5 | 
            -
            import json
         | 
| 6 | 
            -
            import tccli.options_define as OptionsDefine
         | 
| 7 | 
            -
            import tccli.format_output as FormatOutput
         | 
| 8 | 
            -
            from tccli import __version__
         | 
| 9 | 
            -
            from tccli.utils import Utils
         | 
| 10 | 
            -
            from tccli.exceptions import ConfigurationError, ClientError, ParamError
         | 
| 11 | 
            -
            from tencentcloud.common import credential
         | 
| 12 | 
            -
            from tencentcloud.common.profile.http_profile import HttpProfile
         | 
| 13 | 
            -
            from tencentcloud.common.profile.client_profile import ClientProfile
         | 
| 14 | 
            -
            from tencentcloud.rkp.v20191209 import rkp_client as rkp_client_v20191209
         | 
| 15 | 
            -
            from tencentcloud.rkp.v20191209 import models as models_v20191209
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            from jmespath import search
         | 
| 18 | 
            -
            import time
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            def doGetOpenId(args, parsed_globals):
         | 
| 21 | 
            -
                g_param = parse_global_arg(parsed_globals)
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
         | 
| 24 | 
            -
                    cred = credential.CVMRoleCredential()
         | 
| 25 | 
            -
                elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
         | 
| 26 | 
            -
                    cred = credential.STSAssumeRoleCredential(
         | 
| 27 | 
            -
                        g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
         | 
| 28 | 
            -
                        g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
         | 
| 29 | 
            -
                    )
         | 
| 30 | 
            -
                elif os.getenv(OptionsDefine.ENV_TKE_REGION)             and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID)             and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE)             and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
         | 
| 31 | 
            -
                    cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
         | 
| 32 | 
            -
                else:
         | 
| 33 | 
            -
                    cred = credential.Credential(
         | 
| 34 | 
            -
                        g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
         | 
| 35 | 
            -
                    )
         | 
| 36 | 
            -
                http_profile = HttpProfile(
         | 
| 37 | 
            -
                    reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
         | 
| 38 | 
            -
                    reqMethod="POST",
         | 
| 39 | 
            -
                    endpoint=g_param[OptionsDefine.Endpoint],
         | 
| 40 | 
            -
                    proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
         | 
| 41 | 
            -
                )
         | 
| 42 | 
            -
                profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
         | 
| 43 | 
            -
                if g_param[OptionsDefine.Language]:
         | 
| 44 | 
            -
                    profile.language = g_param[OptionsDefine.Language]
         | 
| 45 | 
            -
                mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
         | 
| 46 | 
            -
                client = mod.RkpClient(cred, g_param[OptionsDefine.Region], profile)
         | 
| 47 | 
            -
                client._sdkVersion += ("_CLI_" + __version__)
         | 
| 48 | 
            -
                models = MODELS_MAP[g_param[OptionsDefine.Version]]
         | 
| 49 | 
            -
                model = models.GetOpenIdRequest()
         | 
| 50 | 
            -
                model.from_json_string(json.dumps(args))
         | 
| 51 | 
            -
                start_time = time.time()
         | 
| 52 | 
            -
                while True:
         | 
| 53 | 
            -
                    rsp = client.GetOpenId(model)
         | 
| 54 | 
            -
                    result = rsp.to_json_string()
         | 
| 55 | 
            -
                    try:
         | 
| 56 | 
            -
                        json_obj = json.loads(result)
         | 
| 57 | 
            -
                    except TypeError as e:
         | 
| 58 | 
            -
                        json_obj = json.loads(result.decode('utf-8'))  # python3.3
         | 
| 59 | 
            -
                    if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
         | 
| 60 | 
            -
                        break
         | 
| 61 | 
            -
                    cur_time = time.time()
         | 
| 62 | 
            -
                    if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
         | 
| 63 | 
            -
                        raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
         | 
| 64 | 
            -
                        (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
         | 
| 65 | 
            -
                        search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
         | 
| 66 | 
            -
                    else:
         | 
| 67 | 
            -
                        print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
         | 
| 68 | 
            -
                    time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
         | 
| 69 | 
            -
                FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
         | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
            def doGetToken(args, parsed_globals):
         | 
| 73 | 
            -
                g_param = parse_global_arg(parsed_globals)
         | 
| 74 | 
            -
             | 
| 75 | 
            -
                if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
         | 
| 76 | 
            -
                    cred = credential.CVMRoleCredential()
         | 
| 77 | 
            -
                elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
         | 
| 78 | 
            -
                    cred = credential.STSAssumeRoleCredential(
         | 
| 79 | 
            -
                        g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
         | 
| 80 | 
            -
                        g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
         | 
| 81 | 
            -
                    )
         | 
| 82 | 
            -
                elif os.getenv(OptionsDefine.ENV_TKE_REGION)             and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID)             and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE)             and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
         | 
| 83 | 
            -
                    cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
         | 
| 84 | 
            -
                else:
         | 
| 85 | 
            -
                    cred = credential.Credential(
         | 
| 86 | 
            -
                        g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
         | 
| 87 | 
            -
                    )
         | 
| 88 | 
            -
                http_profile = HttpProfile(
         | 
| 89 | 
            -
                    reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
         | 
| 90 | 
            -
                    reqMethod="POST",
         | 
| 91 | 
            -
                    endpoint=g_param[OptionsDefine.Endpoint],
         | 
| 92 | 
            -
                    proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
         | 
| 93 | 
            -
                )
         | 
| 94 | 
            -
                profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
         | 
| 95 | 
            -
                if g_param[OptionsDefine.Language]:
         | 
| 96 | 
            -
                    profile.language = g_param[OptionsDefine.Language]
         | 
| 97 | 
            -
                mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
         | 
| 98 | 
            -
                client = mod.RkpClient(cred, g_param[OptionsDefine.Region], profile)
         | 
| 99 | 
            -
                client._sdkVersion += ("_CLI_" + __version__)
         | 
| 100 | 
            -
                models = MODELS_MAP[g_param[OptionsDefine.Version]]
         | 
| 101 | 
            -
                model = models.GetTokenRequest()
         | 
| 102 | 
            -
                model.from_json_string(json.dumps(args))
         | 
| 103 | 
            -
                start_time = time.time()
         | 
| 104 | 
            -
                while True:
         | 
| 105 | 
            -
                    rsp = client.GetToken(model)
         | 
| 106 | 
            -
                    result = rsp.to_json_string()
         | 
| 107 | 
            -
                    try:
         | 
| 108 | 
            -
                        json_obj = json.loads(result)
         | 
| 109 | 
            -
                    except TypeError as e:
         | 
| 110 | 
            -
                        json_obj = json.loads(result.decode('utf-8'))  # python3.3
         | 
| 111 | 
            -
                    if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
         | 
| 112 | 
            -
                        break
         | 
| 113 | 
            -
                    cur_time = time.time()
         | 
| 114 | 
            -
                    if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
         | 
| 115 | 
            -
                        raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
         | 
| 116 | 
            -
                        (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
         | 
| 117 | 
            -
                        search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
         | 
| 118 | 
            -
                    else:
         | 
| 119 | 
            -
                        print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
         | 
| 120 | 
            -
                    time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
         | 
| 121 | 
            -
                FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
         | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
            def doQueryDevAndRisk(args, parsed_globals):
         | 
| 125 | 
            -
                g_param = parse_global_arg(parsed_globals)
         | 
| 126 | 
            -
             | 
| 127 | 
            -
                if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
         | 
| 128 | 
            -
                    cred = credential.CVMRoleCredential()
         | 
| 129 | 
            -
                elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
         | 
| 130 | 
            -
                    cred = credential.STSAssumeRoleCredential(
         | 
| 131 | 
            -
                        g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
         | 
| 132 | 
            -
                        g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
         | 
| 133 | 
            -
                    )
         | 
| 134 | 
            -
                elif os.getenv(OptionsDefine.ENV_TKE_REGION)             and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID)             and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE)             and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
         | 
| 135 | 
            -
                    cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
         | 
| 136 | 
            -
                else:
         | 
| 137 | 
            -
                    cred = credential.Credential(
         | 
| 138 | 
            -
                        g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
         | 
| 139 | 
            -
                    )
         | 
| 140 | 
            -
                http_profile = HttpProfile(
         | 
| 141 | 
            -
                    reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
         | 
| 142 | 
            -
                    reqMethod="POST",
         | 
| 143 | 
            -
                    endpoint=g_param[OptionsDefine.Endpoint],
         | 
| 144 | 
            -
                    proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
         | 
| 145 | 
            -
                )
         | 
| 146 | 
            -
                profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
         | 
| 147 | 
            -
                if g_param[OptionsDefine.Language]:
         | 
| 148 | 
            -
                    profile.language = g_param[OptionsDefine.Language]
         | 
| 149 | 
            -
                mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
         | 
| 150 | 
            -
                client = mod.RkpClient(cred, g_param[OptionsDefine.Region], profile)
         | 
| 151 | 
            -
                client._sdkVersion += ("_CLI_" + __version__)
         | 
| 152 | 
            -
                models = MODELS_MAP[g_param[OptionsDefine.Version]]
         | 
| 153 | 
            -
                model = models.QueryDevAndRiskRequest()
         | 
| 154 | 
            -
                model.from_json_string(json.dumps(args))
         | 
| 155 | 
            -
                start_time = time.time()
         | 
| 156 | 
            -
                while True:
         | 
| 157 | 
            -
                    rsp = client.QueryDevAndRisk(model)
         | 
| 158 | 
            -
                    result = rsp.to_json_string()
         | 
| 159 | 
            -
                    try:
         | 
| 160 | 
            -
                        json_obj = json.loads(result)
         | 
| 161 | 
            -
                    except TypeError as e:
         | 
| 162 | 
            -
                        json_obj = json.loads(result.decode('utf-8'))  # python3.3
         | 
| 163 | 
            -
                    if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
         | 
| 164 | 
            -
                        break
         | 
| 165 | 
            -
                    cur_time = time.time()
         | 
| 166 | 
            -
                    if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
         | 
| 167 | 
            -
                        raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
         | 
| 168 | 
            -
                        (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
         | 
| 169 | 
            -
                        search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
         | 
| 170 | 
            -
                    else:
         | 
| 171 | 
            -
                        print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
         | 
| 172 | 
            -
                    time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
         | 
| 173 | 
            -
                FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
         | 
| 174 | 
            -
             | 
| 175 | 
            -
             | 
| 176 | 
            -
            CLIENT_MAP = {
         | 
| 177 | 
            -
                "v20191209": rkp_client_v20191209,
         | 
| 178 | 
            -
             | 
| 179 | 
            -
            }
         | 
| 180 | 
            -
             | 
| 181 | 
            -
            MODELS_MAP = {
         | 
| 182 | 
            -
                "v20191209": models_v20191209,
         | 
| 183 | 
            -
             | 
| 184 | 
            -
            }
         | 
| 185 | 
            -
             | 
| 186 | 
            -
            ACTION_MAP = {
         | 
| 187 | 
            -
                "GetOpenId": doGetOpenId,
         | 
| 188 | 
            -
                "GetToken": doGetToken,
         | 
| 189 | 
            -
                "QueryDevAndRisk": doQueryDevAndRisk,
         | 
| 190 | 
            -
             | 
| 191 | 
            -
            }
         | 
| 192 | 
            -
             | 
| 193 | 
            -
            AVAILABLE_VERSION_LIST = [
         | 
| 194 | 
            -
                "v20191209",
         | 
| 195 | 
            -
             | 
| 196 | 
            -
            ]
         | 
| 197 | 
            -
             | 
| 198 | 
            -
             | 
| 199 | 
            -
            def action_caller():
         | 
| 200 | 
            -
                return ACTION_MAP
         | 
| 201 | 
            -
             | 
| 202 | 
            -
             | 
| 203 | 
            -
            def parse_global_arg(parsed_globals):
         | 
| 204 | 
            -
                g_param = parsed_globals
         | 
| 205 | 
            -
                cvm_role_flag = True
         | 
| 206 | 
            -
                for param in parsed_globals.keys():
         | 
| 207 | 
            -
                    if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.RoleArn,
         | 
| 208 | 
            -
                                 OptionsDefine.RoleSessionName]:
         | 
| 209 | 
            -
                        if parsed_globals[param] is not None:
         | 
| 210 | 
            -
                            cvm_role_flag = False
         | 
| 211 | 
            -
                            break
         | 
| 212 | 
            -
                is_exist_profile = True
         | 
| 213 | 
            -
                if not parsed_globals["profile"]:
         | 
| 214 | 
            -
                    is_exist_profile = False
         | 
| 215 | 
            -
                    g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
         | 
| 216 | 
            -
             | 
| 217 | 
            -
                configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
         | 
| 218 | 
            -
                is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
         | 
| 219 | 
            -
                is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
         | 
| 220 | 
            -
             | 
| 221 | 
            -
                conf = {}
         | 
| 222 | 
            -
                cred = {}
         | 
| 223 | 
            -
             | 
| 224 | 
            -
                if is_conf_exist:
         | 
| 225 | 
            -
                    conf = Utils.load_json_msg(conf_path)
         | 
| 226 | 
            -
                if is_cred_exist:
         | 
| 227 | 
            -
                    cred = Utils.load_json_msg(cred_path)
         | 
| 228 | 
            -
             | 
| 229 | 
            -
                if not (isinstance(conf, dict) and isinstance(cred, dict)):
         | 
| 230 | 
            -
                    raise ConfigurationError(
         | 
| 231 | 
            -
                        "file: %s or %s is not json format"
         | 
| 232 | 
            -
                        % (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
         | 
| 233 | 
            -
             | 
| 234 | 
            -
                if OptionsDefine.Token not in cred:
         | 
| 235 | 
            -
                    cred[OptionsDefine.Token] = None
         | 
| 236 | 
            -
             | 
| 237 | 
            -
                if not is_exist_profile:
         | 
| 238 | 
            -
                    if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
         | 
| 239 | 
            -
                        cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
         | 
| 240 | 
            -
                        cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
         | 
| 241 | 
            -
                        cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
         | 
| 242 | 
            -
                        cvm_role_flag = False
         | 
| 243 | 
            -
             | 
| 244 | 
            -
                    if os.environ.get(OptionsDefine.ENV_REGION):
         | 
| 245 | 
            -
                        conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
         | 
| 246 | 
            -
             | 
| 247 | 
            -
                    if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
         | 
| 248 | 
            -
                        cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
         | 
| 249 | 
            -
                        cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
         | 
| 250 | 
            -
                        cvm_role_flag = False
         | 
| 251 | 
            -
                
         | 
| 252 | 
            -
                if cvm_role_flag:
         | 
| 253 | 
            -
                    if "type" in cred and cred["type"] == "cvm-role":
         | 
| 254 | 
            -
                        g_param[OptionsDefine.UseCVMRole.replace('-', '_')] = True
         | 
| 255 | 
            -
             | 
| 256 | 
            -
                for param in g_param.keys():
         | 
| 257 | 
            -
                    if g_param[param] is None:
         | 
| 258 | 
            -
                        if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
         | 
| 259 | 
            -
                            if param in cred:
         | 
| 260 | 
            -
                                g_param[param] = cred[param]
         | 
| 261 | 
            -
                            elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
         | 
| 262 | 
            -
                                      or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
         | 
| 263 | 
            -
                                raise ConfigurationError("%s is invalid" % param)
         | 
| 264 | 
            -
                        elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
         | 
| 265 | 
            -
                            if param in conf[OptionsDefine.SysParam]:
         | 
| 266 | 
            -
                                g_param[param] = conf[OptionsDefine.SysParam][param]
         | 
| 267 | 
            -
                            elif param != OptionsDefine.Language:
         | 
| 268 | 
            -
                                raise ConfigurationError("%s is invalid" % param)
         | 
| 269 | 
            -
                        elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
         | 
| 270 | 
            -
                            if param.replace('_', '-') in cred:
         | 
| 271 | 
            -
                                g_param[param] = cred[param.replace('_', '-')]
         | 
| 272 | 
            -
             | 
| 273 | 
            -
                try:
         | 
| 274 | 
            -
                    if g_param[OptionsDefine.ServiceVersion]:
         | 
| 275 | 
            -
                        g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
         | 
| 276 | 
            -
                    else:
         | 
| 277 | 
            -
                        version = conf["rkp"][OptionsDefine.Version]
         | 
| 278 | 
            -
                        g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
         | 
| 279 | 
            -
             | 
| 280 | 
            -
                    if g_param[OptionsDefine.Endpoint] is None:
         | 
| 281 | 
            -
                        g_param[OptionsDefine.Endpoint] = conf["rkp"][OptionsDefine.Endpoint]
         | 
| 282 | 
            -
                    g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
         | 
| 283 | 
            -
                except Exception as err:
         | 
| 284 | 
            -
                    raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
         | 
| 285 | 
            -
             | 
| 286 | 
            -
                if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
         | 
| 287 | 
            -
                    raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
         | 
| 288 | 
            -
             | 
| 289 | 
            -
                if g_param[OptionsDefine.Waiter]:
         | 
| 290 | 
            -
                    param = eval(g_param[OptionsDefine.Waiter])
         | 
| 291 | 
            -
                    if 'expr' not in param:
         | 
| 292 | 
            -
                        raise Exception('`expr` in `--waiter` must be defined')
         | 
| 293 | 
            -
                    if 'to' not in param:
         | 
| 294 | 
            -
                        raise Exception('`to` in `--waiter` must be defined')
         | 
| 295 | 
            -
                    if 'timeout' not in param:
         | 
| 296 | 
            -
                        if 'waiter' in conf and 'timeout' in conf['waiter']:
         | 
| 297 | 
            -
                            param['timeout'] = conf['waiter']['timeout']
         | 
| 298 | 
            -
                        else:
         | 
| 299 | 
            -
                            param['timeout'] = 180
         | 
| 300 | 
            -
                    if 'interval' not in param:
         | 
| 301 | 
            -
                        if 'waiter' in conf and 'interval' in conf['waiter']:
         | 
| 302 | 
            -
                            param['interval'] = conf['waiter']['interval']
         | 
| 303 | 
            -
                        else:
         | 
| 304 | 
            -
                            param['interval'] = 5
         | 
| 305 | 
            -
                    param['interval'] = min(param['interval'], param['timeout'])
         | 
| 306 | 
            -
                    g_param['OptionsDefine.WaiterInfo'] = param
         | 
| 307 | 
            -
             | 
| 308 | 
            -
                if six.PY2:
         | 
| 309 | 
            -
                    for key, value in g_param.items():
         | 
| 310 | 
            -
                        if isinstance(value, six.text_type):
         | 
| 311 | 
            -
                            g_param[key] = value.encode('utf-8')
         | 
| 312 | 
            -
                return g_param
         | 
| 313 | 
            -
             |