tccli 3.0.1095.1__py2.py3-none-any.whl → 3.0.1097.1__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/examples/aiart/v20221229/QueryDrawPortraitJob.md +30 -0
  3. tccli/examples/aiart/v20221229/QueryTrainPortraitModelJob.md +24 -0
  4. tccli/examples/aiart/v20221229/SubmitDrawPortraitJob.md +23 -0
  5. tccli/examples/aiart/v20221229/SubmitTrainPortraitModelJob.md +20 -0
  6. tccli/examples/aiart/v20221229/UploadTrainPortraitImages.md +25 -0
  7. tccli/examples/ccc/v20200210/ModifyStaffPassword.md +22 -0
  8. tccli/examples/cls/v20201016/DeleteKafkaRecharge.md +3 -3
  9. tccli/examples/cls/v20201016/ModifyKafkaRecharge.md +23 -13
  10. tccli/examples/cls/v20201016/PreviewKafkaRecharge.md +47 -15
  11. tccli/examples/csip/v20221121/DescribeAlertList.md +176 -0
  12. tccli/examples/cynosdb/v20190107/AddClusterSlaveZone.md +2 -1
  13. tccli/examples/cynosdb/v20190107/DescribeClusterDetail.md +9 -2
  14. tccli/examples/cynosdb/v20190107/DescribeTasks.md +12 -0
  15. tccli/examples/cynosdb/v20190107/ModifyClusterSlaveZone.md +2 -1
  16. tccli/examples/cynosdb/v20190107/ModifyInstanceUpgradeLimitDays.md +22 -0
  17. tccli/examples/dcdb/v20180411/DescribeDCDBInstances.md +4 -3
  18. tccli/examples/dlc/v20210125/DescribeNotebookSessionStatementSqlResult.md +3 -1
  19. tccli/examples/lke/v20231130/GetEmbedding.md +4 -1
  20. tccli/examples/lke/v20231130/QueryParseDocResult.md +4 -1
  21. tccli/examples/lke/v20231130/QueryRewrite.md +6 -1
  22. tccli/examples/mariadb/v20170312/DescribeDBInstanceDetail.md +2 -1
  23. tccli/examples/mariadb/v20170312/DescribeDBInstances.md +4 -3
  24. tccli/examples/mps/v20190612/CreateAdaptiveDynamicStreamingTemplate.md +1 -1
  25. tccli/examples/mps/v20190612/ModifyAdaptiveDynamicStreamingTemplate.md +1 -1
  26. tccli/examples/organization/v20210331/DescribeEffectivePolicy.md +25 -0
  27. tccli/examples/organization/v20210331/ListNonCompliantResource.md +43 -0
  28. tccli/examples/ssl/v20191205/DescribeDeleteCertificatesTaskResult.md +72 -0
  29. tccli/examples/tdmq/v20200217/DescribeRabbitMQQueueDetail.md +25 -22
  30. tccli/examples/trocket/v20230308/DescribeMQTTClient.md +57 -49
  31. tccli/examples/trocket/v20230308/DescribeMQTTInsPublicEndpoints.md +38 -6
  32. tccli/examples/trocket/v20230308/DescribeMQTTInsVPCEndpoints.md +14 -12
  33. tccli/examples/trocket/v20230308/DescribeMQTTInstanceList.md +1 -121
  34. tccli/examples/trocket/v20230308/DescribeMQTTProductSKUList.md +0 -47
  35. tccli/examples/trocket/v20230308/DescribeMQTTUserList.md +1 -1
  36. tccli/examples/vpc/v20170312/DisableVpnGatewaySslClientCert.md +2 -2
  37. tccli/services/aiart/aiart_client.py +269 -4
  38. tccli/services/aiart/v20221229/api.json +405 -1
  39. tccli/services/aiart/v20221229/examples.json +40 -0
  40. tccli/services/billing/v20180709/api.json +30 -0
  41. tccli/services/bma/v20221115/api.json +4 -6
  42. tccli/services/ccc/ccc_client.py +53 -0
  43. tccli/services/ccc/v20200210/api.json +57 -5
  44. tccli/services/ccc/v20200210/examples.json +8 -0
  45. tccli/services/cdb/v20170320/api.json +9 -0
  46. tccli/services/cdn/v20180606/api.json +1 -1
  47. tccli/services/cls/v20201016/api.json +49 -49
  48. tccli/services/cls/v20201016/examples.json +13 -7
  49. tccli/services/csip/csip_client.py +53 -0
  50. tccli/services/csip/v20221121/api.json +1468 -7
  51. tccli/services/csip/v20221121/examples.json +8 -0
  52. tccli/services/cynosdb/cynosdb_client.py +53 -0
  53. tccli/services/cynosdb/v20190107/api.json +126 -0
  54. tccli/services/cynosdb/v20190107/examples.json +12 -4
  55. tccli/services/dcdb/v20180411/api.json +45 -3
  56. tccli/services/dcdb/v20180411/examples.json +1 -1
  57. tccli/services/dlc/v20210125/api.json +30 -0
  58. tccli/services/dlc/v20210125/examples.json +1 -1
  59. tccli/services/essbasic/v20210526/api.json +9 -0
  60. tccli/services/faceid/v20180301/api.json +22 -3
  61. tccli/services/hunyuan/v20230901/api.json +14 -14
  62. tccli/services/iotexplorer/v20190423/api.json +1 -1
  63. tccli/services/lighthouse/v20200324/api.json +2 -2
  64. tccli/services/live/v20180801/api.json +16 -7
  65. tccli/services/lke/v20231130/api.json +82 -6
  66. tccli/services/lke/v20231130/examples.json +3 -3
  67. tccli/services/mariadb/v20170312/api.json +45 -2
  68. tccli/services/mariadb/v20170312/examples.json +2 -2
  69. tccli/services/mps/v20190612/api.json +172 -92
  70. tccli/services/mps/v20190612/examples.json +2 -2
  71. tccli/services/ocr/v20181119/api.json +1 -1
  72. tccli/services/omics/v20221128/api.json +20 -2
  73. tccli/services/organization/organization_client.py +106 -0
  74. tccli/services/organization/v20210331/api.json +258 -0
  75. tccli/services/organization/v20210331/examples.json +16 -0
  76. tccli/services/ssl/ssl_client.py +53 -0
  77. tccli/services/ssl/v20191205/api.json +160 -9
  78. tccli/services/ssl/v20191205/examples.json +8 -0
  79. tccli/services/ssm/v20190923/api.json +1 -1
  80. tccli/services/tdmq/v20200217/api.json +65 -26
  81. tccli/services/tdmq/v20200217/examples.json +2 -2
  82. tccli/services/trocket/v20230308/api.json +226 -108
  83. tccli/services/trocket/v20230308/examples.json +13 -25
  84. tccli/services/trtc/v20190722/api.json +34 -15
  85. tccli/services/vpc/v20170312/api.json +20 -5
  86. tccli/services/vpc/v20170312/examples.json +2 -2
  87. tccli/services/weilingwith/v20230427/api.json +11 -11
  88. {tccli-3.0.1095.1.dist-info → tccli-3.0.1097.1.dist-info}/METADATA +2 -2
  89. {tccli-3.0.1095.1.dist-info → tccli-3.0.1097.1.dist-info}/RECORD +92 -81
  90. {tccli-3.0.1095.1.dist-info → tccli-3.0.1097.1.dist-info}/WHEEL +0 -0
  91. {tccli-3.0.1095.1.dist-info → tccli-3.0.1097.1.dist-info}/entry_points.txt +0 -0
  92. {tccli-3.0.1095.1.dist-info → tccli-3.0.1097.1.dist-info}/license_files/LICENSE +0 -0
@@ -6,7 +6,7 @@ Input:
6
6
 
7
7
  ```
8
8
  tccli vpc DisableVpnGatewaySslClientCert --cli-unfold-argument \
9
- --SslVpnClientId vpnc-xxxx
9
+ --SslVpnClientId vpnc-04ubidcy
10
10
  ```
11
11
 
12
12
  Output:
@@ -14,7 +14,7 @@ Output:
14
14
  {
15
15
  "Response": {
16
16
  "RequestId": "aeabeab6-f74b-453a-b25d-d7b460193c3b",
17
- "TaskId": 123
17
+ "TaskId": 315123
18
18
  }
19
19
  }
20
20
  ```
@@ -17,6 +17,110 @@ from tencentcloud.aiart.v20221229 import models as models_v20221229
17
17
  from jmespath import search
18
18
  import time
19
19
 
20
+ def doSubmitTextToImageProJob(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.AiartClient(cred, g_param[OptionsDefine.Region], profile)
47
+ client._sdkVersion += ("_CLI_" + __version__)
48
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
+ model = models.SubmitTextToImageProJobRequest()
50
+ model.from_json_string(json.dumps(args))
51
+ start_time = time.time()
52
+ while True:
53
+ rsp = client.SubmitTextToImageProJob(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 doSubmitTrainPortraitModelJob(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.AiartClient(cred, g_param[OptionsDefine.Region], profile)
99
+ client._sdkVersion += ("_CLI_" + __version__)
100
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
101
+ model = models.SubmitTrainPortraitModelJobRequest()
102
+ model.from_json_string(json.dumps(args))
103
+ start_time = time.time()
104
+ while True:
105
+ rsp = client.SubmitTrainPortraitModelJob(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 doQueryTextToImageProJob(args, parsed_globals):
21
125
  g_param = parse_global_arg(parsed_globals)
22
126
 
@@ -69,7 +173,7 @@ def doQueryTextToImageProJob(args, parsed_globals):
69
173
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
70
174
 
71
175
 
72
- def doSubmitTextToImageProJob(args, parsed_globals):
176
+ def doQueryTrainPortraitModelJob(args, parsed_globals):
73
177
  g_param = parse_global_arg(parsed_globals)
74
178
 
75
179
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -98,11 +202,115 @@ def doSubmitTextToImageProJob(args, parsed_globals):
98
202
  client = mod.AiartClient(cred, g_param[OptionsDefine.Region], profile)
99
203
  client._sdkVersion += ("_CLI_" + __version__)
100
204
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
101
- model = models.SubmitTextToImageProJobRequest()
205
+ model = models.QueryTrainPortraitModelJobRequest()
102
206
  model.from_json_string(json.dumps(args))
103
207
  start_time = time.time()
104
208
  while True:
105
- rsp = client.SubmitTextToImageProJob(model)
209
+ rsp = client.QueryTrainPortraitModelJob(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
+ def doUploadTrainPortraitImages(args, parsed_globals):
229
+ g_param = parse_global_arg(parsed_globals)
230
+
231
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
232
+ cred = credential.CVMRoleCredential()
233
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
234
+ cred = credential.STSAssumeRoleCredential(
235
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
236
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
237
+ )
238
+ 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):
239
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
240
+ else:
241
+ cred = credential.Credential(
242
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
243
+ )
244
+ http_profile = HttpProfile(
245
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
246
+ reqMethod="POST",
247
+ endpoint=g_param[OptionsDefine.Endpoint],
248
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
249
+ )
250
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
251
+ if g_param[OptionsDefine.Language]:
252
+ profile.language = g_param[OptionsDefine.Language]
253
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
254
+ client = mod.AiartClient(cred, g_param[OptionsDefine.Region], profile)
255
+ client._sdkVersion += ("_CLI_" + __version__)
256
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
257
+ model = models.UploadTrainPortraitImagesRequest()
258
+ model.from_json_string(json.dumps(args))
259
+ start_time = time.time()
260
+ while True:
261
+ rsp = client.UploadTrainPortraitImages(model)
262
+ result = rsp.to_json_string()
263
+ try:
264
+ json_obj = json.loads(result)
265
+ except TypeError as e:
266
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
267
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
268
+ break
269
+ cur_time = time.time()
270
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
271
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
272
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
273
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
274
+ else:
275
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
276
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
277
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
278
+
279
+
280
+ def doQueryDrawPortraitJob(args, parsed_globals):
281
+ g_param = parse_global_arg(parsed_globals)
282
+
283
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
284
+ cred = credential.CVMRoleCredential()
285
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
286
+ cred = credential.STSAssumeRoleCredential(
287
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
288
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
289
+ )
290
+ 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):
291
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
292
+ else:
293
+ cred = credential.Credential(
294
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
295
+ )
296
+ http_profile = HttpProfile(
297
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
298
+ reqMethod="POST",
299
+ endpoint=g_param[OptionsDefine.Endpoint],
300
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
301
+ )
302
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
303
+ if g_param[OptionsDefine.Language]:
304
+ profile.language = g_param[OptionsDefine.Language]
305
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
306
+ client = mod.AiartClient(cred, g_param[OptionsDefine.Region], profile)
307
+ client._sdkVersion += ("_CLI_" + __version__)
308
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
309
+ model = models.QueryDrawPortraitJobRequest()
310
+ model.from_json_string(json.dumps(args))
311
+ start_time = time.time()
312
+ while True:
313
+ rsp = client.QueryDrawPortraitJob(model)
106
314
  result = rsp.to_json_string()
107
315
  try:
108
316
  json_obj = json.loads(result)
@@ -173,6 +381,58 @@ def doTextToImage(args, parsed_globals):
173
381
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
174
382
 
175
383
 
384
+ def doSubmitDrawPortraitJob(args, parsed_globals):
385
+ g_param = parse_global_arg(parsed_globals)
386
+
387
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
388
+ cred = credential.CVMRoleCredential()
389
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
390
+ cred = credential.STSAssumeRoleCredential(
391
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
392
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
393
+ )
394
+ 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):
395
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
396
+ else:
397
+ cred = credential.Credential(
398
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
399
+ )
400
+ http_profile = HttpProfile(
401
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
402
+ reqMethod="POST",
403
+ endpoint=g_param[OptionsDefine.Endpoint],
404
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
405
+ )
406
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
407
+ if g_param[OptionsDefine.Language]:
408
+ profile.language = g_param[OptionsDefine.Language]
409
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
410
+ client = mod.AiartClient(cred, g_param[OptionsDefine.Region], profile)
411
+ client._sdkVersion += ("_CLI_" + __version__)
412
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
413
+ model = models.SubmitDrawPortraitJobRequest()
414
+ model.from_json_string(json.dumps(args))
415
+ start_time = time.time()
416
+ while True:
417
+ rsp = client.SubmitDrawPortraitJob(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
+
176
436
  def doImageToImage(args, parsed_globals):
177
437
  g_param = parse_global_arg(parsed_globals)
178
438
 
@@ -236,9 +496,14 @@ MODELS_MAP = {
236
496
  }
237
497
 
238
498
  ACTION_MAP = {
239
- "QueryTextToImageProJob": doQueryTextToImageProJob,
240
499
  "SubmitTextToImageProJob": doSubmitTextToImageProJob,
500
+ "SubmitTrainPortraitModelJob": doSubmitTrainPortraitModelJob,
501
+ "QueryTextToImageProJob": doQueryTextToImageProJob,
502
+ "QueryTrainPortraitModelJob": doQueryTrainPortraitModelJob,
503
+ "UploadTrainPortraitImages": doUploadTrainPortraitImages,
504
+ "QueryDrawPortraitJob": doQueryDrawPortraitJob,
241
505
  "TextToImage": doTextToImage,
506
+ "SubmitDrawPortraitJob": doSubmitDrawPortraitJob,
242
507
  "ImageToImage": doImageToImage,
243
508
 
244
509
  }