tccli 3.0.1121.1__py2.py3-none-any.whl → 3.0.1123.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/antiddos/v20200309/api.json +19 -0
- tccli/services/cdb/v20170320/api.json +127 -26
- tccli/services/cdb/v20170320/examples.json +2 -2
- tccli/services/domain/v20180808/api.json +120 -102
- tccli/services/ess/ess_client.py +53 -0
- tccli/services/ess/v20201111/api.json +126 -0
- tccli/services/ess/v20201111/examples.json +20 -0
- tccli/services/faceid/v20180301/api.json +2 -2
- tccli/services/iotcloud/v20210408/api.json +37 -17
- tccli/services/iotexplorer/v20190423/api.json +20 -10
- tccli/services/lighthouse/v20200324/api.json +78 -70
- tccli/services/lighthouse/v20200324/examples.json +1 -1
- tccli/services/ms/v20180408/api.json +6 -3
- tccli/services/ms/v20180408/examples.json +1 -1
- tccli/services/oceanus/v20190422/api.json +10 -0
- tccli/services/redis/v20180412/api.json +4 -4
- tccli/services/rum/v20210622/api.json +7 -6
- tccli/services/rum/v20210622/examples.json +15 -15
- tccli/services/tcb/v20180608/api.json +5 -5
- tccli/services/tcr/v20190924/api.json +1 -1
- tccli/services/tcr/v20190924/examples.json +1 -1
- tccli/services/tse/v20201207/api.json +22 -0
- tccli/services/tsf/v20180326/api.json +77 -16
- tccli/services/vdb/__init__.py +4 -0
- tccli/services/vdb/v20230616/api.json +505 -0
- tccli/services/vdb/v20230616/examples.json +13 -0
- tccli/services/vdb/vdb_client.py +195 -0
- tccli/services/waf/v20180125/api.json +124 -0
- tccli/services/waf/v20180125/examples.json +8 -0
- tccli/services/waf/waf_client.py +53 -0
- tccli/services/wedata/v20210820/api.json +9 -0
- tccli/services/yinsuda/v20220527/api.json +285 -268
- tccli/services/yinsuda/v20220527/examples.json +5 -5
- {tccli-3.0.1121.1.dist-info → tccli-3.0.1123.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1121.1.dist-info → tccli-3.0.1123.1.dist-info}/RECORD +40 -36
- {tccli-3.0.1121.1.dist-info → tccli-3.0.1123.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1121.1.dist-info → tccli-3.0.1123.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1121.1.dist-info → tccli-3.0.1123.1.dist-info}/license_files/LICENSE +0 -0
@@ -0,0 +1,195 @@
|
|
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.vdb.v20230616 import vdb_client as vdb_client_v20230616
|
15
|
+
from tencentcloud.vdb.v20230616 import models as models_v20230616
|
16
|
+
|
17
|
+
from jmespath import search
|
18
|
+
import time
|
19
|
+
|
20
|
+
def doDescribeInstances(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.VdbClient(cred, g_param[OptionsDefine.Region], profile)
|
47
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
48
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
49
|
+
model = models.DescribeInstancesRequest()
|
50
|
+
model.from_json_string(json.dumps(args))
|
51
|
+
start_time = time.time()
|
52
|
+
while True:
|
53
|
+
rsp = client.DescribeInstances(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
|
+
"v20230616": vdb_client_v20230616,
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
MODELS_MAP = {
|
78
|
+
"v20230616": models_v20230616,
|
79
|
+
|
80
|
+
}
|
81
|
+
|
82
|
+
ACTION_MAP = {
|
83
|
+
"DescribeInstances": doDescribeInstances,
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
AVAILABLE_VERSION_LIST = [
|
88
|
+
"v20230616",
|
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
|
+
|
100
|
+
is_exist_profile = True
|
101
|
+
if not parsed_globals["profile"]:
|
102
|
+
is_exist_profile = False
|
103
|
+
g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
|
104
|
+
|
105
|
+
configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
|
106
|
+
is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
|
107
|
+
is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
|
108
|
+
|
109
|
+
conf = {}
|
110
|
+
cred = {}
|
111
|
+
|
112
|
+
if is_conf_exist:
|
113
|
+
conf = Utils.load_json_msg(conf_path)
|
114
|
+
if is_cred_exist:
|
115
|
+
cred = Utils.load_json_msg(cred_path)
|
116
|
+
|
117
|
+
if not (isinstance(conf, dict) and isinstance(cred, dict)):
|
118
|
+
raise ConfigurationError(
|
119
|
+
"file: %s or %s is not json format"
|
120
|
+
% (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
|
121
|
+
|
122
|
+
if OptionsDefine.Token not in cred:
|
123
|
+
cred[OptionsDefine.Token] = None
|
124
|
+
|
125
|
+
if not is_exist_profile:
|
126
|
+
if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
|
127
|
+
cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
|
128
|
+
cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
|
129
|
+
cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
|
130
|
+
|
131
|
+
if os.environ.get(OptionsDefine.ENV_REGION):
|
132
|
+
conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
|
133
|
+
|
134
|
+
if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
|
135
|
+
cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
|
136
|
+
cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
|
137
|
+
|
138
|
+
for param in g_param.keys():
|
139
|
+
if g_param[param] is None:
|
140
|
+
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
|
141
|
+
if param in cred:
|
142
|
+
g_param[param] = cred[param]
|
143
|
+
elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
|
144
|
+
or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
|
145
|
+
raise ConfigurationError("%s is invalid" % param)
|
146
|
+
elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
|
147
|
+
if param in conf[OptionsDefine.SysParam]:
|
148
|
+
g_param[param] = conf[OptionsDefine.SysParam][param]
|
149
|
+
elif param != OptionsDefine.Language:
|
150
|
+
raise ConfigurationError("%s is invalid" % param)
|
151
|
+
elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
|
152
|
+
if param.replace('_', '-') in cred:
|
153
|
+
g_param[param] = cred[param.replace('_', '-')]
|
154
|
+
|
155
|
+
try:
|
156
|
+
if g_param[OptionsDefine.ServiceVersion]:
|
157
|
+
g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
|
158
|
+
else:
|
159
|
+
version = conf["vdb"][OptionsDefine.Version]
|
160
|
+
g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
|
161
|
+
|
162
|
+
if g_param[OptionsDefine.Endpoint] is None:
|
163
|
+
g_param[OptionsDefine.Endpoint] = conf["vdb"][OptionsDefine.Endpoint]
|
164
|
+
g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
|
165
|
+
except Exception as err:
|
166
|
+
raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
|
167
|
+
|
168
|
+
if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
|
169
|
+
raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
|
170
|
+
|
171
|
+
if g_param[OptionsDefine.Waiter]:
|
172
|
+
param = eval(g_param[OptionsDefine.Waiter])
|
173
|
+
if 'expr' not in param:
|
174
|
+
raise Exception('`expr` in `--waiter` must be defined')
|
175
|
+
if 'to' not in param:
|
176
|
+
raise Exception('`to` in `--waiter` must be defined')
|
177
|
+
if 'timeout' not in param:
|
178
|
+
if 'waiter' in conf and 'timeout' in conf['waiter']:
|
179
|
+
param['timeout'] = conf['waiter']['timeout']
|
180
|
+
else:
|
181
|
+
param['timeout'] = 180
|
182
|
+
if 'interval' not in param:
|
183
|
+
if 'waiter' in conf and 'interval' in conf['waiter']:
|
184
|
+
param['interval'] = conf['waiter']['interval']
|
185
|
+
else:
|
186
|
+
param['interval'] = 5
|
187
|
+
param['interval'] = min(param['interval'], param['timeout'])
|
188
|
+
g_param['OptionsDefine.WaiterInfo'] = param
|
189
|
+
|
190
|
+
if six.PY2:
|
191
|
+
for key, value in g_param.items():
|
192
|
+
if isinstance(value, six.text_type):
|
193
|
+
g_param[key] = value.encode('utf-8')
|
194
|
+
return g_param
|
195
|
+
|
@@ -672,6 +672,13 @@
|
|
672
672
|
"output": "ModifyApiAnalyzeStatusResponse",
|
673
673
|
"status": "online"
|
674
674
|
},
|
675
|
+
"ModifyApiSecEventChange": {
|
676
|
+
"document": "api安全状态变更接口",
|
677
|
+
"input": "ModifyApiSecEventChangeRequest",
|
678
|
+
"name": "api安全状态变更接口",
|
679
|
+
"output": "ModifyApiSecEventChangeResponse",
|
680
|
+
"status": "online"
|
681
|
+
},
|
675
682
|
"ModifyAreaBanStatus": {
|
676
683
|
"document": "修改防护域名的地域封禁状态",
|
677
684
|
"input": "ModifyAreaBanStatusRequest",
|
@@ -2388,6 +2395,42 @@
|
|
2388
2395
|
],
|
2389
2396
|
"usage": "both"
|
2390
2397
|
},
|
2398
|
+
"ApiSecKey": {
|
2399
|
+
"document": "api列表",
|
2400
|
+
"members": [
|
2401
|
+
{
|
2402
|
+
"disabled": false,
|
2403
|
+
"document": "api名称",
|
2404
|
+
"example": "无",
|
2405
|
+
"member": "string",
|
2406
|
+
"name": "ApiName",
|
2407
|
+
"required": true,
|
2408
|
+
"type": "string",
|
2409
|
+
"value_allowed_null": false
|
2410
|
+
},
|
2411
|
+
{
|
2412
|
+
"disabled": false,
|
2413
|
+
"document": "域名",
|
2414
|
+
"example": "qcloudwaf.com",
|
2415
|
+
"member": "string",
|
2416
|
+
"name": "Domain",
|
2417
|
+
"required": true,
|
2418
|
+
"type": "string",
|
2419
|
+
"value_allowed_null": false
|
2420
|
+
},
|
2421
|
+
{
|
2422
|
+
"disabled": false,
|
2423
|
+
"document": "请求方法",
|
2424
|
+
"example": "POST",
|
2425
|
+
"member": "string",
|
2426
|
+
"name": "Method",
|
2427
|
+
"required": true,
|
2428
|
+
"type": "string",
|
2429
|
+
"value_allowed_null": false
|
2430
|
+
}
|
2431
|
+
],
|
2432
|
+
"usage": "in"
|
2433
|
+
},
|
2391
2434
|
"AttackLogInfo": {
|
2392
2435
|
"document": "攻击日志详情",
|
2393
2436
|
"members": [
|
@@ -14163,6 +14206,87 @@
|
|
14163
14206
|
],
|
14164
14207
|
"type": "object"
|
14165
14208
|
},
|
14209
|
+
"ModifyApiSecEventChangeRequest": {
|
14210
|
+
"document": "ModifyApiSecEventChange请求参数结构体",
|
14211
|
+
"members": [
|
14212
|
+
{
|
14213
|
+
"disabled": false,
|
14214
|
+
"document": "变更状态,1:新发现,2,确认中,3,已确认,4,已下线,5,已忽略",
|
14215
|
+
"example": "1",
|
14216
|
+
"member": "string",
|
14217
|
+
"name": "Mode",
|
14218
|
+
"required": false,
|
14219
|
+
"type": "string"
|
14220
|
+
},
|
14221
|
+
{
|
14222
|
+
"disabled": false,
|
14223
|
+
"document": "处理人",
|
14224
|
+
"example": "ddp",
|
14225
|
+
"member": "string",
|
14226
|
+
"name": "UserName",
|
14227
|
+
"required": false,
|
14228
|
+
"type": "string"
|
14229
|
+
},
|
14230
|
+
{
|
14231
|
+
"disabled": false,
|
14232
|
+
"document": "备注,有长度显示1k",
|
14233
|
+
"example": "test",
|
14234
|
+
"member": "string",
|
14235
|
+
"name": "Remark",
|
14236
|
+
"required": false,
|
14237
|
+
"type": "string"
|
14238
|
+
},
|
14239
|
+
{
|
14240
|
+
"disabled": false,
|
14241
|
+
"document": "批量操作的事件列表",
|
14242
|
+
"example": "[\"api_aaa\",\"api_bbb\"]",
|
14243
|
+
"member": "string",
|
14244
|
+
"name": "EventIdList",
|
14245
|
+
"required": false,
|
14246
|
+
"type": "list"
|
14247
|
+
},
|
14248
|
+
{
|
14249
|
+
"disabled": false,
|
14250
|
+
"document": "批量操作的api列表",
|
14251
|
+
"example": "无",
|
14252
|
+
"member": "ApiSecKey",
|
14253
|
+
"name": "ApiNameList",
|
14254
|
+
"required": false,
|
14255
|
+
"type": "list"
|
14256
|
+
},
|
14257
|
+
{
|
14258
|
+
"disabled": false,
|
14259
|
+
"document": "判断是否删除,包括删除事件和删除资产",
|
14260
|
+
"example": "true或者false",
|
14261
|
+
"member": "bool",
|
14262
|
+
"name": "IsDelete",
|
14263
|
+
"required": false,
|
14264
|
+
"type": "bool"
|
14265
|
+
},
|
14266
|
+
{
|
14267
|
+
"disabled": false,
|
14268
|
+
"document": "判断是否是更新api的备注,更新api备注的时候,为true",
|
14269
|
+
"example": "无",
|
14270
|
+
"member": "bool",
|
14271
|
+
"name": "UpdateApiRemark",
|
14272
|
+
"required": false,
|
14273
|
+
"type": "bool"
|
14274
|
+
}
|
14275
|
+
],
|
14276
|
+
"type": "object"
|
14277
|
+
},
|
14278
|
+
"ModifyApiSecEventChangeResponse": {
|
14279
|
+
"document": "ModifyApiSecEventChange返回参数结构体",
|
14280
|
+
"members": [
|
14281
|
+
{
|
14282
|
+
"document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
|
14283
|
+
"member": "string",
|
14284
|
+
"name": "RequestId",
|
14285
|
+
"type": "string"
|
14286
|
+
}
|
14287
|
+
],
|
14288
|
+
"type": "object"
|
14289
|
+
},
|
14166
14290
|
"ModifyAreaBanStatusRequest": {
|
14167
14291
|
"document": "ModifyAreaBanStatus请求参数结构体",
|
14168
14292
|
"members": [
|
@@ -832,6 +832,14 @@
|
|
832
832
|
"title": "api分析页面开关"
|
833
833
|
}
|
834
834
|
],
|
835
|
+
"ModifyApiSecEventChange": [
|
836
|
+
{
|
837
|
+
"document": "weraza",
|
838
|
+
"input": "POST / HTTP/1.1\nHost: waf.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyApiSecEventChange\n<公共请求参数>\n\n{\n \"UserName\": \"ddp\",\n \"EventIdList\": [\n \"api_test\"\n ],\n \"Remark\": \"test\",\n \"Mode\": \"2\",\n \"ApiNameList\": [\n {\n \"Domain\": \"www.test.com\",\n \"Method\": \"POST\",\n \"ApiName\": \"aaa\"\n }\n ]\n}",
|
839
|
+
"output": "{\n \"Response\": {\n \"RequestId\": \"ac576aa3-4a4c-4a8e-81c0-c650c139d074\"\n }\n}",
|
840
|
+
"title": "test111"
|
841
|
+
}
|
842
|
+
],
|
835
843
|
"ModifyAreaBanStatus": [
|
836
844
|
{
|
837
845
|
"document": "",
|
tccli/services/waf/waf_client.py
CHANGED
@@ -6985,6 +6985,58 @@ def doDescribeDomainRules(args, parsed_globals):
|
|
6985
6985
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
6986
6986
|
|
6987
6987
|
|
6988
|
+
def doModifyApiSecEventChange(args, parsed_globals):
|
6989
|
+
g_param = parse_global_arg(parsed_globals)
|
6990
|
+
|
6991
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
6992
|
+
cred = credential.CVMRoleCredential()
|
6993
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
6994
|
+
cred = credential.STSAssumeRoleCredential(
|
6995
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
6996
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
6997
|
+
)
|
6998
|
+
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):
|
6999
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
7000
|
+
else:
|
7001
|
+
cred = credential.Credential(
|
7002
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
7003
|
+
)
|
7004
|
+
http_profile = HttpProfile(
|
7005
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
7006
|
+
reqMethod="POST",
|
7007
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
7008
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
7009
|
+
)
|
7010
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
7011
|
+
if g_param[OptionsDefine.Language]:
|
7012
|
+
profile.language = g_param[OptionsDefine.Language]
|
7013
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
7014
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
7015
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
7016
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
7017
|
+
model = models.ModifyApiSecEventChangeRequest()
|
7018
|
+
model.from_json_string(json.dumps(args))
|
7019
|
+
start_time = time.time()
|
7020
|
+
while True:
|
7021
|
+
rsp = client.ModifyApiSecEventChange(model)
|
7022
|
+
result = rsp.to_json_string()
|
7023
|
+
try:
|
7024
|
+
json_obj = json.loads(result)
|
7025
|
+
except TypeError as e:
|
7026
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
7027
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
7028
|
+
break
|
7029
|
+
cur_time = time.time()
|
7030
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
7031
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
7032
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
7033
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
7034
|
+
else:
|
7035
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
7036
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
7037
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
7038
|
+
|
7039
|
+
|
6988
7040
|
def doAddDomainWhiteRule(args, parsed_globals):
|
6989
7041
|
g_param = parse_global_arg(parsed_globals)
|
6990
7042
|
|
@@ -7286,6 +7338,7 @@ ACTION_MAP = {
|
|
7286
7338
|
"DescribeUserSignatureRule": doDescribeUserSignatureRule,
|
7287
7339
|
"FreshAntiFakeUrl": doFreshAntiFakeUrl,
|
7288
7340
|
"DescribeDomainRules": doDescribeDomainRules,
|
7341
|
+
"ModifyApiSecEventChange": doModifyApiSecEventChange,
|
7289
7342
|
"AddDomainWhiteRule": doAddDomainWhiteRule,
|
7290
7343
|
"ModifyDomainIpv6Status": doModifyDomainIpv6Status,
|
7291
7344
|
"ModifyUserLevel": doModifyUserLevel,
|
@@ -39856,6 +39856,15 @@
|
|
39856
39856
|
"name": "RequestFromSource",
|
39857
39857
|
"required": false,
|
39858
39858
|
"type": "string"
|
39859
|
+
},
|
39860
|
+
{
|
39861
|
+
"disabled": false,
|
39862
|
+
"document": "项目id",
|
39863
|
+
"example": "无",
|
39864
|
+
"member": "string",
|
39865
|
+
"name": "ProjectId",
|
39866
|
+
"required": false,
|
39867
|
+
"type": "string"
|
39859
39868
|
}
|
39860
39869
|
],
|
39861
39870
|
"type": "object"
|