tccli-intl-en 3.0.1255.1__py2.py3-none-any.whl → 3.0.1257.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/ccc/ccc_client.py +305 -40
- tccli/services/ccc/v20200210/api.json +1137 -90
- tccli/services/ccc/v20200210/examples.json +40 -0
- tccli/services/cmq/cmq_client.py +4 -799
- tccli/services/cmq/v20190304/api.json +173 -1367
- tccli/services/cmq/v20190304/examples.json +0 -120
- tccli/services/cvm/cvm_client.py +65 -12
- tccli/services/cvm/v20170312/api.json +52 -0
- tccli/services/cvm/v20170312/examples.json +8 -0
- tccli/services/faceid/v20180301/api.json +18 -0
- tccli/services/waf/v20180125/api.json +1372 -194
- tccli/services/waf/v20180125/examples.json +89 -1
- tccli/services/waf/waf_client.py +632 -49
- {tccli_intl_en-3.0.1255.1.dist-info → tccli_intl_en-3.0.1257.1.dist-info}/METADATA +2 -2
- {tccli_intl_en-3.0.1255.1.dist-info → tccli_intl_en-3.0.1257.1.dist-info}/RECORD +20 -20
- {tccli_intl_en-3.0.1255.1.dist-info → tccli_intl_en-3.0.1257.1.dist-info}/LICENSE +0 -0
- {tccli_intl_en-3.0.1255.1.dist-info → tccli_intl_en-3.0.1257.1.dist-info}/WHEEL +0 -0
- {tccli_intl_en-3.0.1255.1.dist-info → tccli_intl_en-3.0.1257.1.dist-info}/entry_points.txt +0 -0
- {tccli_intl_en-3.0.1255.1.dist-info → tccli_intl_en-3.0.1257.1.dist-info}/top_level.txt +0 -0
tccli/services/waf/waf_client.py
CHANGED
|
@@ -121,7 +121,7 @@ def doDescribeDomainDetailsClb(args, parsed_globals):
|
|
|
121
121
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
122
122
|
|
|
123
123
|
|
|
124
|
-
def
|
|
124
|
+
def doAddAntiInfoLeakRules(args, parsed_globals):
|
|
125
125
|
g_param = parse_global_arg(parsed_globals)
|
|
126
126
|
|
|
127
127
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -150,11 +150,11 @@ def doDescribeDomains(args, parsed_globals):
|
|
|
150
150
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
151
151
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
152
152
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
153
|
-
model = models.
|
|
153
|
+
model = models.AddAntiInfoLeakRulesRequest()
|
|
154
154
|
model.from_json_string(json.dumps(args))
|
|
155
155
|
start_time = time.time()
|
|
156
156
|
while True:
|
|
157
|
-
rsp = client.
|
|
157
|
+
rsp = client.AddAntiInfoLeakRules(model)
|
|
158
158
|
result = rsp.to_json_string()
|
|
159
159
|
try:
|
|
160
160
|
json_obj = json.loads(result)
|
|
@@ -277,7 +277,7 @@ def doGetAttackTotalCount(args, parsed_globals):
|
|
|
277
277
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
278
278
|
|
|
279
279
|
|
|
280
|
-
def
|
|
280
|
+
def doAddCustomWhiteRule(args, parsed_globals):
|
|
281
281
|
g_param = parse_global_arg(parsed_globals)
|
|
282
282
|
|
|
283
283
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -306,11 +306,63 @@ def doDescribeBatchIpAccessControl(args, parsed_globals):
|
|
|
306
306
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
307
307
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
308
308
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
309
|
-
model = models.
|
|
309
|
+
model = models.AddCustomWhiteRuleRequest()
|
|
310
310
|
model.from_json_string(json.dumps(args))
|
|
311
311
|
start_time = time.time()
|
|
312
312
|
while True:
|
|
313
|
-
rsp = client.
|
|
313
|
+
rsp = client.AddCustomWhiteRule(model)
|
|
314
|
+
result = rsp.to_json_string()
|
|
315
|
+
try:
|
|
316
|
+
json_obj = json.loads(result)
|
|
317
|
+
except TypeError as e:
|
|
318
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
319
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
320
|
+
break
|
|
321
|
+
cur_time = time.time()
|
|
322
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
323
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
324
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
325
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
326
|
+
else:
|
|
327
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
328
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
329
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def doDeleteOwaspWhiteRule(args, parsed_globals):
|
|
333
|
+
g_param = parse_global_arg(parsed_globals)
|
|
334
|
+
|
|
335
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
336
|
+
cred = credential.CVMRoleCredential()
|
|
337
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
338
|
+
cred = credential.STSAssumeRoleCredential(
|
|
339
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
340
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
341
|
+
)
|
|
342
|
+
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):
|
|
343
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
344
|
+
else:
|
|
345
|
+
cred = credential.Credential(
|
|
346
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
347
|
+
)
|
|
348
|
+
http_profile = HttpProfile(
|
|
349
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
350
|
+
reqMethod="POST",
|
|
351
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
352
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
353
|
+
)
|
|
354
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
355
|
+
if g_param[OptionsDefine.Language]:
|
|
356
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
357
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
358
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
359
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
360
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
361
|
+
model = models.DeleteOwaspWhiteRuleRequest()
|
|
362
|
+
model.from_json_string(json.dumps(args))
|
|
363
|
+
start_time = time.time()
|
|
364
|
+
while True:
|
|
365
|
+
rsp = client.DeleteOwaspWhiteRule(model)
|
|
314
366
|
result = rsp.to_json_string()
|
|
315
367
|
try:
|
|
316
368
|
json_obj = json.loads(result)
|
|
@@ -641,6 +693,58 @@ def doAddCustomRule(args, parsed_globals):
|
|
|
641
693
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
642
694
|
|
|
643
695
|
|
|
696
|
+
def doDeleteOwaspRuleStatus(args, parsed_globals):
|
|
697
|
+
g_param = parse_global_arg(parsed_globals)
|
|
698
|
+
|
|
699
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
700
|
+
cred = credential.CVMRoleCredential()
|
|
701
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
702
|
+
cred = credential.STSAssumeRoleCredential(
|
|
703
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
704
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
705
|
+
)
|
|
706
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
707
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
708
|
+
else:
|
|
709
|
+
cred = credential.Credential(
|
|
710
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
711
|
+
)
|
|
712
|
+
http_profile = HttpProfile(
|
|
713
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
714
|
+
reqMethod="POST",
|
|
715
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
716
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
717
|
+
)
|
|
718
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
719
|
+
if g_param[OptionsDefine.Language]:
|
|
720
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
721
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
722
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
723
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
724
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
725
|
+
model = models.DeleteOwaspRuleStatusRequest()
|
|
726
|
+
model.from_json_string(json.dumps(args))
|
|
727
|
+
start_time = time.time()
|
|
728
|
+
while True:
|
|
729
|
+
rsp = client.DeleteOwaspRuleStatus(model)
|
|
730
|
+
result = rsp.to_json_string()
|
|
731
|
+
try:
|
|
732
|
+
json_obj = json.loads(result)
|
|
733
|
+
except TypeError as e:
|
|
734
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
735
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
736
|
+
break
|
|
737
|
+
cur_time = time.time()
|
|
738
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
739
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
740
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
741
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
742
|
+
else:
|
|
743
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
744
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
745
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
746
|
+
|
|
747
|
+
|
|
644
748
|
def doDeleteCustomRule(args, parsed_globals):
|
|
645
749
|
g_param = parse_global_arg(parsed_globals)
|
|
646
750
|
|
|
@@ -745,7 +849,7 @@ def doModifyAntiFakeUrl(args, parsed_globals):
|
|
|
745
849
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
746
850
|
|
|
747
851
|
|
|
748
|
-
def
|
|
852
|
+
def doDescribeAntiInfoLeakageRules(args, parsed_globals):
|
|
749
853
|
g_param = parse_global_arg(parsed_globals)
|
|
750
854
|
|
|
751
855
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -774,11 +878,11 @@ def doModifySpartaProtection(args, parsed_globals):
|
|
|
774
878
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
775
879
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
776
880
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
777
|
-
model = models.
|
|
881
|
+
model = models.DescribeAntiInfoLeakageRulesRequest()
|
|
778
882
|
model.from_json_string(json.dumps(args))
|
|
779
883
|
start_time = time.time()
|
|
780
884
|
while True:
|
|
781
|
-
rsp = client.
|
|
885
|
+
rsp = client.DescribeAntiInfoLeakageRules(model)
|
|
782
886
|
result = rsp.to_json_string()
|
|
783
887
|
try:
|
|
784
888
|
json_obj = json.loads(result)
|
|
@@ -901,7 +1005,7 @@ def doDescribeUserDomainInfo(args, parsed_globals):
|
|
|
901
1005
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
902
1006
|
|
|
903
1007
|
|
|
904
|
-
def
|
|
1008
|
+
def doModifyOwaspRuleTypeLevel(args, parsed_globals):
|
|
905
1009
|
g_param = parse_global_arg(parsed_globals)
|
|
906
1010
|
|
|
907
1011
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -930,11 +1034,11 @@ def doDeleteCCRule(args, parsed_globals):
|
|
|
930
1034
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
931
1035
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
932
1036
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
933
|
-
model = models.
|
|
1037
|
+
model = models.ModifyOwaspRuleTypeLevelRequest()
|
|
934
1038
|
model.from_json_string(json.dumps(args))
|
|
935
1039
|
start_time = time.time()
|
|
936
1040
|
while True:
|
|
937
|
-
rsp = client.
|
|
1041
|
+
rsp = client.ModifyOwaspRuleTypeLevel(model)
|
|
938
1042
|
result = rsp.to_json_string()
|
|
939
1043
|
try:
|
|
940
1044
|
json_obj = json.loads(result)
|
|
@@ -953,7 +1057,7 @@ def doDeleteCCRule(args, parsed_globals):
|
|
|
953
1057
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
954
1058
|
|
|
955
1059
|
|
|
956
|
-
def
|
|
1060
|
+
def doModifySpartaProtection(args, parsed_globals):
|
|
957
1061
|
g_param = parse_global_arg(parsed_globals)
|
|
958
1062
|
|
|
959
1063
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -982,11 +1086,63 @@ def doDescribeAntiInfoLeakageRules(args, parsed_globals):
|
|
|
982
1086
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
983
1087
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
984
1088
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
985
|
-
model = models.
|
|
1089
|
+
model = models.ModifySpartaProtectionRequest()
|
|
986
1090
|
model.from_json_string(json.dumps(args))
|
|
987
1091
|
start_time = time.time()
|
|
988
1092
|
while True:
|
|
989
|
-
rsp = client.
|
|
1093
|
+
rsp = client.ModifySpartaProtection(model)
|
|
1094
|
+
result = rsp.to_json_string()
|
|
1095
|
+
try:
|
|
1096
|
+
json_obj = json.loads(result)
|
|
1097
|
+
except TypeError as e:
|
|
1098
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1099
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1100
|
+
break
|
|
1101
|
+
cur_time = time.time()
|
|
1102
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1103
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1104
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1105
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1106
|
+
else:
|
|
1107
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1108
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1109
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
def doDescribeOwaspRuleTypes(args, parsed_globals):
|
|
1113
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1114
|
+
|
|
1115
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1116
|
+
cred = credential.CVMRoleCredential()
|
|
1117
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1118
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1119
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1120
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1121
|
+
)
|
|
1122
|
+
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):
|
|
1123
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1124
|
+
else:
|
|
1125
|
+
cred = credential.Credential(
|
|
1126
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1127
|
+
)
|
|
1128
|
+
http_profile = HttpProfile(
|
|
1129
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1130
|
+
reqMethod="POST",
|
|
1131
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1132
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1133
|
+
)
|
|
1134
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1135
|
+
if g_param[OptionsDefine.Language]:
|
|
1136
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1137
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1138
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1139
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1140
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1141
|
+
model = models.DescribeOwaspRuleTypesRequest()
|
|
1142
|
+
model.from_json_string(json.dumps(args))
|
|
1143
|
+
start_time = time.time()
|
|
1144
|
+
while True:
|
|
1145
|
+
rsp = client.DescribeOwaspRuleTypes(model)
|
|
990
1146
|
result = rsp.to_json_string()
|
|
991
1147
|
try:
|
|
992
1148
|
json_obj = json.loads(result)
|
|
@@ -1161,6 +1317,110 @@ def doDeleteAntiInfoLeakRule(args, parsed_globals):
|
|
|
1161
1317
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1162
1318
|
|
|
1163
1319
|
|
|
1320
|
+
def doCreateOwaspWhiteRule(args, parsed_globals):
|
|
1321
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1322
|
+
|
|
1323
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1324
|
+
cred = credential.CVMRoleCredential()
|
|
1325
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1326
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1327
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1328
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1329
|
+
)
|
|
1330
|
+
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):
|
|
1331
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1332
|
+
else:
|
|
1333
|
+
cred = credential.Credential(
|
|
1334
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1335
|
+
)
|
|
1336
|
+
http_profile = HttpProfile(
|
|
1337
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1338
|
+
reqMethod="POST",
|
|
1339
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1340
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1341
|
+
)
|
|
1342
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1343
|
+
if g_param[OptionsDefine.Language]:
|
|
1344
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1345
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1346
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1347
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1348
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1349
|
+
model = models.CreateOwaspWhiteRuleRequest()
|
|
1350
|
+
model.from_json_string(json.dumps(args))
|
|
1351
|
+
start_time = time.time()
|
|
1352
|
+
while True:
|
|
1353
|
+
rsp = client.CreateOwaspWhiteRule(model)
|
|
1354
|
+
result = rsp.to_json_string()
|
|
1355
|
+
try:
|
|
1356
|
+
json_obj = json.loads(result)
|
|
1357
|
+
except TypeError as e:
|
|
1358
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1359
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1360
|
+
break
|
|
1361
|
+
cur_time = time.time()
|
|
1362
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1363
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1364
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1365
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1366
|
+
else:
|
|
1367
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1368
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1369
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
def doModifyOwaspRuleStatus(args, parsed_globals):
|
|
1373
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1374
|
+
|
|
1375
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
1376
|
+
cred = credential.CVMRoleCredential()
|
|
1377
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
1378
|
+
cred = credential.STSAssumeRoleCredential(
|
|
1379
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
1380
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
1381
|
+
)
|
|
1382
|
+
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):
|
|
1383
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
1384
|
+
else:
|
|
1385
|
+
cred = credential.Credential(
|
|
1386
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
1387
|
+
)
|
|
1388
|
+
http_profile = HttpProfile(
|
|
1389
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
1390
|
+
reqMethod="POST",
|
|
1391
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
1392
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
1393
|
+
)
|
|
1394
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
1395
|
+
if g_param[OptionsDefine.Language]:
|
|
1396
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
1397
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
1398
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1399
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
1400
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1401
|
+
model = models.ModifyOwaspRuleStatusRequest()
|
|
1402
|
+
model.from_json_string(json.dumps(args))
|
|
1403
|
+
start_time = time.time()
|
|
1404
|
+
while True:
|
|
1405
|
+
rsp = client.ModifyOwaspRuleStatus(model)
|
|
1406
|
+
result = rsp.to_json_string()
|
|
1407
|
+
try:
|
|
1408
|
+
json_obj = json.loads(result)
|
|
1409
|
+
except TypeError as e:
|
|
1410
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
1411
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
1412
|
+
break
|
|
1413
|
+
cur_time = time.time()
|
|
1414
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
1415
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
1416
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
1417
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
1418
|
+
else:
|
|
1419
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
1420
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
1421
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1422
|
+
|
|
1423
|
+
|
|
1164
1424
|
def doCreateDeals(args, parsed_globals):
|
|
1165
1425
|
g_param = parse_global_arg(parsed_globals)
|
|
1166
1426
|
|
|
@@ -1265,7 +1525,7 @@ def doDescribeRuleLimit(args, parsed_globals):
|
|
|
1265
1525
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1266
1526
|
|
|
1267
1527
|
|
|
1268
|
-
def
|
|
1528
|
+
def doDescribeDomains(args, parsed_globals):
|
|
1269
1529
|
g_param = parse_global_arg(parsed_globals)
|
|
1270
1530
|
|
|
1271
1531
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1294,11 +1554,11 @@ def doAddAntiInfoLeakRules(args, parsed_globals):
|
|
|
1294
1554
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1295
1555
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1296
1556
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1297
|
-
model = models.
|
|
1557
|
+
model = models.DescribeDomainsRequest()
|
|
1298
1558
|
model.from_json_string(json.dumps(args))
|
|
1299
1559
|
start_time = time.time()
|
|
1300
1560
|
while True:
|
|
1301
|
-
rsp = client.
|
|
1561
|
+
rsp = client.DescribeDomains(model)
|
|
1302
1562
|
result = rsp.to_json_string()
|
|
1303
1563
|
try:
|
|
1304
1564
|
json_obj = json.loads(result)
|
|
@@ -1733,7 +1993,111 @@ def doDescribeCertificateVerifyResult(args, parsed_globals):
|
|
|
1733
1993
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1734
1994
|
|
|
1735
1995
|
|
|
1736
|
-
def doDeleteIpAccessControlV2(args, parsed_globals):
|
|
1996
|
+
def doDeleteIpAccessControlV2(args, parsed_globals):
|
|
1997
|
+
g_param = parse_global_arg(parsed_globals)
|
|
1998
|
+
|
|
1999
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2000
|
+
cred = credential.CVMRoleCredential()
|
|
2001
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2002
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2003
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2004
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2005
|
+
)
|
|
2006
|
+
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):
|
|
2007
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2008
|
+
else:
|
|
2009
|
+
cred = credential.Credential(
|
|
2010
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2011
|
+
)
|
|
2012
|
+
http_profile = HttpProfile(
|
|
2013
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2014
|
+
reqMethod="POST",
|
|
2015
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2016
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2017
|
+
)
|
|
2018
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2019
|
+
if g_param[OptionsDefine.Language]:
|
|
2020
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2021
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2022
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2023
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2024
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2025
|
+
model = models.DeleteIpAccessControlV2Request()
|
|
2026
|
+
model.from_json_string(json.dumps(args))
|
|
2027
|
+
start_time = time.time()
|
|
2028
|
+
while True:
|
|
2029
|
+
rsp = client.DeleteIpAccessControlV2(model)
|
|
2030
|
+
result = rsp.to_json_string()
|
|
2031
|
+
try:
|
|
2032
|
+
json_obj = json.loads(result)
|
|
2033
|
+
except TypeError as e:
|
|
2034
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2035
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2036
|
+
break
|
|
2037
|
+
cur_time = time.time()
|
|
2038
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2039
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2040
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2041
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2042
|
+
else:
|
|
2043
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2044
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2045
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2046
|
+
|
|
2047
|
+
|
|
2048
|
+
def doSwitchElasticMode(args, parsed_globals):
|
|
2049
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2050
|
+
|
|
2051
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2052
|
+
cred = credential.CVMRoleCredential()
|
|
2053
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2054
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2055
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2056
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2057
|
+
)
|
|
2058
|
+
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):
|
|
2059
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2060
|
+
else:
|
|
2061
|
+
cred = credential.Credential(
|
|
2062
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2063
|
+
)
|
|
2064
|
+
http_profile = HttpProfile(
|
|
2065
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2066
|
+
reqMethod="POST",
|
|
2067
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2068
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2069
|
+
)
|
|
2070
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2071
|
+
if g_param[OptionsDefine.Language]:
|
|
2072
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2073
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2074
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2075
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2076
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2077
|
+
model = models.SwitchElasticModeRequest()
|
|
2078
|
+
model.from_json_string(json.dumps(args))
|
|
2079
|
+
start_time = time.time()
|
|
2080
|
+
while True:
|
|
2081
|
+
rsp = client.SwitchElasticMode(model)
|
|
2082
|
+
result = rsp.to_json_string()
|
|
2083
|
+
try:
|
|
2084
|
+
json_obj = json.loads(result)
|
|
2085
|
+
except TypeError as e:
|
|
2086
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2087
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2088
|
+
break
|
|
2089
|
+
cur_time = time.time()
|
|
2090
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2091
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2092
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2093
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2094
|
+
else:
|
|
2095
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2096
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2097
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2098
|
+
|
|
2099
|
+
|
|
2100
|
+
def doModifyInstanceRenewFlag(args, parsed_globals):
|
|
1737
2101
|
g_param = parse_global_arg(parsed_globals)
|
|
1738
2102
|
|
|
1739
2103
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1762,11 +2126,11 @@ def doDeleteIpAccessControlV2(args, parsed_globals):
|
|
|
1762
2126
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1763
2127
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1764
2128
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1765
|
-
model = models.
|
|
2129
|
+
model = models.ModifyInstanceRenewFlagRequest()
|
|
1766
2130
|
model.from_json_string(json.dumps(args))
|
|
1767
2131
|
start_time = time.time()
|
|
1768
2132
|
while True:
|
|
1769
|
-
rsp = client.
|
|
2133
|
+
rsp = client.ModifyInstanceRenewFlag(model)
|
|
1770
2134
|
result = rsp.to_json_string()
|
|
1771
2135
|
try:
|
|
1772
2136
|
json_obj = json.loads(result)
|
|
@@ -1785,7 +2149,7 @@ def doDeleteIpAccessControlV2(args, parsed_globals):
|
|
|
1785
2149
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1786
2150
|
|
|
1787
2151
|
|
|
1788
|
-
def
|
|
2152
|
+
def doDescribeUserLevel(args, parsed_globals):
|
|
1789
2153
|
g_param = parse_global_arg(parsed_globals)
|
|
1790
2154
|
|
|
1791
2155
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1814,11 +2178,11 @@ def doSwitchElasticMode(args, parsed_globals):
|
|
|
1814
2178
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1815
2179
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1816
2180
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1817
|
-
model = models.
|
|
2181
|
+
model = models.DescribeUserLevelRequest()
|
|
1818
2182
|
model.from_json_string(json.dumps(args))
|
|
1819
2183
|
start_time = time.time()
|
|
1820
2184
|
while True:
|
|
1821
|
-
rsp = client.
|
|
2185
|
+
rsp = client.DescribeUserLevel(model)
|
|
1822
2186
|
result = rsp.to_json_string()
|
|
1823
2187
|
try:
|
|
1824
2188
|
json_obj = json.loads(result)
|
|
@@ -1837,7 +2201,7 @@ def doSwitchElasticMode(args, parsed_globals):
|
|
|
1837
2201
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1838
2202
|
|
|
1839
2203
|
|
|
1840
|
-
def
|
|
2204
|
+
def doDescribeCCRule(args, parsed_globals):
|
|
1841
2205
|
g_param = parse_global_arg(parsed_globals)
|
|
1842
2206
|
|
|
1843
2207
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1866,11 +2230,11 @@ def doModifyInstanceRenewFlag(args, parsed_globals):
|
|
|
1866
2230
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1867
2231
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1868
2232
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1869
|
-
model = models.
|
|
2233
|
+
model = models.DescribeCCRuleRequest()
|
|
1870
2234
|
model.from_json_string(json.dumps(args))
|
|
1871
2235
|
start_time = time.time()
|
|
1872
2236
|
while True:
|
|
1873
|
-
rsp = client.
|
|
2237
|
+
rsp = client.DescribeCCRule(model)
|
|
1874
2238
|
result = rsp.to_json_string()
|
|
1875
2239
|
try:
|
|
1876
2240
|
json_obj = json.loads(result)
|
|
@@ -1889,7 +2253,7 @@ def doModifyInstanceRenewFlag(args, parsed_globals):
|
|
|
1889
2253
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1890
2254
|
|
|
1891
2255
|
|
|
1892
|
-
def
|
|
2256
|
+
def doModifyOwaspRuleTypeAction(args, parsed_globals):
|
|
1893
2257
|
g_param = parse_global_arg(parsed_globals)
|
|
1894
2258
|
|
|
1895
2259
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1918,11 +2282,11 @@ def doDescribeUserLevel(args, parsed_globals):
|
|
|
1918
2282
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1919
2283
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1920
2284
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1921
|
-
model = models.
|
|
2285
|
+
model = models.ModifyOwaspRuleTypeActionRequest()
|
|
1922
2286
|
model.from_json_string(json.dumps(args))
|
|
1923
2287
|
start_time = time.time()
|
|
1924
2288
|
while True:
|
|
1925
|
-
rsp = client.
|
|
2289
|
+
rsp = client.ModifyOwaspRuleTypeAction(model)
|
|
1926
2290
|
result = rsp.to_json_string()
|
|
1927
2291
|
try:
|
|
1928
2292
|
json_obj = json.loads(result)
|
|
@@ -1941,7 +2305,7 @@ def doDescribeUserLevel(args, parsed_globals):
|
|
|
1941
2305
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1942
2306
|
|
|
1943
2307
|
|
|
1944
|
-
def
|
|
2308
|
+
def doDescribeCustomRuleList(args, parsed_globals):
|
|
1945
2309
|
g_param = parse_global_arg(parsed_globals)
|
|
1946
2310
|
|
|
1947
2311
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -1970,11 +2334,11 @@ def doDescribeCCRule(args, parsed_globals):
|
|
|
1970
2334
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
1971
2335
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
1972
2336
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
1973
|
-
model = models.
|
|
2337
|
+
model = models.DescribeCustomRuleListRequest()
|
|
1974
2338
|
model.from_json_string(json.dumps(args))
|
|
1975
2339
|
start_time = time.time()
|
|
1976
2340
|
while True:
|
|
1977
|
-
rsp = client.
|
|
2341
|
+
rsp = client.DescribeCustomRuleList(model)
|
|
1978
2342
|
result = rsp.to_json_string()
|
|
1979
2343
|
try:
|
|
1980
2344
|
json_obj = json.loads(result)
|
|
@@ -1993,7 +2357,7 @@ def doDescribeCCRule(args, parsed_globals):
|
|
|
1993
2357
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
1994
2358
|
|
|
1995
2359
|
|
|
1996
|
-
def
|
|
2360
|
+
def doDescribeAttackOverview(args, parsed_globals):
|
|
1997
2361
|
g_param = parse_global_arg(parsed_globals)
|
|
1998
2362
|
|
|
1999
2363
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -2022,11 +2386,11 @@ def doDescribeCustomRuleList(args, parsed_globals):
|
|
|
2022
2386
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2023
2387
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
2024
2388
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2025
|
-
model = models.
|
|
2389
|
+
model = models.DescribeAttackOverviewRequest()
|
|
2026
2390
|
model.from_json_string(json.dumps(args))
|
|
2027
2391
|
start_time = time.time()
|
|
2028
2392
|
while True:
|
|
2029
|
-
rsp = client.
|
|
2393
|
+
rsp = client.DescribeAttackOverview(model)
|
|
2030
2394
|
result = rsp.to_json_string()
|
|
2031
2395
|
try:
|
|
2032
2396
|
json_obj = json.loads(result)
|
|
@@ -2045,7 +2409,7 @@ def doDescribeCustomRuleList(args, parsed_globals):
|
|
|
2045
2409
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2046
2410
|
|
|
2047
2411
|
|
|
2048
|
-
def
|
|
2412
|
+
def doModifyOwaspWhiteRule(args, parsed_globals):
|
|
2049
2413
|
g_param = parse_global_arg(parsed_globals)
|
|
2050
2414
|
|
|
2051
2415
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -2074,11 +2438,11 @@ def doDescribeAttackOverview(args, parsed_globals):
|
|
|
2074
2438
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2075
2439
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
2076
2440
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2077
|
-
model = models.
|
|
2441
|
+
model = models.ModifyOwaspWhiteRuleRequest()
|
|
2078
2442
|
model.from_json_string(json.dumps(args))
|
|
2079
2443
|
start_time = time.time()
|
|
2080
2444
|
while True:
|
|
2081
|
-
rsp = client.
|
|
2445
|
+
rsp = client.ModifyOwaspWhiteRule(model)
|
|
2082
2446
|
result = rsp.to_json_string()
|
|
2083
2447
|
try:
|
|
2084
2448
|
json_obj = json.loads(result)
|
|
@@ -2565,6 +2929,58 @@ def doDescribeCiphersDetail(args, parsed_globals):
|
|
|
2565
2929
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2566
2930
|
|
|
2567
2931
|
|
|
2932
|
+
def doDescribeOwaspWhiteRules(args, parsed_globals):
|
|
2933
|
+
g_param = parse_global_arg(parsed_globals)
|
|
2934
|
+
|
|
2935
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
2936
|
+
cred = credential.CVMRoleCredential()
|
|
2937
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
2938
|
+
cred = credential.STSAssumeRoleCredential(
|
|
2939
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
2940
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
2941
|
+
)
|
|
2942
|
+
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):
|
|
2943
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
2944
|
+
else:
|
|
2945
|
+
cred = credential.Credential(
|
|
2946
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
2947
|
+
)
|
|
2948
|
+
http_profile = HttpProfile(
|
|
2949
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
2950
|
+
reqMethod="POST",
|
|
2951
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
2952
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
2953
|
+
)
|
|
2954
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
2955
|
+
if g_param[OptionsDefine.Language]:
|
|
2956
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
2957
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
2958
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
2959
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
2960
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
2961
|
+
model = models.DescribeOwaspWhiteRulesRequest()
|
|
2962
|
+
model.from_json_string(json.dumps(args))
|
|
2963
|
+
start_time = time.time()
|
|
2964
|
+
while True:
|
|
2965
|
+
rsp = client.DescribeOwaspWhiteRules(model)
|
|
2966
|
+
result = rsp.to_json_string()
|
|
2967
|
+
try:
|
|
2968
|
+
json_obj = json.loads(result)
|
|
2969
|
+
except TypeError as e:
|
|
2970
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
2971
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
2972
|
+
break
|
|
2973
|
+
cur_time = time.time()
|
|
2974
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
2975
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
2976
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
2977
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
2978
|
+
else:
|
|
2979
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
2980
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
2981
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
2982
|
+
|
|
2983
|
+
|
|
2568
2984
|
def doModifyIpAccessControl(args, parsed_globals):
|
|
2569
2985
|
g_param = parse_global_arg(parsed_globals)
|
|
2570
2986
|
|
|
@@ -3293,7 +3709,7 @@ def doDeleteSpartaProtection(args, parsed_globals):
|
|
|
3293
3709
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
3294
3710
|
|
|
3295
3711
|
|
|
3296
|
-
def
|
|
3712
|
+
def doDescribeBatchIpAccessControl(args, parsed_globals):
|
|
3297
3713
|
g_param = parse_global_arg(parsed_globals)
|
|
3298
3714
|
|
|
3299
3715
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
@@ -3322,11 +3738,63 @@ def doAddCustomWhiteRule(args, parsed_globals):
|
|
|
3322
3738
|
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
3323
3739
|
client._sdkVersion += ("_CLI_" + __version__)
|
|
3324
3740
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
3325
|
-
model = models.
|
|
3741
|
+
model = models.DescribeBatchIpAccessControlRequest()
|
|
3326
3742
|
model.from_json_string(json.dumps(args))
|
|
3327
3743
|
start_time = time.time()
|
|
3328
3744
|
while True:
|
|
3329
|
-
rsp = client.
|
|
3745
|
+
rsp = client.DescribeBatchIpAccessControl(model)
|
|
3746
|
+
result = rsp.to_json_string()
|
|
3747
|
+
try:
|
|
3748
|
+
json_obj = json.loads(result)
|
|
3749
|
+
except TypeError as e:
|
|
3750
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
3751
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
3752
|
+
break
|
|
3753
|
+
cur_time = time.time()
|
|
3754
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
3755
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
3756
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
3757
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
3758
|
+
else:
|
|
3759
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
3760
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
3761
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
3762
|
+
|
|
3763
|
+
|
|
3764
|
+
def doDescribeOwaspRules(args, parsed_globals):
|
|
3765
|
+
g_param = parse_global_arg(parsed_globals)
|
|
3766
|
+
|
|
3767
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
3768
|
+
cred = credential.CVMRoleCredential()
|
|
3769
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
3770
|
+
cred = credential.STSAssumeRoleCredential(
|
|
3771
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
3772
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
3773
|
+
)
|
|
3774
|
+
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):
|
|
3775
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
3776
|
+
else:
|
|
3777
|
+
cred = credential.Credential(
|
|
3778
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
3779
|
+
)
|
|
3780
|
+
http_profile = HttpProfile(
|
|
3781
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
3782
|
+
reqMethod="POST",
|
|
3783
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
3784
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
3785
|
+
)
|
|
3786
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
3787
|
+
if g_param[OptionsDefine.Language]:
|
|
3788
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
3789
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
3790
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
3791
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
3792
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
3793
|
+
model = models.DescribeOwaspRulesRequest()
|
|
3794
|
+
model.from_json_string(json.dumps(args))
|
|
3795
|
+
start_time = time.time()
|
|
3796
|
+
while True:
|
|
3797
|
+
rsp = client.DescribeOwaspRules(model)
|
|
3330
3798
|
result = rsp.to_json_string()
|
|
3331
3799
|
try:
|
|
3332
3800
|
json_obj = json.loads(result)
|
|
@@ -4021,6 +4489,58 @@ def doDescribeInstances(args, parsed_globals):
|
|
|
4021
4489
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
4022
4490
|
|
|
4023
4491
|
|
|
4492
|
+
def doModifyOwaspRuleTypeStatus(args, parsed_globals):
|
|
4493
|
+
g_param = parse_global_arg(parsed_globals)
|
|
4494
|
+
|
|
4495
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
4496
|
+
cred = credential.CVMRoleCredential()
|
|
4497
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
4498
|
+
cred = credential.STSAssumeRoleCredential(
|
|
4499
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
4500
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
4501
|
+
)
|
|
4502
|
+
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):
|
|
4503
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
4504
|
+
else:
|
|
4505
|
+
cred = credential.Credential(
|
|
4506
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
4507
|
+
)
|
|
4508
|
+
http_profile = HttpProfile(
|
|
4509
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
4510
|
+
reqMethod="POST",
|
|
4511
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
4512
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
4513
|
+
)
|
|
4514
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
4515
|
+
if g_param[OptionsDefine.Language]:
|
|
4516
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
4517
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
4518
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
4519
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
4520
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
4521
|
+
model = models.ModifyOwaspRuleTypeStatusRequest()
|
|
4522
|
+
model.from_json_string(json.dumps(args))
|
|
4523
|
+
start_time = time.time()
|
|
4524
|
+
while True:
|
|
4525
|
+
rsp = client.ModifyOwaspRuleTypeStatus(model)
|
|
4526
|
+
result = rsp.to_json_string()
|
|
4527
|
+
try:
|
|
4528
|
+
json_obj = json.loads(result)
|
|
4529
|
+
except TypeError as e:
|
|
4530
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
4531
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
4532
|
+
break
|
|
4533
|
+
cur_time = time.time()
|
|
4534
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
4535
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
4536
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
4537
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
4538
|
+
else:
|
|
4539
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
4540
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
4541
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
4542
|
+
|
|
4543
|
+
|
|
4024
4544
|
def doModifyUserSignatureRule(args, parsed_globals):
|
|
4025
4545
|
g_param = parse_global_arg(parsed_globals)
|
|
4026
4546
|
|
|
@@ -4749,6 +5269,58 @@ def doDescribeCCRuleList(args, parsed_globals):
|
|
|
4749
5269
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
4750
5270
|
|
|
4751
5271
|
|
|
5272
|
+
def doDeleteCCRule(args, parsed_globals):
|
|
5273
|
+
g_param = parse_global_arg(parsed_globals)
|
|
5274
|
+
|
|
5275
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
5276
|
+
cred = credential.CVMRoleCredential()
|
|
5277
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
5278
|
+
cred = credential.STSAssumeRoleCredential(
|
|
5279
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
5280
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
5281
|
+
)
|
|
5282
|
+
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):
|
|
5283
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
5284
|
+
else:
|
|
5285
|
+
cred = credential.Credential(
|
|
5286
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
5287
|
+
)
|
|
5288
|
+
http_profile = HttpProfile(
|
|
5289
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
5290
|
+
reqMethod="POST",
|
|
5291
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
5292
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
5293
|
+
)
|
|
5294
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
|
5295
|
+
if g_param[OptionsDefine.Language]:
|
|
5296
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
5297
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
5298
|
+
client = mod.WafClient(cred, g_param[OptionsDefine.Region], profile)
|
|
5299
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
5300
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
5301
|
+
model = models.DeleteCCRuleRequest()
|
|
5302
|
+
model.from_json_string(json.dumps(args))
|
|
5303
|
+
start_time = time.time()
|
|
5304
|
+
while True:
|
|
5305
|
+
rsp = client.DeleteCCRule(model)
|
|
5306
|
+
result = rsp.to_json_string()
|
|
5307
|
+
try:
|
|
5308
|
+
json_obj = json.loads(result)
|
|
5309
|
+
except TypeError as e:
|
|
5310
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
5311
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
5312
|
+
break
|
|
5313
|
+
cur_time = time.time()
|
|
5314
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
5315
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
5316
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
5317
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
5318
|
+
else:
|
|
5319
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
5320
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
5321
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
5322
|
+
|
|
5323
|
+
|
|
4752
5324
|
def doModifyWebshellStatus(args, parsed_globals):
|
|
4753
5325
|
g_param = parse_global_arg(parsed_globals)
|
|
4754
5326
|
|
|
@@ -5022,29 +5594,34 @@ MODELS_MAP = {
|
|
|
5022
5594
|
ACTION_MAP = {
|
|
5023
5595
|
"DescribeAttackType": doDescribeAttackType,
|
|
5024
5596
|
"DescribeDomainDetailsClb": doDescribeDomainDetailsClb,
|
|
5025
|
-
"
|
|
5597
|
+
"AddAntiInfoLeakRules": doAddAntiInfoLeakRules,
|
|
5026
5598
|
"GetAttackHistogram": doGetAttackHistogram,
|
|
5027
5599
|
"GetAttackTotalCount": doGetAttackTotalCount,
|
|
5028
|
-
"
|
|
5600
|
+
"AddCustomWhiteRule": doAddCustomWhiteRule,
|
|
5601
|
+
"DeleteOwaspWhiteRule": doDeleteOwaspWhiteRule,
|
|
5029
5602
|
"ModifyCustomRule": doModifyCustomRule,
|
|
5030
5603
|
"DescribeFindDomainList": doDescribeFindDomainList,
|
|
5031
5604
|
"ModifyInstanceQpsLimit": doModifyInstanceQpsLimit,
|
|
5032
5605
|
"DescribeSpartaProtectionInfo": doDescribeSpartaProtectionInfo,
|
|
5033
5606
|
"DeleteCustomWhiteRule": doDeleteCustomWhiteRule,
|
|
5034
5607
|
"AddCustomRule": doAddCustomRule,
|
|
5608
|
+
"DeleteOwaspRuleStatus": doDeleteOwaspRuleStatus,
|
|
5035
5609
|
"DeleteCustomRule": doDeleteCustomRule,
|
|
5036
5610
|
"ModifyAntiFakeUrl": doModifyAntiFakeUrl,
|
|
5037
|
-
"
|
|
5611
|
+
"DescribeAntiInfoLeakageRules": doDescribeAntiInfoLeakageRules,
|
|
5038
5612
|
"ModifyInstanceElasticMode": doModifyInstanceElasticMode,
|
|
5039
5613
|
"DescribeUserDomainInfo": doDescribeUserDomainInfo,
|
|
5040
|
-
"
|
|
5041
|
-
"
|
|
5614
|
+
"ModifyOwaspRuleTypeLevel": doModifyOwaspRuleTypeLevel,
|
|
5615
|
+
"ModifySpartaProtection": doModifySpartaProtection,
|
|
5616
|
+
"DescribeOwaspRuleTypes": doDescribeOwaspRuleTypes,
|
|
5042
5617
|
"DescribeHistogram": doDescribeHistogram,
|
|
5043
5618
|
"DescribeWebshellStatus": doDescribeWebshellStatus,
|
|
5044
5619
|
"DeleteAntiInfoLeakRule": doDeleteAntiInfoLeakRule,
|
|
5620
|
+
"CreateOwaspWhiteRule": doCreateOwaspWhiteRule,
|
|
5621
|
+
"ModifyOwaspRuleStatus": doModifyOwaspRuleStatus,
|
|
5045
5622
|
"CreateDeals": doCreateDeals,
|
|
5046
5623
|
"DescribeRuleLimit": doDescribeRuleLimit,
|
|
5047
|
-
"
|
|
5624
|
+
"DescribeDomains": doDescribeDomains,
|
|
5048
5625
|
"ModifyHostStatus": doModifyHostStatus,
|
|
5049
5626
|
"DescribeModuleStatus": doDescribeModuleStatus,
|
|
5050
5627
|
"ModifyAntiFakeUrlStatus": doModifyAntiFakeUrlStatus,
|
|
@@ -5058,8 +5635,10 @@ ACTION_MAP = {
|
|
|
5058
5635
|
"ModifyInstanceRenewFlag": doModifyInstanceRenewFlag,
|
|
5059
5636
|
"DescribeUserLevel": doDescribeUserLevel,
|
|
5060
5637
|
"DescribeCCRule": doDescribeCCRule,
|
|
5638
|
+
"ModifyOwaspRuleTypeAction": doModifyOwaspRuleTypeAction,
|
|
5061
5639
|
"DescribeCustomRuleList": doDescribeCustomRuleList,
|
|
5062
5640
|
"DescribeAttackOverview": doDescribeAttackOverview,
|
|
5641
|
+
"ModifyOwaspWhiteRule": doModifyOwaspWhiteRule,
|
|
5063
5642
|
"DescribeHosts": doDescribeHosts,
|
|
5064
5643
|
"AddSpartaProtection": doAddSpartaProtection,
|
|
5065
5644
|
"DescribePolicyStatus": doDescribePolicyStatus,
|
|
@@ -5069,6 +5648,7 @@ ACTION_MAP = {
|
|
|
5069
5648
|
"DescribeTlsVersion": doDescribeTlsVersion,
|
|
5070
5649
|
"ModifyProtectionStatus": doModifyProtectionStatus,
|
|
5071
5650
|
"DescribeCiphersDetail": doDescribeCiphersDetail,
|
|
5651
|
+
"DescribeOwaspWhiteRules": doDescribeOwaspWhiteRules,
|
|
5072
5652
|
"ModifyIpAccessControl": doModifyIpAccessControl,
|
|
5073
5653
|
"DescribeAntiFakeRules": doDescribeAntiFakeRules,
|
|
5074
5654
|
"ImportIpAccessControl": doImportIpAccessControl,
|
|
@@ -5083,7 +5663,8 @@ ACTION_MAP = {
|
|
|
5083
5663
|
"DescribeIpAccessControl": doDescribeIpAccessControl,
|
|
5084
5664
|
"DescribeDomainCountInfo": doDescribeDomainCountInfo,
|
|
5085
5665
|
"DeleteSpartaProtection": doDeleteSpartaProtection,
|
|
5086
|
-
"
|
|
5666
|
+
"DescribeBatchIpAccessControl": doDescribeBatchIpAccessControl,
|
|
5667
|
+
"DescribeOwaspRules": doDescribeOwaspRules,
|
|
5087
5668
|
"DeleteSession": doDeleteSession,
|
|
5088
5669
|
"GenerateDealsAndPayNew": doGenerateDealsAndPayNew,
|
|
5089
5670
|
"CreateHost": doCreateHost,
|
|
@@ -5097,6 +5678,7 @@ ACTION_MAP = {
|
|
|
5097
5678
|
"DescribeDomainVerifyResult": doDescribeDomainVerifyResult,
|
|
5098
5679
|
"SearchAttackLog": doSearchAttackLog,
|
|
5099
5680
|
"DescribeInstances": doDescribeInstances,
|
|
5681
|
+
"ModifyOwaspRuleTypeStatus": doModifyOwaspRuleTypeStatus,
|
|
5100
5682
|
"ModifyUserSignatureRule": doModifyUserSignatureRule,
|
|
5101
5683
|
"ModifyHostFlowMode": doModifyHostFlowMode,
|
|
5102
5684
|
"ModifyInstanceName": doModifyInstanceName,
|
|
@@ -5111,6 +5693,7 @@ ACTION_MAP = {
|
|
|
5111
5693
|
"ModifyObject": doModifyObject,
|
|
5112
5694
|
"DeleteAntiFakeUrl": doDeleteAntiFakeUrl,
|
|
5113
5695
|
"DescribeCCRuleList": doDescribeCCRuleList,
|
|
5696
|
+
"DeleteCCRule": doDeleteCCRule,
|
|
5114
5697
|
"ModifyWebshellStatus": doModifyWebshellStatus,
|
|
5115
5698
|
"UpsertSession": doUpsertSession,
|
|
5116
5699
|
"FreshAntiFakeUrl": doFreshAntiFakeUrl,
|