tccli 3.0.1169.1__py2.py3-none-any.whl → 3.0.1170.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.
@@ -184,6 +184,14 @@
184
184
  "title": "test"
185
185
  }
186
186
  ],
187
+ "DescribeServiceNodeInfos": [
188
+ {
189
+ "document": "查询服务进程信息",
190
+ "input": "https://emr.tencentcloudapi.com/?Action=DescribeServiceNodeInfos\n&InstanceId=emr-3qg9lptu\n&ServiceGroupType=1\n&ServiceNodeType=1\n&Offset=0\n&Limit=10\n&<公共请求参数>",
191
+ "output": "{\n \"Response\": {\n \"TotalCnt\": 0,\n \"ServiceNodeList\": [\n {\n \"Ip\": \"abc\",\n \"NodeType\": 0,\n \"NodeName\": \"abc\",\n \"ServiceStatus\": 0,\n \"MonitorStatus\": 0,\n \"Status\": 0,\n \"PortsInfo\": \"abc\",\n \"LastRestartTime\": \"abc\",\n \"Flag\": 0,\n \"ConfGroupId\": 0,\n \"ConfGroupName\": \"abc\",\n \"ConfStatus\": 0,\n \"ServiceDetectionInfo\": [\n {\n \"DetectAlert\": \"abc\",\n \"DetetcFunctionKey\": \"abc\",\n \"DetetcFunctionValue\": \"abc\",\n \"DetetcTime\": \"abc\",\n \"DetectFunctionKey\": \"abc\",\n \"DetectFunctionValue\": \"abc\",\n \"DetectTime\": \"abc\"\n }\n ],\n \"NodeFlagFilter\": \"abc\",\n \"HealthStatus\": {\n \"Code\": 0,\n \"Text\": \"abc\",\n \"Desc\": \"abc\"\n },\n \"IsSupportRoleMonitor\": true,\n \"StopPolicies\": [\n {\n \"Name\": \"abc\",\n \"DisplayName\": \"abc\",\n \"Describe\": \"abc\",\n \"BatchSizeRange\": [\n 0\n ],\n \"IsDefault\": \"abc\"\n }\n ],\n \"HAState\": \"abc\",\n \"NameService\": \"abc\",\n \"IsFederation\": true\n }\n ],\n \"AliasInfo\": \"abc\",\n \"SupportNodeFlagFilterList\": [\n \"abc\"\n ],\n \"RequestId\": \"abc\"\n }\n}",
192
+ "title": "查询服务进程信息"
193
+ }
194
+ ],
187
195
  "DescribeTrinoQueryInfo": [
188
196
  {
189
197
  "document": "",
@@ -208,6 +216,14 @@
208
216
  "title": "获取Yarn的Applications列表"
209
217
  }
210
218
  ],
219
+ "DescribeYarnScheduleHistory": [
220
+ {
221
+ "document": "",
222
+ "input": "POST / HTTP/1.1\nHost: emr.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DescribeYarnScheduleHistory\n<公共请求参数>\n\n{\n \"InstanceId\": \"emr-a903oah8\",\n \"StartTime\": 1722873600,\n \"EndTime\": 1722959999,\n \"Limit\": 10,\n \"Offset\": 0,\n \"SchedulerType\": \"All\",\n \"TaskState\": -99\n}",
223
+ "output": "{\n \"Response\": {\n \"RequestId\": \"c38e1833-e164-488c-9817-e8ca75d8d214\",\n \"SchedulerNameList\": [\n \"Capacity Scheduler\",\n \"Fair Scheduler\"\n ],\n \"StateList\": [\n 0,\n 1,\n 2,\n -1\n ],\n \"Tasks\": [\n {\n \"CreateTime\": \"2024-08-07 19:13:38\",\n \"Details\": [\n {\n \"FailReason\": \"\",\n \"JobId\": 40005,\n \"Progress\": \"9%\",\n \"Step\": \"开始\"\n },\n {\n \"FailReason\": \"\",\n \"JobId\": 40005,\n \"Progress\": \"45%\",\n \"Step\": \"写 capacity-scheduler.xml\"\n },\n {\n \"FailReason\": \"\",\n \"JobId\": 40005,\n \"Progress\": \"63%\",\n \"Step\": \"重启 resource manager\"\n },\n {\n \"FailReason\": \"\",\n \"JobId\": 40005,\n \"Progress\": \"100%\",\n \"Step\": \"结束\"\n }\n ],\n \"EndTime\": \"2024-08-07 19:13:48\",\n \"OperatorName\": \"change capacity scheduler,disable label,refresh dynamic pools,restart resource manager\",\n \"SchedulerName\": \"Capacity Scheduler\",\n \"State\": 2\n },\n {\n \"CreateTime\": \"2024-08-06 14:30:02\",\n \"Details\": [\n {\n \"FailReason\": \"\",\n \"JobId\": 40000,\n \"Progress\": \"9%\",\n \"Step\": \"开始\"\n },\n {\n \"FailReason\": \"\",\n \"JobId\": 40000,\n \"Progress\": \"45%\",\n \"Step\": \"写 capacity-scheduler.xml\"\n },\n {\n \"FailReason\": \"The task was canceled because of a timeout\",\n \"JobId\": 40000,\n \"Progress\": \"63%\",\n \"Step\": \"重启 resource manager\"\n }\n ],\n \"EndTime\": \"2024-08-06 14:35:05\",\n \"OperatorName\": \"change capacity scheduler,disable label,refresh dynamic pools,restart resource manager\",\n \"SchedulerName\": \"Capacity Scheduler\",\n \"State\": -1\n },\n {\n \"CreateTime\": \"2024-08-06 11:29:15\",\n \"Details\": [\n {\n \"FailReason\": \"\",\n \"JobId\": 39994,\n \"Progress\": \"9%\",\n \"Step\": \"开始\"\n },\n {\n \"FailReason\": \"\",\n \"JobId\": 39994,\n \"Progress\": \"45%\",\n \"Step\": \"写 capacity-scheduler.xml\"\n },\n {\n \"FailReason\": \"\",\n \"JobId\": 39994,\n \"Progress\": \"63%\",\n \"Step\": \"重启 resource manager\"\n },\n {\n \"FailReason\": \"\",\n \"JobId\": 39994,\n \"Progress\": \"100%\",\n \"Step\": \"结束\"\n }\n ],\n \"EndTime\": \"2024-08-06 11:29:25\",\n \"OperatorName\": \"change capacity scheduler,disable label,refresh dynamic pools,restart resource manager\",\n \"SchedulerName\": \"Capacity Scheduler\",\n \"State\": 2\n }\n ],\n \"Total\": 3\n }\n}",
224
+ "title": "查看yarn资源调度的调度历史"
225
+ }
226
+ ],
211
227
  "InquirePriceRenewEmr": [
212
228
  {
213
229
  "document": "",
@@ -308,6 +324,14 @@
308
324
  "title": "test"
309
325
  }
310
326
  ],
327
+ "ModifyYarnDeploy": [
328
+ {
329
+ "document": "",
330
+ "input": "POST / HTTP/1.1\nHost: emr.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyYarnDeploy\n<公共请求参数>\n\n{\n \"InstanceId\": \"emr-a903oah8\",\n \"OldScheduler\": \"capacity\",\n \"NewScheduler\": \"fair\"\n}",
331
+ "output": "{\n \"Response\": {\n \"ErrorMsg\": null,\n \"IsDraft\": false,\n \"RequestId\": \"d76bd103-947e-49f3-8485-e6aab28ecbbf\"\n }\n}",
332
+ "title": "部署生效"
333
+ }
334
+ ],
311
335
  "RunJobFlow": [
312
336
  {
313
337
  "document": "",
@@ -446,7 +446,7 @@
446
446
  },
447
447
  {
448
448
  "disabled": false,
449
- "document": "私有化默认分组id-名称-操作系统\n1\t全网终端\tWin\n2\t未分组终端\tWin\n30000000\t服务器\tWin\n40000101\t全网终端\tLinux\n40000102\t未分组终端\tLinux\n40000103\t服务器\tLinux\n40000201\t全网终端\tmacOS\n40000202\t未分组终端\tmacOS\n40000203\t服务器\tmacOS\n40000401\t全网终端\tAndroid\n40000402\t未分组终端\tAndroid\n40000501\t全网终端\tiOS\n40000502\t未分组终端\tiOS",
449
+ "document": "【和GroupIds必须有一个填写】设备分组id(需要和OsType匹配)\nid-名称-操作系统\n1\t全网终端\tWin\n2\t未分组终端\tWin\n30000000\t服务器\tWin\n40000101\t全网终端\tLinux\n40000102\t未分组终端\tLinux\n40000103\t服务器\tLinux\n40000201\t全网终端\tmacOS\n40000202\t未分组终端\tmacOS\n40000203\t服务器\tmacOS\n40000401\t全网终端\tAndroid\n40000402\t未分组终端\tAndroid\n40000501\t全网终端\tiOS\n40000502\t未分组终端\tiOS",
450
450
  "example": "1",
451
451
  "member": "int64",
452
452
  "name": "GroupId",
@@ -455,7 +455,7 @@
455
455
  },
456
456
  {
457
457
  "disabled": false,
458
- "document": "系统类型(0: win,1:linux,2: mac,3: win_srv,4:android,5:ios 默认值0",
458
+ "document": "【必填】操作系统类型(0: win,1:linux,2: mac,3: win_srv,4:android,5:ios 默认值0),需要和GroupId或者GroupIds匹配",
459
459
  "example": "0",
460
460
  "member": "int64",
461
461
  "name": "OsType",
@@ -464,7 +464,7 @@
464
464
  },
465
465
  {
466
466
  "disabled": false,
467
- "document": "在线状态 2 在线 01 离线",
467
+ "document": "在线状态 2表示在线,0或者1表示离线)",
468
468
  "example": "2",
469
469
  "member": "int64",
470
470
  "name": "OnlineStatus",
@@ -491,7 +491,7 @@
491
491
  },
492
492
  {
493
493
  "disabled": false,
494
- "document": "获取第几页--兼容旧接口,参数同Condition(只支持32位)",
494
+ "document": "获取第几页--兼容旧接口,参数同Condition",
495
495
  "example": "1",
496
496
  "member": "int64",
497
497
  "name": "PageNum",
@@ -500,7 +500,7 @@
500
500
  },
501
501
  {
502
502
  "disabled": false,
503
- "document": "每页获取数--兼容旧接口,参数同Condition(只支持32位)",
503
+ "document": "每页获取数--兼容旧接口,参数同Condition",
504
504
  "example": "20",
505
505
  "member": "int64",
506
506
  "name": "PageSize",
@@ -17,6 +17,110 @@ from tencentcloud.smh.v20210712 import models as models_v20210712
17
17
  from jmespath import search
18
18
  import time
19
19
 
20
+ def doModifyUser(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.SmhClient(cred, g_param[OptionsDefine.Region], profile)
47
+ client._sdkVersion += ("_CLI_" + __version__)
48
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
+ model = models.ModifyUserRequest()
50
+ model.from_json_string(json.dumps(args))
51
+ start_time = time.time()
52
+ while True:
53
+ rsp = client.ModifyUser(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 doDeleteUser(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.SmhClient(cred, g_param[OptionsDefine.Region], profile)
99
+ client._sdkVersion += ("_CLI_" + __version__)
100
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
101
+ model = models.DeleteUserRequest()
102
+ model.from_json_string(json.dumps(args))
103
+ start_time = time.time()
104
+ while True:
105
+ rsp = client.DeleteUser(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
+
20
124
  def doDescribeOfficialInstances(args, parsed_globals):
21
125
  g_param = parse_global_arg(parsed_globals)
22
126
 
@@ -121,7 +225,7 @@ def doDescribeLibraries(args, parsed_globals):
121
225
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
122
226
 
123
227
 
124
- def doCreateLibrary(args, parsed_globals):
228
+ def doVerifySmsCode(args, parsed_globals):
125
229
  g_param = parse_global_arg(parsed_globals)
126
230
 
127
231
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -150,11 +254,11 @@ def doCreateLibrary(args, parsed_globals):
150
254
  client = mod.SmhClient(cred, g_param[OptionsDefine.Region], profile)
151
255
  client._sdkVersion += ("_CLI_" + __version__)
152
256
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
153
- model = models.CreateLibraryRequest()
257
+ model = models.VerifySmsCodeRequest()
154
258
  model.from_json_string(json.dumps(args))
155
259
  start_time = time.time()
156
260
  while True:
157
- rsp = client.CreateLibrary(model)
261
+ rsp = client.VerifySmsCode(model)
158
262
  result = rsp.to_json_string()
159
263
  try:
160
264
  json_obj = json.loads(result)
@@ -225,7 +329,7 @@ def doSendSmsCode(args, parsed_globals):
225
329
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
226
330
 
227
331
 
228
- def doDescribeTrafficPackages(args, parsed_globals):
332
+ def doDeleteLibrary(args, parsed_globals):
229
333
  g_param = parse_global_arg(parsed_globals)
230
334
 
231
335
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -254,11 +358,11 @@ def doDescribeTrafficPackages(args, parsed_globals):
254
358
  client = mod.SmhClient(cred, g_param[OptionsDefine.Region], profile)
255
359
  client._sdkVersion += ("_CLI_" + __version__)
256
360
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
257
- model = models.DescribeTrafficPackagesRequest()
361
+ model = models.DeleteLibraryRequest()
258
362
  model.from_json_string(json.dumps(args))
259
363
  start_time = time.time()
260
364
  while True:
261
- rsp = client.DescribeTrafficPackages(model)
365
+ rsp = client.DeleteLibrary(model)
262
366
  result = rsp.to_json_string()
263
367
  try:
264
368
  json_obj = json.loads(result)
@@ -277,7 +381,7 @@ def doDescribeTrafficPackages(args, parsed_globals):
277
381
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
278
382
 
279
383
 
280
- def doVerifySmsCode(args, parsed_globals):
384
+ def doCreateUserLifecycle(args, parsed_globals):
281
385
  g_param = parse_global_arg(parsed_globals)
282
386
 
283
387
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -306,11 +410,63 @@ def doVerifySmsCode(args, parsed_globals):
306
410
  client = mod.SmhClient(cred, g_param[OptionsDefine.Region], profile)
307
411
  client._sdkVersion += ("_CLI_" + __version__)
308
412
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
309
- model = models.VerifySmsCodeRequest()
413
+ model = models.CreateUserLifecycleRequest()
310
414
  model.from_json_string(json.dumps(args))
311
415
  start_time = time.time()
312
416
  while True:
313
- rsp = client.VerifySmsCode(model)
417
+ rsp = client.CreateUserLifecycle(model)
418
+ result = rsp.to_json_string()
419
+ try:
420
+ json_obj = json.loads(result)
421
+ except TypeError as e:
422
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
423
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
424
+ break
425
+ cur_time = time.time()
426
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
427
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
428
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
429
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
430
+ else:
431
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
432
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
433
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
434
+
435
+
436
+ def doCreateLibrary(args, parsed_globals):
437
+ g_param = parse_global_arg(parsed_globals)
438
+
439
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
440
+ cred = credential.CVMRoleCredential()
441
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
442
+ cred = credential.STSAssumeRoleCredential(
443
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
444
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
445
+ )
446
+ 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):
447
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
448
+ else:
449
+ cred = credential.Credential(
450
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
451
+ )
452
+ http_profile = HttpProfile(
453
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
454
+ reqMethod="POST",
455
+ endpoint=g_param[OptionsDefine.Endpoint],
456
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
457
+ )
458
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
459
+ if g_param[OptionsDefine.Language]:
460
+ profile.language = g_param[OptionsDefine.Language]
461
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
462
+ client = mod.SmhClient(cred, g_param[OptionsDefine.Region], profile)
463
+ client._sdkVersion += ("_CLI_" + __version__)
464
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
465
+ model = models.CreateLibraryRequest()
466
+ model.from_json_string(json.dumps(args))
467
+ start_time = time.time()
468
+ while True:
469
+ rsp = client.CreateLibrary(model)
314
470
  result = rsp.to_json_string()
315
471
  try:
316
472
  json_obj = json.loads(result)
@@ -433,7 +589,7 @@ def doModifyLibrary(args, parsed_globals):
433
589
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
434
590
 
435
591
 
436
- def doDeleteLibrary(args, parsed_globals):
592
+ def doCreateUser(args, parsed_globals):
437
593
  g_param = parse_global_arg(parsed_globals)
438
594
 
439
595
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -462,11 +618,115 @@ def doDeleteLibrary(args, parsed_globals):
462
618
  client = mod.SmhClient(cred, g_param[OptionsDefine.Region], profile)
463
619
  client._sdkVersion += ("_CLI_" + __version__)
464
620
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
465
- model = models.DeleteLibraryRequest()
621
+ model = models.CreateUserRequest()
466
622
  model.from_json_string(json.dumps(args))
467
623
  start_time = time.time()
468
624
  while True:
469
- rsp = client.DeleteLibrary(model)
625
+ rsp = client.CreateUser(model)
626
+ result = rsp.to_json_string()
627
+ try:
628
+ json_obj = json.loads(result)
629
+ except TypeError as e:
630
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
631
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
632
+ break
633
+ cur_time = time.time()
634
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
635
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
636
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
637
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
638
+ else:
639
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
640
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
641
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
642
+
643
+
644
+ def doDescribeTrafficPackages(args, parsed_globals):
645
+ g_param = parse_global_arg(parsed_globals)
646
+
647
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
648
+ cred = credential.CVMRoleCredential()
649
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
650
+ cred = credential.STSAssumeRoleCredential(
651
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
652
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
653
+ )
654
+ 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):
655
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
656
+ else:
657
+ cred = credential.Credential(
658
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
659
+ )
660
+ http_profile = HttpProfile(
661
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
662
+ reqMethod="POST",
663
+ endpoint=g_param[OptionsDefine.Endpoint],
664
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
665
+ )
666
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
667
+ if g_param[OptionsDefine.Language]:
668
+ profile.language = g_param[OptionsDefine.Language]
669
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
670
+ client = mod.SmhClient(cred, g_param[OptionsDefine.Region], profile)
671
+ client._sdkVersion += ("_CLI_" + __version__)
672
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
673
+ model = models.DescribeTrafficPackagesRequest()
674
+ model.from_json_string(json.dumps(args))
675
+ start_time = time.time()
676
+ while True:
677
+ rsp = client.DescribeTrafficPackages(model)
678
+ result = rsp.to_json_string()
679
+ try:
680
+ json_obj = json.loads(result)
681
+ except TypeError as e:
682
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
683
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
684
+ break
685
+ cur_time = time.time()
686
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
687
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
688
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
689
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
690
+ else:
691
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
692
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
693
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
694
+
695
+
696
+ def doDescribeUserLifecycle(args, parsed_globals):
697
+ g_param = parse_global_arg(parsed_globals)
698
+
699
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
700
+ cred = credential.CVMRoleCredential()
701
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
702
+ cred = credential.STSAssumeRoleCredential(
703
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
704
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
705
+ )
706
+ 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):
707
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
708
+ else:
709
+ cred = credential.Credential(
710
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
711
+ )
712
+ http_profile = HttpProfile(
713
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
714
+ reqMethod="POST",
715
+ endpoint=g_param[OptionsDefine.Endpoint],
716
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
717
+ )
718
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
719
+ if g_param[OptionsDefine.Language]:
720
+ profile.language = g_param[OptionsDefine.Language]
721
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
722
+ client = mod.SmhClient(cred, g_param[OptionsDefine.Region], profile)
723
+ client._sdkVersion += ("_CLI_" + __version__)
724
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
725
+ model = models.DescribeUserLifecycleRequest()
726
+ model.from_json_string(json.dumps(args))
727
+ start_time = time.time()
728
+ while True:
729
+ rsp = client.DescribeUserLifecycle(model)
470
730
  result = rsp.to_json_string()
471
731
  try:
472
732
  json_obj = json.loads(result)
@@ -548,15 +808,20 @@ MODELS_MAP = {
548
808
  }
549
809
 
550
810
  ACTION_MAP = {
811
+ "ModifyUser": doModifyUser,
812
+ "DeleteUser": doDeleteUser,
551
813
  "DescribeOfficialInstances": doDescribeOfficialInstances,
552
814
  "DescribeLibraries": doDescribeLibraries,
553
- "CreateLibrary": doCreateLibrary,
554
- "SendSmsCode": doSendSmsCode,
555
- "DescribeTrafficPackages": doDescribeTrafficPackages,
556
815
  "VerifySmsCode": doVerifySmsCode,
816
+ "SendSmsCode": doSendSmsCode,
817
+ "DeleteLibrary": doDeleteLibrary,
818
+ "CreateUserLifecycle": doCreateUserLifecycle,
819
+ "CreateLibrary": doCreateLibrary,
557
820
  "DescribeOfficialOverview": doDescribeOfficialOverview,
558
821
  "ModifyLibrary": doModifyLibrary,
559
- "DeleteLibrary": doDeleteLibrary,
822
+ "CreateUser": doCreateUser,
823
+ "DescribeTrafficPackages": doDescribeTrafficPackages,
824
+ "DescribeUserLifecycle": doDescribeUserLifecycle,
560
825
  "DescribeLibrarySecret": doDescribeLibrarySecret,
561
826
 
562
827
  }