tccli 3.0.1257.1__py2.py3-none-any.whl → 3.0.1259.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 +3 -0
- tccli/services/asr/v20190614/api.json +1 -1
- tccli/services/bi/v20220105/api.json +228 -225
- tccli/services/bi/v20220105/examples.json +22 -28
- tccli/services/ccc/ccc_client.py +61 -8
- tccli/services/ccc/v20200210/api.json +233 -1
- tccli/services/ccc/v20200210/examples.json +8 -0
- tccli/services/cdwdoris/v20211228/api.json +6 -6
- tccli/services/cdwdoris/v20211228/examples.json +2 -2
- tccli/services/cmq/v20190304/api.json +59 -59
- tccli/services/cmq/v20190304/examples.json +3 -3
- tccli/services/dbbrain/v20210527/api.json +9 -0
- tccli/services/dnspod/v20210323/examples.json +1 -1
- tccli/services/essbasic/essbasic_client.py +53 -0
- tccli/services/essbasic/v20210526/api.json +118 -0
- tccli/services/essbasic/v20210526/examples.json +8 -0
- tccli/services/faceid/v20180301/api.json +1 -1
- tccli/services/ocr/ocr_client.py +167 -61
- tccli/services/ocr/v20181119/api.json +409 -120
- tccli/services/ocr/v20181119/examples.json +21 -5
- tccli/services/rum/v20210622/api.json +56 -56
- tccli/services/rum/v20210622/examples.json +20 -20
- tccli/services/ses/v20201002/api.json +189 -115
- tccli/services/ses/v20201002/examples.json +8 -8
- tccli/services/ssl/ssl_client.py +61 -8
- tccli/services/ssl/v20191205/api.json +44 -0
- tccli/services/ssl/v20191205/examples.json +8 -0
- tccli/services/tccatalog/__init__.py +4 -0
- tccli/services/tccatalog/tccatalog_client.py +366 -0
- tccli/services/tccatalog/v20241024/api.json +525 -0
- tccli/services/tccatalog/v20241024/examples.json +37 -0
- tccli/services/trtc/v20190722/api.json +4 -4
- {tccli-3.0.1257.1.dist-info → tccli-3.0.1259.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1257.1.dist-info → tccli-3.0.1259.1.dist-info}/RECORD +38 -34
- {tccli-3.0.1257.1.dist-info → tccli-3.0.1259.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1257.1.dist-info → tccli-3.0.1259.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1257.1.dist-info → tccli-3.0.1259.1.dist-info}/license_files/LICENSE +0 -0
@@ -63,8 +63,8 @@
|
|
63
63
|
"CreateReceiverDetail": [
|
64
64
|
{
|
65
65
|
"document": "",
|
66
|
-
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateReceiverDetail\n<公共请求参数>\n\n{\n \"ReceiverId\":
|
67
|
-
"output": "{\n \"Response\": {\n \"RequestId\": \"
|
66
|
+
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateReceiverDetail\n<公共请求参数>\n\n{\n \"ReceiverId\": 1,\n \"Emails\": [\n \"example@gmail.com\",\n \"example@qq.com\"\n ]\n}",
|
67
|
+
"output": "{\n \"Response\": {\n \"EmptyEmailCount\": 0,\n \"RepeatCount\": 1,\n \"RequestId\": \"b7ba8907-7b5f-4750-be7e-573d3f75bf8c\",\n \"TooLongCount\": 0,\n \"TotalCount\": 2,\n \"ValidCount\": 1\n }\n}",
|
68
68
|
"title": "创建单个收件人"
|
69
69
|
}
|
70
70
|
],
|
@@ -182,7 +182,7 @@
|
|
182
182
|
{
|
183
183
|
"document": "",
|
184
184
|
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ListEmailAddress\n<公共请求参数>\n\n{}",
|
185
|
-
"output": "{\n \"Response\": {\n \"RequestId\": \"8979fc1e-9564-4fc9-bf7d-2958ce679b72\",\n \"EmailSenders\": [\n {\n \"EmailAddress\": \"service@mail.qcloud.com\",\n \"EmailSenderName\": \"腾讯云邮件通知\",\n \"CreatedTimestamp\": 1602143617\n },\n {\n \"EmailAddress\": \"verify@mail.qcloud.com\",\n \"EmailSenderName\": \"腾讯云验证码\",\n \"CreatedTimestamp\": 1602143617\n }\n ]\n }\n}",
|
185
|
+
"output": "{\n \"Response\": {\n \"RequestId\": \"8979fc1e-9564-4fc9-bf7d-2958ce679b72\",\n \"EmailSenders\": [\n {\n \"EmailAddress\": \"service@mail.qcloud.com\",\n \"EmailSenderName\": \"腾讯云邮件通知\",\n \"CreatedTimestamp\": 1602143617,\n \"SmtpPwdType\": 0\n },\n {\n \"EmailAddress\": \"verify@mail.qcloud.com\",\n \"EmailSenderName\": \"腾讯云验证码\",\n \"CreatedTimestamp\": 1602143617,\n \"SmtpPwdType\": 1\n }\n ]\n }\n}",
|
186
186
|
"title": "获取发信地址列表"
|
187
187
|
}
|
188
188
|
],
|
@@ -213,8 +213,8 @@
|
|
213
213
|
"ListReceivers": [
|
214
214
|
{
|
215
215
|
"document": "",
|
216
|
-
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ListReceivers\n<公共请求参数>\n\n{\n \"Status\": 1,\n \"Offset\": 1,\n \"Limit\": 1,\n \"KeyWord\": \"
|
217
|
-
"output": "{\n \"Response\": {\n \"TotalCount\": 1,\n \"Data\": [\n {\n \"Count\": 1,\n \"ReceiversStatus\": 1,\n \"ReceiverId\": 123,\n \"ReceiversName\": \"name\",\n \"CreateTime\": \"2021-09-28 16:40:35\",\n \"Desc\": \"
|
216
|
+
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ListReceivers\n<公共请求参数>\n\n{\n \"Status\": 1,\n \"Offset\": 1,\n \"Limit\": 1,\n \"KeyWord\": \"keyword\"\n}",
|
217
|
+
"output": "{\n \"Response\": {\n \"TotalCount\": 1,\n \"Data\": [\n {\n \"Count\": 1,\n \"ReceiversStatus\": 1,\n \"ReceiverId\": 123,\n \"ReceiversName\": \"name\",\n \"CreateTime\": \"2021-09-28 16:40:35\",\n \"Desc\": \"some description\"\n }\n ],\n \"RequestId\": \"38049379278d43208c59916a4806b0c4\"\n }\n}",
|
218
218
|
"title": "查询收件人列表"
|
219
219
|
}
|
220
220
|
],
|
@@ -222,7 +222,7 @@
|
|
222
222
|
{
|
223
223
|
"document": "",
|
224
224
|
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ListSendTasks\n<公共请求参数>\n\n{\n \"Status\": 1,\n \"Offset\": 1,\n \"Limit\": 1,\n \"ReceiverId\": 123,\n \"TaskType\": 1\n}",
|
225
|
-
"output": "{\n \"Response\": {\n \"TotalCount\": 1,\n \"Data\": [\n {\n \"CacheCount\": 1,\n \"UpdateTime\": \"2021-09-09 10:10:10\",\n \"SendCount\": 1,\n \"TimedParam\": {\n \"BeginTime\": \"2021-09-09 10:10:10\"\n },\n \"FromEmailAddress\": \"abc@cd.com\",\n \"TaskStatus\": 1,\n \"ReceiverId\": 1,\n \"RequestCount\": 1,\n \"TaskId\": \"
|
225
|
+
"output": "{\n \"Response\": {\n \"TotalCount\": 1,\n \"Data\": [\n {\n \"CacheCount\": 1,\n \"UpdateTime\": \"2021-09-09 10:10:10\",\n \"SendCount\": 1,\n \"TimedParam\": {\n \"BeginTime\": \"2021-09-09 10:10:10\"\n },\n \"FromEmailAddress\": \"abc@cd.com\",\n \"TaskStatus\": 1,\n \"ReceiverId\": 1,\n \"RequestCount\": 1,\n \"TaskId\": \"1\",\n \"TaskType\": 1,\n \"Template\": {\n \"TemplateData\": \"{\\\"name\\\":\\\"name\\\"}\",\n \"TemplateID\": 1\n },\n \"CycleParam\": {\n \"IntervalTime\": 1,\n \"BeginTime\": \"2021-09-09 10:10:10\",\n \"TermCycle\": 1\n },\n \"CreateTime\": \"2021-09-09 10:10:10\",\n \"Subject\": \"邮件主题\",\n \"ErrMsg\": \"\",\n \"ReceiversName\": \"名称\"\n }\n ],\n \"RequestId\": \"38049379278d43208c59916a4806b0c4\"\n }\n}",
|
226
226
|
"title": "查询任务"
|
227
227
|
}
|
228
228
|
],
|
@@ -265,7 +265,7 @@
|
|
265
265
|
"UpdateEmailSmtpPassWord": [
|
266
266
|
{
|
267
267
|
"document": "设置smtp密码:包含新增和修改密码",
|
268
|
-
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: UpdateEmailSmtpPassWord\n<公共请求参数>\n\n{\n \"Password\": \"
|
268
|
+
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: UpdateEmailSmtpPassWord\n<公共请求参数>\n\n{\n \"Password\": \"yourPassword\",\n \"EmailAddress\": \"address@example.com\"\n}",
|
269
269
|
"output": "{\n \"Response\": {\n \"RequestId\": \"8979fc1e-9564-4fc9-bf7d-2958ce679b72\"\n }\n}",
|
270
270
|
"title": "设置smtp密码"
|
271
271
|
}
|
@@ -273,7 +273,7 @@
|
|
273
273
|
"UpdateEmailTemplate": [
|
274
274
|
{
|
275
275
|
"document": "",
|
276
|
-
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: UpdateEmailTemplate\n<公共请求参数>\n\n{\n \"TemplateID\": 10091,\n \"TemplateName\": \"
|
276
|
+
"input": "POST / HTTP/1.1\nHost: ses.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: UpdateEmailTemplate\n<公共请求参数>\n\n{\n \"TemplateID\": 10091,\n \"TemplateName\": \"myTemplate\",\n \"TemplateContent\": {\n \"Html\": \"PGh0bWw+dGhpcyBpcyBhIGV4YW1wbGUge3tjb2RlfX08L2h0bWw+\",\n \"Text\": \"dGhpcyBpcyBhIGV4YW1wbGU=\"\n }\n}",
|
277
277
|
"output": "{\n \"Response\": {\n \"RequestId\": \"8979fc1e-9564-4fc9-bf7d-2958ce679b72\"\n }\n}",
|
278
278
|
"title": "更新模板内容"
|
279
279
|
}
|
tccli/services/ssl/ssl_client.py
CHANGED
@@ -1681,6 +1681,58 @@ def doDescribeManagerDetail(args, parsed_globals):
|
|
1681
1681
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1682
1682
|
|
1683
1683
|
|
1684
|
+
def doCheckCertificateExist(args, parsed_globals):
|
1685
|
+
g_param = parse_global_arg(parsed_globals)
|
1686
|
+
|
1687
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1688
|
+
cred = credential.CVMRoleCredential()
|
1689
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1690
|
+
cred = credential.STSAssumeRoleCredential(
|
1691
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1692
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1693
|
+
)
|
1694
|
+
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):
|
1695
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1696
|
+
else:
|
1697
|
+
cred = credential.Credential(
|
1698
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1699
|
+
)
|
1700
|
+
http_profile = HttpProfile(
|
1701
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1702
|
+
reqMethod="POST",
|
1703
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
1704
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1705
|
+
)
|
1706
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1707
|
+
if g_param[OptionsDefine.Language]:
|
1708
|
+
profile.language = g_param[OptionsDefine.Language]
|
1709
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1710
|
+
client = mod.SslClient(cred, g_param[OptionsDefine.Region], profile)
|
1711
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
1712
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1713
|
+
model = models.CheckCertificateExistRequest()
|
1714
|
+
model.from_json_string(json.dumps(args))
|
1715
|
+
start_time = time.time()
|
1716
|
+
while True:
|
1717
|
+
rsp = client.CheckCertificateExist(model)
|
1718
|
+
result = rsp.to_json_string()
|
1719
|
+
try:
|
1720
|
+
json_obj = json.loads(result)
|
1721
|
+
except TypeError as e:
|
1722
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1723
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1724
|
+
break
|
1725
|
+
cur_time = time.time()
|
1726
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1727
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1728
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1729
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1730
|
+
else:
|
1731
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1732
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1733
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1734
|
+
|
1735
|
+
|
1684
1736
|
def doDescribeHostDeployRecordDetail(args, parsed_globals):
|
1685
1737
|
g_param = parse_global_arg(parsed_globals)
|
1686
1738
|
|
@@ -2305,7 +2357,7 @@ def doDescribeHostUpdateRecord(args, parsed_globals):
|
|
2305
2357
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
2306
2358
|
|
2307
2359
|
|
2308
|
-
def
|
2360
|
+
def doCreateCertificateByPackage(args, parsed_globals):
|
2309
2361
|
g_param = parse_global_arg(parsed_globals)
|
2310
2362
|
|
2311
2363
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -2334,11 +2386,11 @@ def doCreateCertificate(args, parsed_globals):
|
|
2334
2386
|
client = mod.SslClient(cred, g_param[OptionsDefine.Region], profile)
|
2335
2387
|
client._sdkVersion += ("_CLI_" + __version__)
|
2336
2388
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
2337
|
-
model = models.
|
2389
|
+
model = models.CreateCertificateByPackageRequest()
|
2338
2390
|
model.from_json_string(json.dumps(args))
|
2339
2391
|
start_time = time.time()
|
2340
2392
|
while True:
|
2341
|
-
rsp = client.
|
2393
|
+
rsp = client.CreateCertificateByPackage(model)
|
2342
2394
|
result = rsp.to_json_string()
|
2343
2395
|
try:
|
2344
2396
|
json_obj = json.loads(result)
|
@@ -2669,7 +2721,7 @@ def doDescribeHostApiGatewayInstanceList(args, parsed_globals):
|
|
2669
2721
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
2670
2722
|
|
2671
2723
|
|
2672
|
-
def
|
2724
|
+
def doCreateCertificate(args, parsed_globals):
|
2673
2725
|
g_param = parse_global_arg(parsed_globals)
|
2674
2726
|
|
2675
2727
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -2698,11 +2750,11 @@ def doCreateCertificateByPackage(args, parsed_globals):
|
|
2698
2750
|
client = mod.SslClient(cred, g_param[OptionsDefine.Region], profile)
|
2699
2751
|
client._sdkVersion += ("_CLI_" + __version__)
|
2700
2752
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
2701
|
-
model = models.
|
2753
|
+
model = models.CreateCertificateRequest()
|
2702
2754
|
model.from_json_string(json.dumps(args))
|
2703
2755
|
start_time = time.time()
|
2704
2756
|
while True:
|
2705
|
-
rsp = client.
|
2757
|
+
rsp = client.CreateCertificate(model)
|
2706
2758
|
result = rsp.to_json_string()
|
2707
2759
|
try:
|
2708
2760
|
json_obj = json.loads(result)
|
@@ -3180,6 +3232,7 @@ ACTION_MAP = {
|
|
3180
3232
|
"DescribeHostLiveInstanceList": doDescribeHostLiveInstanceList,
|
3181
3233
|
"DescribeHostWafInstanceList": doDescribeHostWafInstanceList,
|
3182
3234
|
"DescribeManagerDetail": doDescribeManagerDetail,
|
3235
|
+
"CheckCertificateExist": doCheckCertificateExist,
|
3183
3236
|
"DescribeHostDeployRecordDetail": doDescribeHostDeployRecordDetail,
|
3184
3237
|
"DeployCertificateRecordRollback": doDeployCertificateRecordRollback,
|
3185
3238
|
"DeployCertificateRecordRetry": doDeployCertificateRecordRetry,
|
@@ -3192,14 +3245,14 @@ ACTION_MAP = {
|
|
3192
3245
|
"ModifyCertificateAlias": doModifyCertificateAlias,
|
3193
3246
|
"DescribeHostUpdateRecordDetail": doDescribeHostUpdateRecordDetail,
|
3194
3247
|
"DescribeHostUpdateRecord": doDescribeHostUpdateRecord,
|
3195
|
-
"
|
3248
|
+
"CreateCertificateByPackage": doCreateCertificateByPackage,
|
3196
3249
|
"UploadConfirmLetter": doUploadConfirmLetter,
|
3197
3250
|
"DescribeHostLighthouseInstanceList": doDescribeHostLighthouseInstanceList,
|
3198
3251
|
"UpdateCertificateRecordRollback": doUpdateCertificateRecordRollback,
|
3199
3252
|
"DescribeHostVodInstanceList": doDescribeHostVodInstanceList,
|
3200
3253
|
"DescribeCertificateOperateLogs": doDescribeCertificateOperateLogs,
|
3201
3254
|
"DescribeHostApiGatewayInstanceList": doDescribeHostApiGatewayInstanceList,
|
3202
|
-
"
|
3255
|
+
"CreateCertificate": doCreateCertificate,
|
3203
3256
|
"CreateCertificateBindResourceSyncTask": doCreateCertificateBindResourceSyncTask,
|
3204
3257
|
"ModifyCertificatesExpiringNotificationSwitch": doModifyCertificatesExpiringNotificationSwitch,
|
3205
3258
|
"ReplaceCertificate": doReplaceCertificate,
|
@@ -35,6 +35,13 @@
|
|
35
35
|
"output": "CheckCertificateDomainVerificationResponse",
|
36
36
|
"status": "online"
|
37
37
|
},
|
38
|
+
"CheckCertificateExist": {
|
39
|
+
"document": "根据证书内容检测当前账号下是否存在一致的证书, 存在则返回证书ID, 不存在则返回空",
|
40
|
+
"input": "CheckCertificateExistRequest",
|
41
|
+
"name": "检测证书内容是否存在",
|
42
|
+
"output": "CheckCertificateExistResponse",
|
43
|
+
"status": "online"
|
44
|
+
},
|
38
45
|
"CommitCertificateInformation": {
|
39
46
|
"document": "提交证书订单到CA机构。",
|
40
47
|
"input": "CommitCertificateInformationRequest",
|
@@ -1854,6 +1861,43 @@
|
|
1854
1861
|
],
|
1855
1862
|
"type": "object"
|
1856
1863
|
},
|
1864
|
+
"CheckCertificateExistRequest": {
|
1865
|
+
"document": "CheckCertificateExist请求参数结构体",
|
1866
|
+
"members": [
|
1867
|
+
{
|
1868
|
+
"disabled": false,
|
1869
|
+
"document": "证书公钥内容, 包含证书链",
|
1870
|
+
"example": "无",
|
1871
|
+
"member": "string",
|
1872
|
+
"name": "CertificatePublicKey",
|
1873
|
+
"required": true,
|
1874
|
+
"type": "string"
|
1875
|
+
}
|
1876
|
+
],
|
1877
|
+
"type": "object"
|
1878
|
+
},
|
1879
|
+
"CheckCertificateExistResponse": {
|
1880
|
+
"document": "CheckCertificateExist返回参数结构体",
|
1881
|
+
"members": [
|
1882
|
+
{
|
1883
|
+
"disabled": false,
|
1884
|
+
"document": "重复的证书ID\n注意:此字段可能返回 null,表示取不到有效值。",
|
1885
|
+
"example": "无",
|
1886
|
+
"member": "string",
|
1887
|
+
"name": "RepeatCertId",
|
1888
|
+
"output_required": true,
|
1889
|
+
"type": "string",
|
1890
|
+
"value_allowed_null": true
|
1891
|
+
},
|
1892
|
+
{
|
1893
|
+
"document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
|
1894
|
+
"member": "string",
|
1895
|
+
"name": "RequestId",
|
1896
|
+
"type": "string"
|
1897
|
+
}
|
1898
|
+
],
|
1899
|
+
"type": "object"
|
1900
|
+
},
|
1857
1901
|
"ClbInstanceDetail": {
|
1858
1902
|
"document": "clb实例详情",
|
1859
1903
|
"members": [
|
@@ -40,6 +40,14 @@
|
|
40
40
|
"title": "检查证书域名验证"
|
41
41
|
}
|
42
42
|
],
|
43
|
+
"CheckCertificateExist": [
|
44
|
+
{
|
45
|
+
"document": "",
|
46
|
+
"input": "POST / HTTP/1.1\nHost: ssl.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CheckCertificateExist\n<公共请求参数>\n\n{\n \"CertificatePublicKey\": \"abc\"\n}",
|
47
|
+
"output": "{\n \"Response\": {\n \"RepeatCertId\": \"abc\",\n \"RequestId\": \"abc\"\n }\n}",
|
48
|
+
"title": "查询证书内容是否存在"
|
49
|
+
}
|
50
|
+
],
|
43
51
|
"CommitCertificateInformation": [
|
44
52
|
{
|
45
53
|
"document": "提交证书订单",
|
@@ -0,0 +1,366 @@
|
|
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.tccatalog.v20241024 import tccatalog_client as tccatalog_client_v20241024
|
15
|
+
from tencentcloud.tccatalog.v20241024 import models as models_v20241024
|
16
|
+
|
17
|
+
from jmespath import search
|
18
|
+
import time
|
19
|
+
|
20
|
+
def doDescribeTccCatalogs(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.TccatalogClient(cred, g_param[OptionsDefine.Region], profile)
|
47
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
48
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
49
|
+
model = models.DescribeTccCatalogsRequest()
|
50
|
+
model.from_json_string(json.dumps(args))
|
51
|
+
start_time = time.time()
|
52
|
+
while True:
|
53
|
+
rsp = client.DescribeTccCatalogs(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 doDescribeTccCatalog(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.TccatalogClient(cred, g_param[OptionsDefine.Region], profile)
|
99
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
100
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
101
|
+
model = models.DescribeTccCatalogRequest()
|
102
|
+
model.from_json_string(json.dumps(args))
|
103
|
+
start_time = time.time()
|
104
|
+
while True:
|
105
|
+
rsp = client.DescribeTccCatalog(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 doBindTccVpcEndPointServiceWhiteList(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.TccatalogClient(cred, g_param[OptionsDefine.Region], profile)
|
151
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
152
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
153
|
+
model = models.BindTccVpcEndPointServiceWhiteListRequest()
|
154
|
+
model.from_json_string(json.dumps(args))
|
155
|
+
start_time = time.time()
|
156
|
+
while True:
|
157
|
+
rsp = client.BindTccVpcEndPointServiceWhiteList(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
|
+
def doAcceptTccVpcEndPointConnect(args, parsed_globals):
|
177
|
+
g_param = parse_global_arg(parsed_globals)
|
178
|
+
|
179
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
180
|
+
cred = credential.CVMRoleCredential()
|
181
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
182
|
+
cred = credential.STSAssumeRoleCredential(
|
183
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
184
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
185
|
+
)
|
186
|
+
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):
|
187
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
188
|
+
else:
|
189
|
+
cred = credential.Credential(
|
190
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
191
|
+
)
|
192
|
+
http_profile = HttpProfile(
|
193
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
194
|
+
reqMethod="POST",
|
195
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
196
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
197
|
+
)
|
198
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
199
|
+
if g_param[OptionsDefine.Language]:
|
200
|
+
profile.language = g_param[OptionsDefine.Language]
|
201
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
202
|
+
client = mod.TccatalogClient(cred, g_param[OptionsDefine.Region], profile)
|
203
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
204
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
205
|
+
model = models.AcceptTccVpcEndPointConnectRequest()
|
206
|
+
model.from_json_string(json.dumps(args))
|
207
|
+
start_time = time.time()
|
208
|
+
while True:
|
209
|
+
rsp = client.AcceptTccVpcEndPointConnect(model)
|
210
|
+
result = rsp.to_json_string()
|
211
|
+
try:
|
212
|
+
json_obj = json.loads(result)
|
213
|
+
except TypeError as e:
|
214
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
215
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
216
|
+
break
|
217
|
+
cur_time = time.time()
|
218
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
219
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
220
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
221
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
222
|
+
else:
|
223
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
224
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
225
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
226
|
+
|
227
|
+
|
228
|
+
CLIENT_MAP = {
|
229
|
+
"v20241024": tccatalog_client_v20241024,
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
MODELS_MAP = {
|
234
|
+
"v20241024": models_v20241024,
|
235
|
+
|
236
|
+
}
|
237
|
+
|
238
|
+
ACTION_MAP = {
|
239
|
+
"DescribeTccCatalogs": doDescribeTccCatalogs,
|
240
|
+
"DescribeTccCatalog": doDescribeTccCatalog,
|
241
|
+
"BindTccVpcEndPointServiceWhiteList": doBindTccVpcEndPointServiceWhiteList,
|
242
|
+
"AcceptTccVpcEndPointConnect": doAcceptTccVpcEndPointConnect,
|
243
|
+
|
244
|
+
}
|
245
|
+
|
246
|
+
AVAILABLE_VERSION_LIST = [
|
247
|
+
"v20241024",
|
248
|
+
|
249
|
+
]
|
250
|
+
|
251
|
+
|
252
|
+
def action_caller():
|
253
|
+
return ACTION_MAP
|
254
|
+
|
255
|
+
|
256
|
+
def parse_global_arg(parsed_globals):
|
257
|
+
g_param = parsed_globals
|
258
|
+
cvm_role_flag = True
|
259
|
+
for param in parsed_globals.keys():
|
260
|
+
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.RoleArn,
|
261
|
+
OptionsDefine.RoleSessionName]:
|
262
|
+
if parsed_globals[param] is not None:
|
263
|
+
cvm_role_flag = False
|
264
|
+
break
|
265
|
+
is_exist_profile = True
|
266
|
+
if not parsed_globals["profile"]:
|
267
|
+
is_exist_profile = False
|
268
|
+
g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
|
269
|
+
|
270
|
+
configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
|
271
|
+
is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
|
272
|
+
is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
|
273
|
+
|
274
|
+
conf = {}
|
275
|
+
cred = {}
|
276
|
+
|
277
|
+
if is_conf_exist:
|
278
|
+
conf = Utils.load_json_msg(conf_path)
|
279
|
+
if is_cred_exist:
|
280
|
+
cred = Utils.load_json_msg(cred_path)
|
281
|
+
|
282
|
+
if not (isinstance(conf, dict) and isinstance(cred, dict)):
|
283
|
+
raise ConfigurationError(
|
284
|
+
"file: %s or %s is not json format"
|
285
|
+
% (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
|
286
|
+
|
287
|
+
if OptionsDefine.Token not in cred:
|
288
|
+
cred[OptionsDefine.Token] = None
|
289
|
+
|
290
|
+
if not is_exist_profile:
|
291
|
+
if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
|
292
|
+
cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
|
293
|
+
cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
|
294
|
+
cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
|
295
|
+
cvm_role_flag = False
|
296
|
+
|
297
|
+
if os.environ.get(OptionsDefine.ENV_REGION):
|
298
|
+
conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
|
299
|
+
|
300
|
+
if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
|
301
|
+
cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
|
302
|
+
cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
|
303
|
+
cvm_role_flag = False
|
304
|
+
|
305
|
+
if cvm_role_flag:
|
306
|
+
if "type" in cred and cred["type"] == "cvm-role":
|
307
|
+
g_param[OptionsDefine.UseCVMRole.replace('-', '_')] = True
|
308
|
+
|
309
|
+
for param in g_param.keys():
|
310
|
+
if g_param[param] is None:
|
311
|
+
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
|
312
|
+
if param in cred:
|
313
|
+
g_param[param] = cred[param]
|
314
|
+
elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
|
315
|
+
or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
|
316
|
+
raise ConfigurationError("%s is invalid" % param)
|
317
|
+
elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
|
318
|
+
if param in conf[OptionsDefine.SysParam]:
|
319
|
+
g_param[param] = conf[OptionsDefine.SysParam][param]
|
320
|
+
elif param != OptionsDefine.Language:
|
321
|
+
raise ConfigurationError("%s is invalid" % param)
|
322
|
+
elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
|
323
|
+
if param.replace('_', '-') in cred:
|
324
|
+
g_param[param] = cred[param.replace('_', '-')]
|
325
|
+
|
326
|
+
try:
|
327
|
+
if g_param[OptionsDefine.ServiceVersion]:
|
328
|
+
g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
|
329
|
+
else:
|
330
|
+
version = conf["tccatalog"][OptionsDefine.Version]
|
331
|
+
g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
|
332
|
+
|
333
|
+
if g_param[OptionsDefine.Endpoint] is None:
|
334
|
+
g_param[OptionsDefine.Endpoint] = conf["tccatalog"][OptionsDefine.Endpoint]
|
335
|
+
g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
|
336
|
+
except Exception as err:
|
337
|
+
raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
|
338
|
+
|
339
|
+
if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
|
340
|
+
raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
|
341
|
+
|
342
|
+
if g_param[OptionsDefine.Waiter]:
|
343
|
+
param = eval(g_param[OptionsDefine.Waiter])
|
344
|
+
if 'expr' not in param:
|
345
|
+
raise Exception('`expr` in `--waiter` must be defined')
|
346
|
+
if 'to' not in param:
|
347
|
+
raise Exception('`to` in `--waiter` must be defined')
|
348
|
+
if 'timeout' not in param:
|
349
|
+
if 'waiter' in conf and 'timeout' in conf['waiter']:
|
350
|
+
param['timeout'] = conf['waiter']['timeout']
|
351
|
+
else:
|
352
|
+
param['timeout'] = 180
|
353
|
+
if 'interval' not in param:
|
354
|
+
if 'waiter' in conf and 'interval' in conf['waiter']:
|
355
|
+
param['interval'] = conf['waiter']['interval']
|
356
|
+
else:
|
357
|
+
param['interval'] = 5
|
358
|
+
param['interval'] = min(param['interval'], param['timeout'])
|
359
|
+
g_param['OptionsDefine.WaiterInfo'] = param
|
360
|
+
|
361
|
+
if six.PY2:
|
362
|
+
for key, value in g_param.items():
|
363
|
+
if isinstance(value, six.text_type):
|
364
|
+
g_param[key] = value.encode('utf-8')
|
365
|
+
return g_param
|
366
|
+
|