tccli-intl-en 3.0.1267.1__py2.py3-none-any.whl → 3.0.1269.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tccli/__init__.py +1 -1
- tccli/services/__init__.py +3 -0
- tccli/services/cvm/v20170312/api.json +43 -33
- tccli/services/cvm/v20170312/examples.json +12 -12
- tccli/services/dlc/dlc_client.py +114 -8
- tccli/services/dlc/v20210125/api.json +252 -7
- tccli/services/dlc/v20210125/examples.json +16 -0
- tccli/services/faceid/v20180301/examples.json +1 -1
- tccli/services/mdl/v20200326/api.json +41 -11
- tccli/services/mdl/v20200326/examples.json +16 -16
- tccli/services/mdp/v20200527/api.json +60 -14
- tccli/services/mdp/v20200527/examples.json +79 -79
- tccli/services/message/__init__.py +4 -0
- tccli/services/message/message_client.py +207 -0
- tccli/services/message/v20181225/api.json +72 -0
- tccli/services/message/v20181225/examples.json +13 -0
- tccli/services/mps/mps_client.py +212 -0
- tccli/services/mps/v20190612/api.json +417 -0
- tccli/services/mps/v20190612/examples.json +50 -0
- tccli/services/teo/v20220901/api.json +3 -3
- {tccli_intl_en-3.0.1267.1.dist-info → tccli_intl_en-3.0.1269.1.dist-info}/METADATA +2 -2
- {tccli_intl_en-3.0.1267.1.dist-info → tccli_intl_en-3.0.1269.1.dist-info}/RECORD +26 -22
- {tccli_intl_en-3.0.1267.1.dist-info → tccli_intl_en-3.0.1269.1.dist-info}/LICENSE +0 -0
- {tccli_intl_en-3.0.1267.1.dist-info → tccli_intl_en-3.0.1269.1.dist-info}/WHEEL +0 -0
- {tccli_intl_en-3.0.1267.1.dist-info → tccli_intl_en-3.0.1269.1.dist-info}/entry_points.txt +0 -0
- {tccli_intl_en-3.0.1267.1.dist-info → tccli_intl_en-3.0.1269.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
import six
|
|
5
|
+
import json
|
|
6
|
+
import tccli.options_define as OptionsDefine
|
|
7
|
+
import tccli.format_output as FormatOutput
|
|
8
|
+
from tccli import __version__
|
|
9
|
+
from tccli.utils import Utils
|
|
10
|
+
from tccli.exceptions import ConfigurationError, ClientError, ParamError
|
|
11
|
+
from tencentcloud.common import credential
|
|
12
|
+
from tencentcloud.common.profile.http_profile import HttpProfile
|
|
13
|
+
from tencentcloud.common.profile.client_profile import ClientProfile
|
|
14
|
+
from tencentcloud.message.v20181225 import message_client as message_client_v20181225
|
|
15
|
+
from tencentcloud.message.v20181225 import models as models_v20181225
|
|
16
|
+
|
|
17
|
+
from jmespath import search
|
|
18
|
+
import time
|
|
19
|
+
|
|
20
|
+
def doModifySendChannelOnMsgTypes(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.MessageClient(cred, g_param[OptionsDefine.Region], profile)
|
|
47
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
48
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
49
|
+
model = models.ModifySendChannelOnMsgTypesRequest()
|
|
50
|
+
model.from_json_string(json.dumps(args))
|
|
51
|
+
start_time = time.time()
|
|
52
|
+
while True:
|
|
53
|
+
rsp = client.ModifySendChannelOnMsgTypes(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
|
+
CLIENT_MAP = {
|
|
73
|
+
"v20181225": message_client_v20181225,
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
MODELS_MAP = {
|
|
78
|
+
"v20181225": models_v20181225,
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
ACTION_MAP = {
|
|
83
|
+
"ModifySendChannelOnMsgTypes": doModifySendChannelOnMsgTypes,
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
AVAILABLE_VERSION_LIST = [
|
|
88
|
+
"v20181225",
|
|
89
|
+
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def action_caller():
|
|
94
|
+
return ACTION_MAP
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def parse_global_arg(parsed_globals):
|
|
98
|
+
g_param = parsed_globals
|
|
99
|
+
cvm_role_flag = True
|
|
100
|
+
for param in parsed_globals.keys():
|
|
101
|
+
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.RoleArn,
|
|
102
|
+
OptionsDefine.RoleSessionName]:
|
|
103
|
+
if parsed_globals[param] is not None:
|
|
104
|
+
cvm_role_flag = False
|
|
105
|
+
break
|
|
106
|
+
is_exist_profile = True
|
|
107
|
+
if not parsed_globals["profile"]:
|
|
108
|
+
is_exist_profile = False
|
|
109
|
+
g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
|
|
110
|
+
|
|
111
|
+
configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
|
|
112
|
+
is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
|
|
113
|
+
is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
|
|
114
|
+
|
|
115
|
+
conf = {}
|
|
116
|
+
cred = {}
|
|
117
|
+
|
|
118
|
+
if is_conf_exist:
|
|
119
|
+
conf = Utils.load_json_msg(conf_path)
|
|
120
|
+
if is_cred_exist:
|
|
121
|
+
cred = Utils.load_json_msg(cred_path)
|
|
122
|
+
|
|
123
|
+
if not (isinstance(conf, dict) and isinstance(cred, dict)):
|
|
124
|
+
raise ConfigurationError(
|
|
125
|
+
"file: %s or %s is not json format"
|
|
126
|
+
% (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
|
|
127
|
+
|
|
128
|
+
if OptionsDefine.Token not in cred:
|
|
129
|
+
cred[OptionsDefine.Token] = None
|
|
130
|
+
|
|
131
|
+
if not is_exist_profile:
|
|
132
|
+
if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
|
|
133
|
+
cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
|
|
134
|
+
cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
|
|
135
|
+
cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
|
|
136
|
+
cvm_role_flag = False
|
|
137
|
+
|
|
138
|
+
if os.environ.get(OptionsDefine.ENV_REGION):
|
|
139
|
+
conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
|
|
140
|
+
|
|
141
|
+
if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
|
|
142
|
+
cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
|
|
143
|
+
cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
|
|
144
|
+
cvm_role_flag = False
|
|
145
|
+
|
|
146
|
+
if cvm_role_flag:
|
|
147
|
+
if "type" in cred and cred["type"] == "cvm-role":
|
|
148
|
+
g_param[OptionsDefine.UseCVMRole.replace('-', '_')] = True
|
|
149
|
+
|
|
150
|
+
for param in g_param.keys():
|
|
151
|
+
if g_param[param] is None:
|
|
152
|
+
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
|
|
153
|
+
if param in cred:
|
|
154
|
+
g_param[param] = cred[param]
|
|
155
|
+
elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
|
|
156
|
+
or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
|
|
157
|
+
raise ConfigurationError("%s is invalid" % param)
|
|
158
|
+
elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
|
|
159
|
+
if param in conf[OptionsDefine.SysParam]:
|
|
160
|
+
g_param[param] = conf[OptionsDefine.SysParam][param]
|
|
161
|
+
elif param != OptionsDefine.Language:
|
|
162
|
+
raise ConfigurationError("%s is invalid" % param)
|
|
163
|
+
elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
|
|
164
|
+
if param.replace('_', '-') in cred:
|
|
165
|
+
g_param[param] = cred[param.replace('_', '-')]
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
if g_param[OptionsDefine.ServiceVersion]:
|
|
169
|
+
g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
|
|
170
|
+
else:
|
|
171
|
+
version = conf["message"][OptionsDefine.Version]
|
|
172
|
+
g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
|
|
173
|
+
|
|
174
|
+
if g_param[OptionsDefine.Endpoint] is None:
|
|
175
|
+
g_param[OptionsDefine.Endpoint] = conf["message"][OptionsDefine.Endpoint]
|
|
176
|
+
g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
|
|
177
|
+
except Exception as err:
|
|
178
|
+
raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
|
|
179
|
+
|
|
180
|
+
if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
|
|
181
|
+
raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
|
|
182
|
+
|
|
183
|
+
if g_param[OptionsDefine.Waiter]:
|
|
184
|
+
param = eval(g_param[OptionsDefine.Waiter])
|
|
185
|
+
if 'expr' not in param:
|
|
186
|
+
raise Exception('`expr` in `--waiter` must be defined')
|
|
187
|
+
if 'to' not in param:
|
|
188
|
+
raise Exception('`to` in `--waiter` must be defined')
|
|
189
|
+
if 'timeout' not in param:
|
|
190
|
+
if 'waiter' in conf and 'timeout' in conf['waiter']:
|
|
191
|
+
param['timeout'] = conf['waiter']['timeout']
|
|
192
|
+
else:
|
|
193
|
+
param['timeout'] = 180
|
|
194
|
+
if 'interval' not in param:
|
|
195
|
+
if 'waiter' in conf and 'interval' in conf['waiter']:
|
|
196
|
+
param['interval'] = conf['waiter']['interval']
|
|
197
|
+
else:
|
|
198
|
+
param['interval'] = 5
|
|
199
|
+
param['interval'] = min(param['interval'], param['timeout'])
|
|
200
|
+
g_param['OptionsDefine.WaiterInfo'] = param
|
|
201
|
+
|
|
202
|
+
if six.PY2:
|
|
203
|
+
for key, value in g_param.items():
|
|
204
|
+
if isinstance(value, six.text_type):
|
|
205
|
+
g_param[key] = value.encode('utf-8')
|
|
206
|
+
return g_param
|
|
207
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": {
|
|
3
|
+
"ModifySendChannelOnMsgTypes": {
|
|
4
|
+
"document": "This API is used to batch modify delivery methods.",
|
|
5
|
+
"input": "ModifySendChannelOnMsgTypesRequest",
|
|
6
|
+
"name": "Batch modify message reception channel",
|
|
7
|
+
"output": "ModifySendChannelOnMsgTypesResponse",
|
|
8
|
+
"status": "online"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"metadata": {
|
|
12
|
+
"apiVersion": "2018-12-25",
|
|
13
|
+
"serviceNameCN": "消息中心",
|
|
14
|
+
"serviceShortName": "message"
|
|
15
|
+
},
|
|
16
|
+
"objects": {
|
|
17
|
+
"ModifySendChannelOnMsgTypesRequest": {
|
|
18
|
+
"document": "ModifySendChannelOnMsgTypes request structure.",
|
|
19
|
+
"members": [
|
|
20
|
+
{
|
|
21
|
+
"disabled": false,
|
|
22
|
+
"document": "Message sending channel.",
|
|
23
|
+
"example": "",
|
|
24
|
+
"member": "SendType",
|
|
25
|
+
"name": "SendTypes",
|
|
26
|
+
"required": true,
|
|
27
|
+
"type": "list"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"type": "object"
|
|
31
|
+
},
|
|
32
|
+
"ModifySendChannelOnMsgTypesResponse": {
|
|
33
|
+
"document": "ModifySendChannelOnMsgTypes response structure.",
|
|
34
|
+
"members": [
|
|
35
|
+
{
|
|
36
|
+
"document": "The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.",
|
|
37
|
+
"member": "string",
|
|
38
|
+
"name": "RequestId",
|
|
39
|
+
"type": "string"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"type": "object"
|
|
43
|
+
},
|
|
44
|
+
"SendType": {
|
|
45
|
+
"document": "Message type sending channel.",
|
|
46
|
+
"members": [
|
|
47
|
+
{
|
|
48
|
+
"disabled": false,
|
|
49
|
+
"document": "Message type.",
|
|
50
|
+
"example": "",
|
|
51
|
+
"member": "uint64",
|
|
52
|
+
"name": "MsgType",
|
|
53
|
+
"required": true,
|
|
54
|
+
"type": "int",
|
|
55
|
+
"value_allowed_null": false
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"disabled": false,
|
|
59
|
+
"document": "Delivery channel.",
|
|
60
|
+
"example": "",
|
|
61
|
+
"member": "uint64",
|
|
62
|
+
"name": "SendChannel",
|
|
63
|
+
"required": true,
|
|
64
|
+
"type": "int",
|
|
65
|
+
"value_allowed_null": false
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"usage": "in"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"version": "1.0"
|
|
72
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": {
|
|
3
|
+
"ModifySendChannelOnMsgTypes": [
|
|
4
|
+
{
|
|
5
|
+
"document": " ",
|
|
6
|
+
"input": "https://message.tencentcloudapi.com/?Action=ModifySendChannelOnMsgTypes\r\n&SendTypes.0.MsgType=207\r\n&SendTypes.0.SendChannel=7\r\n&<Common request parameters>",
|
|
7
|
+
"output": "{\n \"Response\": {\n \"RequestId\": \"85d1906b-274b-44ac-a22e-4fdc00822347\"\n }\n}",
|
|
8
|
+
"title": "Batch Modify Message Reception Channel"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"version": "1.0"
|
|
13
|
+
}
|
tccli/services/mps/mps_client.py
CHANGED
|
@@ -2253,6 +2253,110 @@ def doProcessImage(args, parsed_globals):
|
|
|
2253
2253
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2254
2254
|
|
|
2255
2255
|
|
|
2256
|
+
def doDescribeSmartEraseTemplates(args, parsed_globals):
|
|
2257
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2258
|
+
|
|
2259
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2260
|
+
cred = credential.CVMRoleCredential()
|
|
2261
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2262
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2263
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2264
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2265
|
+
)
|
|
2266
|
+
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):
|
|
2267
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2268
|
+
else:
|
|
2269
|
+
cred = credential.Credential(
|
|
2270
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2271
|
+
)
|
|
2272
|
+
http_profile = HttpProfile(
|
|
2273
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2274
|
+
reqMethod="POST",
|
|
2275
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2276
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2277
|
+
)
|
|
2278
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2279
|
+
if g_param[OptionsDefine.Language]:
|
|
2280
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2281
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2282
|
+
client = mod.MpsClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2283
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2284
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2285
|
+
model = models.DescribeSmartEraseTemplatesRequest()
|
|
2286
|
+
model.from_json_string(json.dumps(args))
|
|
2287
|
+
start_time = time.time()
|
|
2288
|
+
while True:
|
|
2289
|
+
rsp = client.DescribeSmartEraseTemplates(model)
|
|
2290
|
+
result = rsp.to_json_string()
|
|
2291
|
+
try:
|
|
2292
|
+
json_obj = json.loads(result)
|
|
2293
|
+
except TypeError as e:
|
|
2294
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2295
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2296
|
+
break
|
|
2297
|
+
cur_time = time.time()
|
|
2298
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2299
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2300
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2301
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2302
|
+
else:
|
|
2303
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2304
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2305
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2306
|
+
|
|
2307
|
+
|
|
2308
|
+
def doModifySmartEraseTemplate(args, parsed_globals):
|
|
2309
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2310
|
+
|
|
2311
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2312
|
+
cred = credential.CVMRoleCredential()
|
|
2313
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2314
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2315
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2316
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2317
|
+
)
|
|
2318
|
+
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):
|
|
2319
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2320
|
+
else:
|
|
2321
|
+
cred = credential.Credential(
|
|
2322
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2323
|
+
)
|
|
2324
|
+
http_profile = HttpProfile(
|
|
2325
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2326
|
+
reqMethod="POST",
|
|
2327
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2328
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2329
|
+
)
|
|
2330
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2331
|
+
if g_param[OptionsDefine.Language]:
|
|
2332
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2333
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2334
|
+
client = mod.MpsClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2335
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2336
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2337
|
+
model = models.ModifySmartEraseTemplateRequest()
|
|
2338
|
+
model.from_json_string(json.dumps(args))
|
|
2339
|
+
start_time = time.time()
|
|
2340
|
+
while True:
|
|
2341
|
+
rsp = client.ModifySmartEraseTemplate(model)
|
|
2342
|
+
result = rsp.to_json_string()
|
|
2343
|
+
try:
|
|
2344
|
+
json_obj = json.loads(result)
|
|
2345
|
+
except TypeError as e:
|
|
2346
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2347
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2348
|
+
break
|
|
2349
|
+
cur_time = time.time()
|
|
2350
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2351
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2352
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2353
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2354
|
+
else:
|
|
2355
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2356
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2357
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2358
|
+
|
|
2359
|
+
|
|
2256
2360
|
def doCreateSmartSubtitleTemplate(args, parsed_globals):
|
|
2257
2361
|
g_param = parse_global_arg(parsed_globals)
|
|
2258
2362
|
|
|
@@ -4541,6 +4645,58 @@ def doDisableSchedule(args, parsed_globals):
|
|
|
4541
4645
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
4542
4646
|
|
|
4543
4647
|
|
|
4648
|
+
def doCreateSmartEraseTemplate(args, parsed_globals):
|
|
4649
|
+
g_param = parse_global_arg(parsed_globals)
|
|
4650
|
+
|
|
4651
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
4652
|
+
cred = credential.CVMRoleCredential()
|
|
4653
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
4654
|
+
cred = credential.STSAssumeRoleCredential(
|
|
4655
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
4656
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
4657
|
+
)
|
|
4658
|
+
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):
|
|
4659
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
4660
|
+
else:
|
|
4661
|
+
cred = credential.Credential(
|
|
4662
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
4663
|
+
)
|
|
4664
|
+
http_profile = HttpProfile(
|
|
4665
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
4666
|
+
reqMethod="POST",
|
|
4667
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
4668
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
4669
|
+
)
|
|
4670
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
4671
|
+
if g_param[OptionsDefine.Language]:
|
|
4672
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
4673
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
4674
|
+
client = mod.MpsClient(cred, g_param[OptionsDefine.Region], profile)
|
|
4675
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
4676
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
4677
|
+
model = models.CreateSmartEraseTemplateRequest()
|
|
4678
|
+
model.from_json_string(json.dumps(args))
|
|
4679
|
+
start_time = time.time()
|
|
4680
|
+
while True:
|
|
4681
|
+
rsp = client.CreateSmartEraseTemplate(model)
|
|
4682
|
+
result = rsp.to_json_string()
|
|
4683
|
+
try:
|
|
4684
|
+
json_obj = json.loads(result)
|
|
4685
|
+
except TypeError as e:
|
|
4686
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
4687
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
4688
|
+
break
|
|
4689
|
+
cur_time = time.time()
|
|
4690
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
4691
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
4692
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
4693
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
4694
|
+
else:
|
|
4695
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
4696
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
4697
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
4698
|
+
|
|
4699
|
+
|
|
4544
4700
|
def doModifyContentReviewTemplate(args, parsed_globals):
|
|
4545
4701
|
g_param = parse_global_arg(parsed_globals)
|
|
4546
4702
|
|
|
@@ -4697,6 +4853,58 @@ def doModifyAIRecognitionTemplate(args, parsed_globals):
|
|
|
4697
4853
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
4698
4854
|
|
|
4699
4855
|
|
|
4856
|
+
def doDeleteSmartEraseTemplate(args, parsed_globals):
|
|
4857
|
+
g_param = parse_global_arg(parsed_globals)
|
|
4858
|
+
|
|
4859
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
4860
|
+
cred = credential.CVMRoleCredential()
|
|
4861
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
4862
|
+
cred = credential.STSAssumeRoleCredential(
|
|
4863
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
4864
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
4865
|
+
)
|
|
4866
|
+
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):
|
|
4867
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
4868
|
+
else:
|
|
4869
|
+
cred = credential.Credential(
|
|
4870
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
4871
|
+
)
|
|
4872
|
+
http_profile = HttpProfile(
|
|
4873
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
4874
|
+
reqMethod="POST",
|
|
4875
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
4876
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
4877
|
+
)
|
|
4878
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
4879
|
+
if g_param[OptionsDefine.Language]:
|
|
4880
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
4881
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
4882
|
+
client = mod.MpsClient(cred, g_param[OptionsDefine.Region], profile)
|
|
4883
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
4884
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
4885
|
+
model = models.DeleteSmartEraseTemplateRequest()
|
|
4886
|
+
model.from_json_string(json.dumps(args))
|
|
4887
|
+
start_time = time.time()
|
|
4888
|
+
while True:
|
|
4889
|
+
rsp = client.DeleteSmartEraseTemplate(model)
|
|
4890
|
+
result = rsp.to_json_string()
|
|
4891
|
+
try:
|
|
4892
|
+
json_obj = json.loads(result)
|
|
4893
|
+
except TypeError as e:
|
|
4894
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
4895
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
4896
|
+
break
|
|
4897
|
+
cur_time = time.time()
|
|
4898
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
4899
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
4900
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
4901
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
4902
|
+
else:
|
|
4903
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
4904
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
4905
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
4906
|
+
|
|
4907
|
+
|
|
4700
4908
|
def doModifyAdaptiveDynamicStreamingTemplate(args, parsed_globals):
|
|
4701
4909
|
g_param = parse_global_arg(parsed_globals)
|
|
4702
4910
|
|
|
@@ -4855,6 +5063,8 @@ ACTION_MAP = {
|
|
|
4855
5063
|
"ModifyImageSpriteTemplate": doModifyImageSpriteTemplate,
|
|
4856
5064
|
"DescribeTranscodeTemplates": doDescribeTranscodeTemplates,
|
|
4857
5065
|
"ProcessImage": doProcessImage,
|
|
5066
|
+
"DescribeSmartEraseTemplates": doDescribeSmartEraseTemplates,
|
|
5067
|
+
"ModifySmartEraseTemplate": doModifySmartEraseTemplate,
|
|
4858
5068
|
"CreateSmartSubtitleTemplate": doCreateSmartSubtitleTemplate,
|
|
4859
5069
|
"DescribeSchedules": doDescribeSchedules,
|
|
4860
5070
|
"ModifyPersonSample": doModifyPersonSample,
|
|
@@ -4899,9 +5109,11 @@ ACTION_MAP = {
|
|
|
4899
5109
|
"CreatePersonSample": doCreatePersonSample,
|
|
4900
5110
|
"DescribeQualityControlTemplates": doDescribeQualityControlTemplates,
|
|
4901
5111
|
"DisableSchedule": doDisableSchedule,
|
|
5112
|
+
"CreateSmartEraseTemplate": doCreateSmartEraseTemplate,
|
|
4902
5113
|
"ModifyContentReviewTemplate": doModifyContentReviewTemplate,
|
|
4903
5114
|
"CreateAIRecognitionTemplate": doCreateAIRecognitionTemplate,
|
|
4904
5115
|
"ModifyAIRecognitionTemplate": doModifyAIRecognitionTemplate,
|
|
5116
|
+
"DeleteSmartEraseTemplate": doDeleteSmartEraseTemplate,
|
|
4905
5117
|
"ModifyAdaptiveDynamicStreamingTemplate": doModifyAdaptiveDynamicStreamingTemplate,
|
|
4906
5118
|
"DeleteImageSpriteTemplate": doDeleteImageSpriteTemplate,
|
|
4907
5119
|
|