tccli 3.0.1096.1__py2.py3-none-any.whl → 3.0.1098.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 (81) 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/apm/v20210622/DescribeGeneralApmApplicationConfig.md +103 -0
  8. tccli/examples/apm/v20210622/DescribeTagValues.md +27 -0
  9. tccli/examples/apm/v20210622/ModifyGeneralApmApplicationConfig.md +29 -0
  10. tccli/examples/ccc/v20200210/ModifyStaffPassword.md +22 -0
  11. tccli/examples/csip/v20221121/DescribeAlertList.md +176 -0
  12. tccli/examples/cynosdb/v20190107/ModifyInstanceUpgradeLimitDays.md +22 -0
  13. tccli/examples/dcdb/v20180411/DescribeDCDBInstances.md +4 -3
  14. tccli/examples/dlc/v20210125/DescribeNotebookSessionStatementSqlResult.md +3 -1
  15. tccli/examples/ess/v20201111/CreateBatchSignUrl.md +28 -0
  16. tccli/examples/essbasic/v20210526/ChannelCreateBatchSignUrl.md +28 -0
  17. tccli/examples/iotexplorer/v20190423/DescribeDeviceFirmwares.md +33 -0
  18. tccli/examples/lke/v20231130/GetEmbedding.md +4 -1
  19. tccli/examples/lke/v20231130/QueryParseDocResult.md +4 -1
  20. tccli/examples/lke/v20231130/QueryRewrite.md +6 -1
  21. tccli/examples/mariadb/v20170312/DescribeDBInstanceDetail.md +2 -1
  22. tccli/examples/mariadb/v20170312/DescribeDBInstances.md +4 -3
  23. tccli/examples/tdmq/v20200217/DescribeRabbitMQQueueDetail.md +25 -22
  24. tccli/examples/vpc/v20170312/DisableVpnGatewaySslClientCert.md +2 -2
  25. tccli/services/aiart/aiart_client.py +269 -4
  26. tccli/services/aiart/v20221229/api.json +404 -0
  27. tccli/services/aiart/v20221229/examples.json +40 -0
  28. tccli/services/apm/apm_client.py +159 -0
  29. tccli/services/apm/v20210622/api.json +456 -0
  30. tccli/services/apm/v20210622/examples.json +24 -0
  31. tccli/services/billing/v20180709/api.json +30 -0
  32. tccli/services/bma/v20221115/api.json +4 -6
  33. tccli/services/ccc/ccc_client.py +53 -0
  34. tccli/services/ccc/v20200210/api.json +57 -5
  35. tccli/services/ccc/v20200210/examples.json +8 -0
  36. tccli/services/cdb/v20170320/api.json +9 -0
  37. tccli/services/cdn/v20180606/api.json +1 -1
  38. tccli/services/cloudstudio/v20230508/api.json +1 -1
  39. tccli/services/csip/csip_client.py +53 -0
  40. tccli/services/csip/v20221121/api.json +1468 -7
  41. tccli/services/csip/v20221121/examples.json +8 -0
  42. tccli/services/cynosdb/cynosdb_client.py +53 -0
  43. tccli/services/cynosdb/v20190107/api.json +54 -0
  44. tccli/services/cynosdb/v20190107/examples.json +8 -0
  45. tccli/services/dcdb/v20180411/api.json +45 -3
  46. tccli/services/dcdb/v20180411/examples.json +1 -1
  47. tccli/services/dlc/v20210125/api.json +30 -0
  48. tccli/services/dlc/v20210125/examples.json +1 -1
  49. tccli/services/ess/v20201111/api.json +50 -2
  50. tccli/services/ess/v20201111/examples.json +6 -0
  51. tccli/services/essbasic/v20210526/api.json +50 -2
  52. tccli/services/essbasic/v20210526/examples.json +6 -0
  53. tccli/services/hunyuan/v20230901/api.json +14 -14
  54. tccli/services/ims/v20201229/api.json +55 -55
  55. tccli/services/iotexplorer/iotexplorer_client.py +53 -0
  56. tccli/services/iotexplorer/v20190423/api.json +90 -1
  57. tccli/services/iotexplorer/v20190423/examples.json +8 -0
  58. tccli/services/iss/v20230517/api.json +36 -0
  59. tccli/services/lighthouse/v20200324/api.json +2 -2
  60. tccli/services/live/v20180801/api.json +7 -7
  61. tccli/services/lke/lke_client.py +8 -114
  62. tccli/services/lke/v20231130/api.json +70 -158
  63. tccli/services/lke/v20231130/examples.json +2 -18
  64. tccli/services/mariadb/v20170312/api.json +45 -2
  65. tccli/services/mariadb/v20170312/examples.json +2 -2
  66. tccli/services/ocr/v20181119/api.json +1 -1
  67. tccli/services/ssl/v20191205/api.json +50 -9
  68. tccli/services/tdid/v20210519/api.json +2 -2
  69. tccli/services/tdmq/v20200217/api.json +64 -25
  70. tccli/services/tdmq/v20200217/examples.json +2 -2
  71. tccli/services/teo/v20220901/api.json +14 -14
  72. tccli/services/tione/v20211111/api.json +28 -0
  73. tccli/services/trtc/v20190722/api.json +34 -15
  74. tccli/services/vpc/v20170312/api.json +20 -5
  75. tccli/services/vpc/v20170312/examples.json +2 -2
  76. tccli/services/weilingwith/v20230427/api.json +11 -11
  77. {tccli-3.0.1096.1.dist-info → tccli-3.0.1098.1.dist-info}/METADATA +2 -2
  78. {tccli-3.0.1096.1.dist-info → tccli-3.0.1098.1.dist-info}/RECORD +81 -69
  79. {tccli-3.0.1096.1.dist-info → tccli-3.0.1098.1.dist-info}/WHEEL +0 -0
  80. {tccli-3.0.1096.1.dist-info → tccli-3.0.1098.1.dist-info}/entry_points.txt +0 -0
  81. {tccli-3.0.1096.1.dist-info → tccli-3.0.1098.1.dist-info}/license_files/LICENSE +0 -0
@@ -93,7 +93,8 @@ Output:
93
93
  ],
94
94
  "IsPhysicalReplicationSupported": true,
95
95
  "IsDcnStrongSyncSupported": 1,
96
- "IsDcnSwitchSupported": 1
96
+ "IsDcnSwitchSupported": 1,
97
+ "ProxyVersion": "proxy-22.1.7"
97
98
  }
98
99
  }
99
100
  ```
@@ -67,10 +67,11 @@ Output:
67
67
  "Zone": "ap-guangzhou-1",
68
68
  "ResourceTags": [
69
69
  {
70
- "TagKey": "xx",
71
- "TagValue": "xx"
70
+ "TagKey": "name",
71
+ "TagValue": "liu"
72
72
  }
73
- ]
73
+ ],
74
+ "DbVersionId": "8.0"
74
75
  }
75
76
  ],
76
77
  "RequestId": "66c4d0c5-bdef-45bd-aa5b-05642802d034",
@@ -6,40 +6,43 @@ Input:
6
6
 
7
7
  ```
8
8
  tccli tdmq DescribeRabbitMQQueueDetail --cli-unfold-argument \
9
- --InstanceId amqp-44w9928j \
10
- --VirtualHost test \
11
- --QueueName xx
9
+ --InstanceId abc \
10
+ --VirtualHost abc \
11
+ --QueueName abc
12
12
  ```
13
13
 
14
14
  Output:
15
15
  ```
16
16
  {
17
17
  "Response": {
18
+ "InstanceId": "abc",
19
+ "VirtualHost": "abc",
20
+ "QueueName": "abc",
21
+ "QueueType": "abc",
18
22
  "Consumers": 0,
19
23
  "Durable": true,
20
- "LazyMode": true,
21
- "QueueName": "xx",
22
- "QueueType": "xx",
23
- "VirtualHost": "xx",
24
- "InstanceId": "xx",
24
+ "AutoDelete": true,
25
+ "Remark": "abc",
26
+ "MessageTTL": 0,
25
27
  "AutoExpire": 0,
26
- "MaxInMemoryLength": 0,
28
+ "MaxLength": 0,
27
29
  "MaxLengthBytes": 0,
28
- "MessageTTL": 0,
29
- "SingleActiveConsumer": true,
30
- "Remark": "xx",
31
- "AutoDelete": true,
32
- "DeadLetterExchange": "xx",
33
30
  "DeliveryLimit": 0,
34
- "RequestId": "xx",
35
- "OverflowBehaviour": "xx",
36
- "MasterLocator": "xx",
37
- "MaxInMemoryBytes": 0,
31
+ "OverflowBehaviour": "abc",
32
+ "DeadLetterExchange": "abc",
33
+ "DeadLetterRoutingKey": "abc",
34
+ "SingleActiveConsumer": true,
38
35
  "MaximumPriority": 0,
39
- "DeadLetterRoutingKey": "xx",
40
- "MaxLength": 0,
41
- "Node": "xx",
42
- "CreateTime": 1669174535
36
+ "LazyMode": true,
37
+ "MasterLocator": "abc",
38
+ "MaxInMemoryLength": 0,
39
+ "MaxInMemoryBytes": 0,
40
+ "CreateTime": 0,
41
+ "Node": "abc",
42
+ "DeadLetterStrategy": "abc",
43
+ "QueueLeaderLocator": "abc",
44
+ "QuorumInitialGroupSize": 0,
45
+ "RequestId": "abc"
43
46
  }
44
47
  }
45
48
  ```
@@ -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
  }