tccli 3.0.1189.1__py2.py3-none-any.whl → 3.0.1191.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/command.py +7 -1
- tccli/configure.py +11 -3
- tccli/loaders.py +43 -8
- tccli/oauth.py +115 -0
- tccli/plugin.py +30 -0
- tccli/plugins/__init__.py +0 -0
- tccli/plugins/auth/__init__.py +59 -0
- tccli/plugins/auth/browser_flow.py +88 -0
- tccli/plugins/auth/login.py +130 -0
- tccli/plugins/auth/logout.py +21 -0
- tccli/plugins/auth/texts.py +30 -0
- tccli/plugins/test/__init__.py +87 -0
- tccli/plugins/test/add.py +31 -0
- tccli/services/__init__.py +2 -1
- tccli/services/apm/v20210622/api.json +19 -0
- tccli/services/cam/cam_client.py +138 -32
- tccli/services/cam/v20190116/api.json +203 -0
- tccli/services/cam/v20190116/examples.json +16 -0
- tccli/services/cdb/v20170320/api.json +4 -4
- tccli/services/cfg/v20210820/api.json +1 -1
- tccli/services/cfw/v20190904/api.json +82 -2
- tccli/services/dasb/dasb_client.py +53 -0
- tccli/services/dasb/v20191018/api.json +168 -0
- tccli/services/dasb/v20191018/examples.json +8 -0
- tccli/services/dlc/v20210125/api.json +287 -37
- tccli/services/dlc/v20210125/examples.json +18 -18
- tccli/services/dsgc/v20190723/api.json +13 -3
- tccli/services/emr/v20190103/api.json +1 -1
- tccli/services/ess/v20201111/api.json +56 -23
- tccli/services/ess/v20201111/examples.json +7 -1
- tccli/services/essbasic/v20210526/api.json +28 -1
- tccli/services/essbasic/v20210526/examples.json +6 -0
- tccli/services/iotexplorer/v20190423/api.json +2 -2
- tccli/services/iss/iss_client.py +118 -65
- tccli/services/iss/v20230517/api.json +78 -0
- tccli/services/iss/v20230517/examples.json +8 -0
- tccli/services/mps/v20190612/api.json +257 -8
- tccli/services/ocr/v20181119/api.json +10 -0
- tccli/services/region/v20220627/api.json +11 -11
- tccli/services/region/v20220627/examples.json +1 -1
- tccli/services/sms/v20210111/api.json +9 -9
- tccli/services/ssl/v20191205/api.json +3 -3
- tccli/services/ssl/v20191205/examples.json +2 -2
- tccli/services/tat/v20201028/api.json +10 -0
- tccli/services/tcb/v20180608/api.json +2 -2
- tccli/services/tdmq/v20200217/api.json +2 -2
- tccli/services/tdmq/v20200217/examples.json +2 -2
- tccli/services/tke/tke_client.py +364 -46
- tccli/services/tke/v20180525/api.json +9 -0
- tccli/services/tke/v20220501/api.json +525 -0
- tccli/services/tke/v20220501/examples.json +54 -0
- tccli/services/tmt/v20180321/api.json +2 -2
- tccli/services/vdb/v20230616/api.json +29 -1
- tccli/services/vod/v20180717/api.json +30 -9
- tccli/services/vod/v20180717/examples.json +1 -1
- tccli/services/vod/v20240718/api.json +121 -0
- tccli/services/vod/v20240718/examples.json +31 -0
- tccli/services/vod/vod_client.py +58 -0
- tccli/services/vpc/v20170312/api.json +9 -0
- tccli/services/wedata/v20210820/api.json +1 -1
- {tccli-3.0.1189.1.dist-info → tccli-3.0.1191.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1189.1.dist-info → tccli-3.0.1191.1.dist-info}/RECORD +66 -54
- {tccli-3.0.1189.1.dist-info → tccli-3.0.1191.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1189.1.dist-info → tccli-3.0.1191.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1189.1.dist-info → tccli-3.0.1191.1.dist-info}/license_files/LICENSE +0 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
"""
|
3
|
+
如何自定义插件
|
4
|
+
1. 定义一个 spec 对象,参考以下代码
|
5
|
+
2. export 一个函数,名字叫做 register_service,它负责向 cli 注册 spec
|
6
|
+
|
7
|
+
注册完成后,用户可以通过 tccli {服务名} {接口名} --{参数1}={参数值} ... 的方式调用
|
8
|
+
|
9
|
+
如下所示:
|
10
|
+
定义了一个服务名叫 test, 包含一个接口 add, add 接口接受 2 个参数 number1, number2
|
11
|
+
则用户可以以如下方式调用 tccli
|
12
|
+
tccli test add --number1=3 --number2=5
|
13
|
+
"""
|
14
|
+
from tccli.plugins.test.add import add_command
|
15
|
+
|
16
|
+
service_name = "test"
|
17
|
+
service_version = "2024-08-07"
|
18
|
+
|
19
|
+
_spec = {
|
20
|
+
"metadata": {
|
21
|
+
# 产品名
|
22
|
+
"serviceShortName": service_name,
|
23
|
+
# 产品版本号
|
24
|
+
"apiVersion": service_version,
|
25
|
+
# 产品介绍
|
26
|
+
"description": "this is a test module",
|
27
|
+
},
|
28
|
+
# 产品所有支持的接口
|
29
|
+
"actions": {
|
30
|
+
# 接口名推荐用小写,避免和云 API 的接口名冲突
|
31
|
+
"add": {
|
32
|
+
# 接口中文名
|
33
|
+
"name": "测试接口",
|
34
|
+
# 接口说明
|
35
|
+
"document": "this is an test action",
|
36
|
+
# 入参对象名,在 objects 中详细定义入参结构
|
37
|
+
"input": "addRequest",
|
38
|
+
# 出参对象名,在 objects 中详细定义出参结构
|
39
|
+
"output": "addResponse",
|
40
|
+
# 实际调用函数
|
41
|
+
"action_caller": add_command, # the function to call
|
42
|
+
},
|
43
|
+
},
|
44
|
+
"objects": {
|
45
|
+
"addRequest": {
|
46
|
+
"members": [
|
47
|
+
{
|
48
|
+
# 参数名
|
49
|
+
"name": "number1",
|
50
|
+
# int64, uint64, string, float, bool, date, datetime, datetime_iso, binary
|
51
|
+
"member": "int64",
|
52
|
+
# same as member
|
53
|
+
"type": "int64",
|
54
|
+
# 是否必传
|
55
|
+
"required": True,
|
56
|
+
# 参数说明
|
57
|
+
"document": "doc about number1",
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"name": "number2",
|
61
|
+
"member": "int64",
|
62
|
+
"type": "int64",
|
63
|
+
"required": True,
|
64
|
+
"document": "doc about number2",
|
65
|
+
},
|
66
|
+
],
|
67
|
+
},
|
68
|
+
"addResponse": {
|
69
|
+
"members": [
|
70
|
+
{
|
71
|
+
"name": "sum",
|
72
|
+
"member": "int64",
|
73
|
+
"type": "int64",
|
74
|
+
"required": True,
|
75
|
+
"document": "doc about arg1",
|
76
|
+
},
|
77
|
+
],
|
78
|
+
},
|
79
|
+
},
|
80
|
+
"version": "1.0",
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
def register_service(specs):
|
85
|
+
specs[service_name] = {
|
86
|
+
service_version: _spec,
|
87
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
import json
|
3
|
+
import logging
|
4
|
+
|
5
|
+
from tencentcloud.common import credential
|
6
|
+
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
7
|
+
from tencentcloud.cvm.v20170312 import cvm_client, models
|
8
|
+
|
9
|
+
|
10
|
+
def add_command(args, parsed_globals):
|
11
|
+
# get arguments from args
|
12
|
+
number1 = args["number1"]
|
13
|
+
number2 = args["number2"]
|
14
|
+
print("%d + %d = %d\n" % (number1, number2, number1 + number2))
|
15
|
+
|
16
|
+
# get secret key from parsed_globals
|
17
|
+
secret_id = parsed_globals["secretId"]
|
18
|
+
secret_key = parsed_globals["secretKey"]
|
19
|
+
token = parsed_globals["token"]
|
20
|
+
region = parsed_globals["region"] or "ap-guangzhou"
|
21
|
+
|
22
|
+
# do api call with secret key
|
23
|
+
cred = credential.Credential(secret_id, secret_key, token)
|
24
|
+
cli = cvm_client.CvmClient(cred, region)
|
25
|
+
|
26
|
+
req = models.DescribeInstancesRequest()
|
27
|
+
try:
|
28
|
+
resp = cli.DescribeInstances(req)
|
29
|
+
print(resp.to_json_string(indent=2))
|
30
|
+
except TencentCloudSDKException as e:
|
31
|
+
logging.exception(e)
|
tccli/services/__init__.py
CHANGED
@@ -785,6 +785,16 @@
|
|
785
785
|
"output_required": false,
|
786
786
|
"type": "bool",
|
787
787
|
"value_allowed_null": true
|
788
|
+
},
|
789
|
+
{
|
790
|
+
"disabled": false,
|
791
|
+
"document": "响应时间满意阈值\n注意:此字段可能返回 null,表示取不到有效值。",
|
792
|
+
"example": "500",
|
793
|
+
"member": "int64",
|
794
|
+
"name": "ResponseDurationWarningThreshold",
|
795
|
+
"output_required": false,
|
796
|
+
"type": "int",
|
797
|
+
"value_allowed_null": true
|
788
798
|
}
|
789
799
|
],
|
790
800
|
"usage": "out"
|
@@ -2017,6 +2027,15 @@
|
|
2017
2027
|
"name": "PayMode",
|
2018
2028
|
"required": false,
|
2019
2029
|
"type": "int"
|
2030
|
+
},
|
2031
|
+
{
|
2032
|
+
"disabled": false,
|
2033
|
+
"document": "响应时间满意阈值",
|
2034
|
+
"example": "500",
|
2035
|
+
"member": "int64",
|
2036
|
+
"name": "ResponseDurationWarningThreshold",
|
2037
|
+
"required": false,
|
2038
|
+
"type": "int"
|
2020
2039
|
}
|
2021
2040
|
],
|
2022
2041
|
"type": "object"
|
tccli/services/cam/cam_client.py
CHANGED
@@ -277,7 +277,7 @@ def doDeleteRolePermissionsBoundary(args, parsed_globals):
|
|
277
277
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
278
278
|
|
279
279
|
|
280
|
-
def
|
280
|
+
def doListReceiver(args, parsed_globals):
|
281
281
|
g_param = parse_global_arg(parsed_globals)
|
282
282
|
|
283
283
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -306,11 +306,11 @@ def doListAttachedGroupPolicies(args, parsed_globals):
|
|
306
306
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
307
307
|
client._sdkVersion += ("_CLI_" + __version__)
|
308
308
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
309
|
-
model = models.
|
309
|
+
model = models.ListReceiverRequest()
|
310
310
|
model.from_json_string(json.dumps(args))
|
311
311
|
start_time = time.time()
|
312
312
|
while True:
|
313
|
-
rsp = client.
|
313
|
+
rsp = client.ListReceiver(model)
|
314
314
|
result = rsp.to_json_string()
|
315
315
|
try:
|
316
316
|
json_obj = json.loads(result)
|
@@ -329,7 +329,7 @@ def doListAttachedGroupPolicies(args, parsed_globals):
|
|
329
329
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
330
330
|
|
331
331
|
|
332
|
-
def
|
332
|
+
def doListAttachedGroupPolicies(args, parsed_globals):
|
333
333
|
g_param = parse_global_arg(parsed_globals)
|
334
334
|
|
335
335
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -358,11 +358,11 @@ def doConsumeCustomMFAToken(args, parsed_globals):
|
|
358
358
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
359
359
|
client._sdkVersion += ("_CLI_" + __version__)
|
360
360
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
361
|
-
model = models.
|
361
|
+
model = models.ListAttachedGroupPoliciesRequest()
|
362
362
|
model.from_json_string(json.dumps(args))
|
363
363
|
start_time = time.time()
|
364
364
|
while True:
|
365
|
-
rsp = client.
|
365
|
+
rsp = client.ListAttachedGroupPolicies(model)
|
366
366
|
result = rsp.to_json_string()
|
367
367
|
try:
|
368
368
|
json_obj = json.loads(result)
|
@@ -381,7 +381,7 @@ def doConsumeCustomMFAToken(args, parsed_globals):
|
|
381
381
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
382
382
|
|
383
383
|
|
384
|
-
def
|
384
|
+
def doConsumeCustomMFAToken(args, parsed_globals):
|
385
385
|
g_param = parse_global_arg(parsed_globals)
|
386
386
|
|
387
387
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -410,11 +410,11 @@ def doUpdateUser(args, parsed_globals):
|
|
410
410
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
411
411
|
client._sdkVersion += ("_CLI_" + __version__)
|
412
412
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
413
|
-
model = models.
|
413
|
+
model = models.ConsumeCustomMFATokenRequest()
|
414
414
|
model.from_json_string(json.dumps(args))
|
415
415
|
start_time = time.time()
|
416
416
|
while True:
|
417
|
-
rsp = client.
|
417
|
+
rsp = client.ConsumeCustomMFAToken(model)
|
418
418
|
result = rsp.to_json_string()
|
419
419
|
try:
|
420
420
|
json_obj = json.loads(result)
|
@@ -433,7 +433,7 @@ def doUpdateUser(args, parsed_globals):
|
|
433
433
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
434
434
|
|
435
435
|
|
436
|
-
def
|
436
|
+
def doUpdateUser(args, parsed_globals):
|
437
437
|
g_param = parse_global_arg(parsed_globals)
|
438
438
|
|
439
439
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -462,11 +462,11 @@ def doGetCustomMFATokenInfo(args, parsed_globals):
|
|
462
462
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
463
463
|
client._sdkVersion += ("_CLI_" + __version__)
|
464
464
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
465
|
-
model = models.
|
465
|
+
model = models.UpdateUserRequest()
|
466
466
|
model.from_json_string(json.dumps(args))
|
467
467
|
start_time = time.time()
|
468
468
|
while True:
|
469
|
-
rsp = client.
|
469
|
+
rsp = client.UpdateUser(model)
|
470
470
|
result = rsp.to_json_string()
|
471
471
|
try:
|
472
472
|
json_obj = json.loads(result)
|
@@ -485,7 +485,7 @@ def doGetCustomMFATokenInfo(args, parsed_globals):
|
|
485
485
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
486
486
|
|
487
487
|
|
488
|
-
def
|
488
|
+
def doGetCustomMFATokenInfo(args, parsed_globals):
|
489
489
|
g_param = parse_global_arg(parsed_globals)
|
490
490
|
|
491
491
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -514,11 +514,11 @@ def doGetUser(args, parsed_globals):
|
|
514
514
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
515
515
|
client._sdkVersion += ("_CLI_" + __version__)
|
516
516
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
517
|
-
model = models.
|
517
|
+
model = models.GetCustomMFATokenInfoRequest()
|
518
518
|
model.from_json_string(json.dumps(args))
|
519
519
|
start_time = time.time()
|
520
520
|
while True:
|
521
|
-
rsp = client.
|
521
|
+
rsp = client.GetCustomMFATokenInfo(model)
|
522
522
|
result = rsp.to_json_string()
|
523
523
|
try:
|
524
524
|
json_obj = json.loads(result)
|
@@ -537,7 +537,7 @@ def doGetUser(args, parsed_globals):
|
|
537
537
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
538
538
|
|
539
539
|
|
540
|
-
def
|
540
|
+
def doGetUser(args, parsed_globals):
|
541
541
|
g_param = parse_global_arg(parsed_globals)
|
542
542
|
|
543
543
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -566,11 +566,11 @@ def doDeleteUserPermissionsBoundary(args, parsed_globals):
|
|
566
566
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
567
567
|
client._sdkVersion += ("_CLI_" + __version__)
|
568
568
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
569
|
-
model = models.
|
569
|
+
model = models.GetUserRequest()
|
570
570
|
model.from_json_string(json.dumps(args))
|
571
571
|
start_time = time.time()
|
572
572
|
while True:
|
573
|
-
rsp = client.
|
573
|
+
rsp = client.GetUser(model)
|
574
574
|
result = rsp.to_json_string()
|
575
575
|
try:
|
576
576
|
json_obj = json.loads(result)
|
@@ -589,7 +589,7 @@ def doDeleteUserPermissionsBoundary(args, parsed_globals):
|
|
589
589
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
590
590
|
|
591
591
|
|
592
|
-
def
|
592
|
+
def doDeleteUserPermissionsBoundary(args, parsed_globals):
|
593
593
|
g_param = parse_global_arg(parsed_globals)
|
594
594
|
|
595
595
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -618,11 +618,11 @@ def doGetServiceLinkedRoleDeletionStatus(args, parsed_globals):
|
|
618
618
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
619
619
|
client._sdkVersion += ("_CLI_" + __version__)
|
620
620
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
621
|
-
model = models.
|
621
|
+
model = models.DeleteUserPermissionsBoundaryRequest()
|
622
622
|
model.from_json_string(json.dumps(args))
|
623
623
|
start_time = time.time()
|
624
624
|
while True:
|
625
|
-
rsp = client.
|
625
|
+
rsp = client.DeleteUserPermissionsBoundary(model)
|
626
626
|
result = rsp.to_json_string()
|
627
627
|
try:
|
628
628
|
json_obj = json.loads(result)
|
@@ -641,7 +641,7 @@ def doGetServiceLinkedRoleDeletionStatus(args, parsed_globals):
|
|
641
641
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
642
642
|
|
643
643
|
|
644
|
-
def
|
644
|
+
def doGetServiceLinkedRoleDeletionStatus(args, parsed_globals):
|
645
645
|
g_param = parse_global_arg(parsed_globals)
|
646
646
|
|
647
647
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -670,11 +670,11 @@ def doDescribeUserOIDCConfig(args, parsed_globals):
|
|
670
670
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
671
671
|
client._sdkVersion += ("_CLI_" + __version__)
|
672
672
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
673
|
-
model = models.
|
673
|
+
model = models.GetServiceLinkedRoleDeletionStatusRequest()
|
674
674
|
model.from_json_string(json.dumps(args))
|
675
675
|
start_time = time.time()
|
676
676
|
while True:
|
677
|
-
rsp = client.
|
677
|
+
rsp = client.GetServiceLinkedRoleDeletionStatus(model)
|
678
678
|
result = rsp.to_json_string()
|
679
679
|
try:
|
680
680
|
json_obj = json.loads(result)
|
@@ -693,7 +693,7 @@ def doDescribeUserOIDCConfig(args, parsed_globals):
|
|
693
693
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
694
694
|
|
695
695
|
|
696
|
-
def
|
696
|
+
def doDescribeUserOIDCConfig(args, parsed_globals):
|
697
697
|
g_param = parse_global_arg(parsed_globals)
|
698
698
|
|
699
699
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -722,11 +722,11 @@ def doUpdateUserSAMLConfig(args, parsed_globals):
|
|
722
722
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
723
723
|
client._sdkVersion += ("_CLI_" + __version__)
|
724
724
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
725
|
-
model = models.
|
725
|
+
model = models.DescribeUserOIDCConfigRequest()
|
726
726
|
model.from_json_string(json.dumps(args))
|
727
727
|
start_time = time.time()
|
728
728
|
while True:
|
729
|
-
rsp = client.
|
729
|
+
rsp = client.DescribeUserOIDCConfig(model)
|
730
730
|
result = rsp.to_json_string()
|
731
731
|
try:
|
732
732
|
json_obj = json.loads(result)
|
@@ -2773,6 +2773,58 @@ def doCreateGroup(args, parsed_globals):
|
|
2773
2773
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
2774
2774
|
|
2775
2775
|
|
2776
|
+
def doGetRole(args, parsed_globals):
|
2777
|
+
g_param = parse_global_arg(parsed_globals)
|
2778
|
+
|
2779
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
2780
|
+
cred = credential.CVMRoleCredential()
|
2781
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
2782
|
+
cred = credential.STSAssumeRoleCredential(
|
2783
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
2784
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
2785
|
+
)
|
2786
|
+
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):
|
2787
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
2788
|
+
else:
|
2789
|
+
cred = credential.Credential(
|
2790
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
2791
|
+
)
|
2792
|
+
http_profile = HttpProfile(
|
2793
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
2794
|
+
reqMethod="POST",
|
2795
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
2796
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
2797
|
+
)
|
2798
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
2799
|
+
if g_param[OptionsDefine.Language]:
|
2800
|
+
profile.language = g_param[OptionsDefine.Language]
|
2801
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
2802
|
+
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
2803
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
2804
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
2805
|
+
model = models.GetRoleRequest()
|
2806
|
+
model.from_json_string(json.dumps(args))
|
2807
|
+
start_time = time.time()
|
2808
|
+
while True:
|
2809
|
+
rsp = client.GetRole(model)
|
2810
|
+
result = rsp.to_json_string()
|
2811
|
+
try:
|
2812
|
+
json_obj = json.loads(result)
|
2813
|
+
except TypeError as e:
|
2814
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
2815
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
2816
|
+
break
|
2817
|
+
cur_time = time.time()
|
2818
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
2819
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
2820
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
2821
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
2822
|
+
else:
|
2823
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
2824
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
2825
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
2826
|
+
|
2827
|
+
|
2776
2828
|
def doListAccessKeys(args, parsed_globals):
|
2777
2829
|
g_param = parse_global_arg(parsed_globals)
|
2778
2830
|
|
@@ -3657,6 +3709,58 @@ def doListGroupsForUser(args, parsed_globals):
|
|
3657
3709
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
3658
3710
|
|
3659
3711
|
|
3712
|
+
def doDeleteMessageReceiver(args, parsed_globals):
|
3713
|
+
g_param = parse_global_arg(parsed_globals)
|
3714
|
+
|
3715
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
3716
|
+
cred = credential.CVMRoleCredential()
|
3717
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
3718
|
+
cred = credential.STSAssumeRoleCredential(
|
3719
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
3720
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
3721
|
+
)
|
3722
|
+
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):
|
3723
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
3724
|
+
else:
|
3725
|
+
cred = credential.Credential(
|
3726
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
3727
|
+
)
|
3728
|
+
http_profile = HttpProfile(
|
3729
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
3730
|
+
reqMethod="POST",
|
3731
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
3732
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
3733
|
+
)
|
3734
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
3735
|
+
if g_param[OptionsDefine.Language]:
|
3736
|
+
profile.language = g_param[OptionsDefine.Language]
|
3737
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
3738
|
+
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
3739
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
3740
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
3741
|
+
model = models.DeleteMessageReceiverRequest()
|
3742
|
+
model.from_json_string(json.dumps(args))
|
3743
|
+
start_time = time.time()
|
3744
|
+
while True:
|
3745
|
+
rsp = client.DeleteMessageReceiver(model)
|
3746
|
+
result = rsp.to_json_string()
|
3747
|
+
try:
|
3748
|
+
json_obj = json.loads(result)
|
3749
|
+
except TypeError as e:
|
3750
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
3751
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
3752
|
+
break
|
3753
|
+
cur_time = time.time()
|
3754
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
3755
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
3756
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
3757
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
3758
|
+
else:
|
3759
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
3760
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
3761
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
3762
|
+
|
3763
|
+
|
3660
3764
|
def doListAttachedUserAllPolicies(args, parsed_globals):
|
3661
3765
|
g_param = parse_global_arg(parsed_globals)
|
3662
3766
|
|
@@ -4385,7 +4489,7 @@ def doDescribeSafeAuthFlagColl(args, parsed_globals):
|
|
4385
4489
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
4386
4490
|
|
4387
4491
|
|
4388
|
-
def
|
4492
|
+
def doUpdateUserSAMLConfig(args, parsed_globals):
|
4389
4493
|
g_param = parse_global_arg(parsed_globals)
|
4390
4494
|
|
4391
4495
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -4414,11 +4518,11 @@ def doGetRole(args, parsed_globals):
|
|
4414
4518
|
client = mod.CamClient(cred, g_param[OptionsDefine.Region], profile)
|
4415
4519
|
client._sdkVersion += ("_CLI_" + __version__)
|
4416
4520
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
4417
|
-
model = models.
|
4521
|
+
model = models.UpdateUserSAMLConfigRequest()
|
4418
4522
|
model.from_json_string(json.dumps(args))
|
4419
4523
|
start_time = time.time()
|
4420
4524
|
while True:
|
4421
|
-
rsp = client.
|
4525
|
+
rsp = client.UpdateUserSAMLConfig(model)
|
4422
4526
|
result = rsp.to_json_string()
|
4423
4527
|
try:
|
4424
4528
|
json_obj = json.loads(result)
|
@@ -4609,6 +4713,7 @@ ACTION_MAP = {
|
|
4609
4713
|
"GetUserPermissionBoundary": doGetUserPermissionBoundary,
|
4610
4714
|
"GetAccountSummary": doGetAccountSummary,
|
4611
4715
|
"DeleteRolePermissionsBoundary": doDeleteRolePermissionsBoundary,
|
4716
|
+
"ListReceiver": doListReceiver,
|
4612
4717
|
"ListAttachedGroupPolicies": doListAttachedGroupPolicies,
|
4613
4718
|
"ConsumeCustomMFAToken": doConsumeCustomMFAToken,
|
4614
4719
|
"UpdateUser": doUpdateUser,
|
@@ -4617,7 +4722,6 @@ ACTION_MAP = {
|
|
4617
4722
|
"DeleteUserPermissionsBoundary": doDeleteUserPermissionsBoundary,
|
4618
4723
|
"GetServiceLinkedRoleDeletionStatus": doGetServiceLinkedRoleDeletionStatus,
|
4619
4724
|
"DescribeUserOIDCConfig": doDescribeUserOIDCConfig,
|
4620
|
-
"UpdateUserSAMLConfig": doUpdateUserSAMLConfig,
|
4621
4725
|
"CreateAccessKey": doCreateAccessKey,
|
4622
4726
|
"DeleteUser": doDeleteUser,
|
4623
4727
|
"UpdateRoleDescription": doUpdateRoleDescription,
|
@@ -4657,6 +4761,7 @@ ACTION_MAP = {
|
|
4657
4761
|
"GetSecurityLastUsed": doGetSecurityLastUsed,
|
4658
4762
|
"DeletePolicy": doDeletePolicy,
|
4659
4763
|
"CreateGroup": doCreateGroup,
|
4764
|
+
"GetRole": doGetRole,
|
4660
4765
|
"ListAccessKeys": doListAccessKeys,
|
4661
4766
|
"DeleteGroup": doDeleteGroup,
|
4662
4767
|
"CreateMessageReceiver": doCreateMessageReceiver,
|
@@ -4674,6 +4779,7 @@ ACTION_MAP = {
|
|
4674
4779
|
"CreatePolicy": doCreatePolicy,
|
4675
4780
|
"DetachUserPolicy": doDetachUserPolicy,
|
4676
4781
|
"ListGroupsForUser": doListGroupsForUser,
|
4782
|
+
"DeleteMessageReceiver": doDeleteMessageReceiver,
|
4677
4783
|
"ListAttachedUserAllPolicies": doListAttachedUserAllPolicies,
|
4678
4784
|
"CreateRole": doCreateRole,
|
4679
4785
|
"ListAttachedRolePolicies": doListAttachedRolePolicies,
|
@@ -4688,7 +4794,7 @@ ACTION_MAP = {
|
|
4688
4794
|
"AddUserToGroup": doAddUserToGroup,
|
4689
4795
|
"AttachRolePolicy": doAttachRolePolicy,
|
4690
4796
|
"DescribeSafeAuthFlagColl": doDescribeSafeAuthFlagColl,
|
4691
|
-
"
|
4797
|
+
"UpdateUserSAMLConfig": doUpdateUserSAMLConfig,
|
4692
4798
|
"DeletePolicyVersion": doDeletePolicyVersion,
|
4693
4799
|
"ListPolicies": doListPolicies,
|
4694
4800
|
"DisableUserSSO": doDisableUserSSO,
|