tccli 3.0.1154.1__py2.py3-none-any.whl → 3.0.1155.1__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- tccli/__init__.py +1 -1
- tccli/services/ccc/v20200210/api.json +1 -1
- tccli/services/cdb/v20170320/api.json +1 -1
- tccli/services/ckafka/ckafka_client.py +65 -12
- tccli/services/ckafka/v20190819/api.json +134 -0
- tccli/services/ckafka/v20190819/examples.json +8 -0
- tccli/services/cvm/cvm_client.py +110 -4
- tccli/services/cvm/v20170312/api.json +95 -0
- tccli/services/cvm/v20170312/examples.json +16 -0
- tccli/services/cynosdb/cynosdb_client.py +110 -4
- tccli/services/cynosdb/v20190107/api.json +192 -0
- tccli/services/cynosdb/v20190107/examples.json +16 -0
- tccli/services/es/v20180416/api.json +36 -0
- tccli/services/ess/v20201111/api.json +10 -10
- tccli/services/essbasic/v20210526/api.json +16 -16
- tccli/services/essbasic/v20210526/examples.json +3 -3
- tccli/services/hunyuan/v20230901/api.json +77 -2
- tccli/services/mna/mna_client.py +322 -4
- tccli/services/mna/v20210119/api.json +435 -0
- tccli/services/mna/v20210119/examples.json +48 -0
- tccli/services/vpc/v20170312/api.json +10 -10
- {tccli-3.0.1154.1.dist-info → tccli-3.0.1155.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1154.1.dist-info → tccli-3.0.1155.1.dist-info}/RECORD +26 -26
- {tccli-3.0.1154.1.dist-info → tccli-3.0.1155.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1154.1.dist-info → tccli-3.0.1155.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1154.1.dist-info → tccli-3.0.1155.1.dist-info}/license_files/LICENSE +0 -0
tccli/services/mna/mna_client.py
CHANGED
@@ -745,6 +745,58 @@ def doCreateQos(args, parsed_globals):
|
|
745
745
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
746
746
|
|
747
747
|
|
748
|
+
def doDeleteL3Conn(args, parsed_globals):
|
749
|
+
g_param = parse_global_arg(parsed_globals)
|
750
|
+
|
751
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
752
|
+
cred = credential.CVMRoleCredential()
|
753
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
754
|
+
cred = credential.STSAssumeRoleCredential(
|
755
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
756
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
757
|
+
)
|
758
|
+
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):
|
759
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
760
|
+
else:
|
761
|
+
cred = credential.Credential(
|
762
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
763
|
+
)
|
764
|
+
http_profile = HttpProfile(
|
765
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
766
|
+
reqMethod="POST",
|
767
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
768
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
769
|
+
)
|
770
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
771
|
+
if g_param[OptionsDefine.Language]:
|
772
|
+
profile.language = g_param[OptionsDefine.Language]
|
773
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
774
|
+
client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
|
775
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
776
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
777
|
+
model = models.DeleteL3ConnRequest()
|
778
|
+
model.from_json_string(json.dumps(args))
|
779
|
+
start_time = time.time()
|
780
|
+
while True:
|
781
|
+
rsp = client.DeleteL3Conn(model)
|
782
|
+
result = rsp.to_json_string()
|
783
|
+
try:
|
784
|
+
json_obj = json.loads(result)
|
785
|
+
except TypeError as e:
|
786
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
787
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
788
|
+
break
|
789
|
+
cur_time = time.time()
|
790
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
791
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
792
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
793
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
794
|
+
else:
|
795
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
796
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
797
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
798
|
+
|
799
|
+
|
748
800
|
def doDeleteGroup(args, parsed_globals):
|
749
801
|
g_param = parse_global_arg(parsed_globals)
|
750
802
|
|
@@ -1109,6 +1161,58 @@ def doGetGroupDetail(args, parsed_globals):
|
|
1109
1161
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1110
1162
|
|
1111
1163
|
|
1164
|
+
def doAddGroup(args, parsed_globals):
|
1165
|
+
g_param = parse_global_arg(parsed_globals)
|
1166
|
+
|
1167
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1168
|
+
cred = credential.CVMRoleCredential()
|
1169
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1170
|
+
cred = credential.STSAssumeRoleCredential(
|
1171
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1172
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1173
|
+
)
|
1174
|
+
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):
|
1175
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1176
|
+
else:
|
1177
|
+
cred = credential.Credential(
|
1178
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1179
|
+
)
|
1180
|
+
http_profile = HttpProfile(
|
1181
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1182
|
+
reqMethod="POST",
|
1183
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
1184
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1185
|
+
)
|
1186
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1187
|
+
if g_param[OptionsDefine.Language]:
|
1188
|
+
profile.language = g_param[OptionsDefine.Language]
|
1189
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1190
|
+
client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
|
1191
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
1192
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1193
|
+
model = models.AddGroupRequest()
|
1194
|
+
model.from_json_string(json.dumps(args))
|
1195
|
+
start_time = time.time()
|
1196
|
+
while True:
|
1197
|
+
rsp = client.AddGroup(model)
|
1198
|
+
result = rsp.to_json_string()
|
1199
|
+
try:
|
1200
|
+
json_obj = json.loads(result)
|
1201
|
+
except TypeError as e:
|
1202
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1203
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1204
|
+
break
|
1205
|
+
cur_time = time.time()
|
1206
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1207
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1208
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1209
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1210
|
+
else:
|
1211
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1212
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1213
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1214
|
+
|
1215
|
+
|
1112
1216
|
def doGetVendorHardware(args, parsed_globals):
|
1113
1217
|
g_param = parse_global_arg(parsed_globals)
|
1114
1218
|
|
@@ -1161,6 +1265,58 @@ def doGetVendorHardware(args, parsed_globals):
|
|
1161
1265
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1162
1266
|
|
1163
1267
|
|
1268
|
+
def doAddL3Conn(args, parsed_globals):
|
1269
|
+
g_param = parse_global_arg(parsed_globals)
|
1270
|
+
|
1271
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1272
|
+
cred = credential.CVMRoleCredential()
|
1273
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1274
|
+
cred = credential.STSAssumeRoleCredential(
|
1275
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1276
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1277
|
+
)
|
1278
|
+
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):
|
1279
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1280
|
+
else:
|
1281
|
+
cred = credential.Credential(
|
1282
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1283
|
+
)
|
1284
|
+
http_profile = HttpProfile(
|
1285
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1286
|
+
reqMethod="POST",
|
1287
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
1288
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1289
|
+
)
|
1290
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1291
|
+
if g_param[OptionsDefine.Language]:
|
1292
|
+
profile.language = g_param[OptionsDefine.Language]
|
1293
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1294
|
+
client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
|
1295
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
1296
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1297
|
+
model = models.AddL3ConnRequest()
|
1298
|
+
model.from_json_string(json.dumps(args))
|
1299
|
+
start_time = time.time()
|
1300
|
+
while True:
|
1301
|
+
rsp = client.AddL3Conn(model)
|
1302
|
+
result = rsp.to_json_string()
|
1303
|
+
try:
|
1304
|
+
json_obj = json.loads(result)
|
1305
|
+
except TypeError as e:
|
1306
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1307
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1308
|
+
break
|
1309
|
+
cur_time = time.time()
|
1310
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1311
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1312
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1313
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1314
|
+
else:
|
1315
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1316
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1317
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1318
|
+
|
1319
|
+
|
1164
1320
|
def doCreateEncryptedKey(args, parsed_globals):
|
1165
1321
|
g_param = parse_global_arg(parsed_globals)
|
1166
1322
|
|
@@ -1525,6 +1681,58 @@ def doGetHardwareList(args, parsed_globals):
|
|
1525
1681
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1526
1682
|
|
1527
1683
|
|
1684
|
+
def doUpdateL3Switch(args, parsed_globals):
|
1685
|
+
g_param = parse_global_arg(parsed_globals)
|
1686
|
+
|
1687
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1688
|
+
cred = credential.CVMRoleCredential()
|
1689
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1690
|
+
cred = credential.STSAssumeRoleCredential(
|
1691
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1692
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1693
|
+
)
|
1694
|
+
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):
|
1695
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1696
|
+
else:
|
1697
|
+
cred = credential.Credential(
|
1698
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1699
|
+
)
|
1700
|
+
http_profile = HttpProfile(
|
1701
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1702
|
+
reqMethod="POST",
|
1703
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
1704
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1705
|
+
)
|
1706
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1707
|
+
if g_param[OptionsDefine.Language]:
|
1708
|
+
profile.language = g_param[OptionsDefine.Language]
|
1709
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1710
|
+
client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
|
1711
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
1712
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1713
|
+
model = models.UpdateL3SwitchRequest()
|
1714
|
+
model.from_json_string(json.dumps(args))
|
1715
|
+
start_time = time.time()
|
1716
|
+
while True:
|
1717
|
+
rsp = client.UpdateL3Switch(model)
|
1718
|
+
result = rsp.to_json_string()
|
1719
|
+
try:
|
1720
|
+
json_obj = json.loads(result)
|
1721
|
+
except TypeError as e:
|
1722
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1723
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1724
|
+
break
|
1725
|
+
cur_time = time.time()
|
1726
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1727
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1728
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1729
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1730
|
+
else:
|
1731
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1732
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1733
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1734
|
+
|
1735
|
+
|
1528
1736
|
def doAddDevice(args, parsed_globals):
|
1529
1737
|
g_param = parse_global_arg(parsed_globals)
|
1530
1738
|
|
@@ -1733,7 +1941,7 @@ def doUpdateGroup(args, parsed_globals):
|
|
1733
1941
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1734
1942
|
|
1735
1943
|
|
1736
|
-
def
|
1944
|
+
def doUpdateL3Cidr(args, parsed_globals):
|
1737
1945
|
g_param = parse_global_arg(parsed_globals)
|
1738
1946
|
|
1739
1947
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -1762,11 +1970,115 @@ def doAddGroup(args, parsed_globals):
|
|
1762
1970
|
client = mod.MnaClient(cred, g_param[OptionsDefine.Region], profile)
|
1763
1971
|
client._sdkVersion += ("_CLI_" + __version__)
|
1764
1972
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1765
|
-
model = models.
|
1973
|
+
model = models.UpdateL3CidrRequest()
|
1766
1974
|
model.from_json_string(json.dumps(args))
|
1767
1975
|
start_time = time.time()
|
1768
1976
|
while True:
|
1769
|
-
rsp = client.
|
1977
|
+
rsp = client.UpdateL3Cidr(model)
|
1978
|
+
result = rsp.to_json_string()
|
1979
|
+
try:
|
1980
|
+
json_obj = json.loads(result)
|
1981
|
+
except TypeError as e:
|
1982
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1983
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1984
|
+
break
|
1985
|
+
cur_time = time.time()
|
1986
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1987
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1988
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1989
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1990
|
+
else:
|
1991
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1992
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1993
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1994
|
+
|
1995
|
+
|
1996
|
+
def doGetL3ConnList(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.MnaClient(cred, g_param[OptionsDefine.Region], profile)
|
2023
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
2024
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
2025
|
+
model = models.GetL3ConnListRequest()
|
2026
|
+
model.from_json_string(json.dumps(args))
|
2027
|
+
start_time = time.time()
|
2028
|
+
while True:
|
2029
|
+
rsp = client.GetL3ConnList(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 doUpdateL3Conn(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.MnaClient(cred, g_param[OptionsDefine.Region], profile)
|
2075
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
2076
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
2077
|
+
model = models.UpdateL3ConnRequest()
|
2078
|
+
model.from_json_string(json.dumps(args))
|
2079
|
+
start_time = time.time()
|
2080
|
+
while True:
|
2081
|
+
rsp = client.UpdateL3Conn(model)
|
1770
2082
|
result = rsp.to_json_string()
|
1771
2083
|
try:
|
1772
2084
|
json_obj = json.loads(result)
|
@@ -1810,6 +2122,7 @@ ACTION_MAP = {
|
|
1810
2122
|
"AddHardware": doAddHardware,
|
1811
2123
|
"GetFlowAlarmInfo": doGetFlowAlarmInfo,
|
1812
2124
|
"CreateQos": doCreateQos,
|
2125
|
+
"DeleteL3Conn": doDeleteL3Conn,
|
1813
2126
|
"DeleteGroup": doDeleteGroup,
|
1814
2127
|
"GetFlowStatisticByRegion": doGetFlowStatisticByRegion,
|
1815
2128
|
"DeleteDevice": doDeleteDevice,
|
@@ -1817,7 +2130,9 @@ ACTION_MAP = {
|
|
1817
2130
|
"GetNetMonitor": doGetNetMonitor,
|
1818
2131
|
"UpdateHardware": doUpdateHardware,
|
1819
2132
|
"GetGroupDetail": doGetGroupDetail,
|
2133
|
+
"AddGroup": doAddGroup,
|
1820
2134
|
"GetVendorHardware": doGetVendorHardware,
|
2135
|
+
"AddL3Conn": doAddL3Conn,
|
1821
2136
|
"CreateEncryptedKey": doCreateEncryptedKey,
|
1822
2137
|
"DeleteQos": doDeleteQos,
|
1823
2138
|
"GetDevice": doGetDevice,
|
@@ -1825,11 +2140,14 @@ ACTION_MAP = {
|
|
1825
2140
|
"OrderFlowPackage": doOrderFlowPackage,
|
1826
2141
|
"GetStatisticData": doGetStatisticData,
|
1827
2142
|
"GetHardwareList": doGetHardwareList,
|
2143
|
+
"UpdateL3Switch": doUpdateL3Switch,
|
1828
2144
|
"AddDevice": doAddDevice,
|
1829
2145
|
"DescribeQos": doDescribeQos,
|
1830
2146
|
"GetGroupList": doGetGroupList,
|
1831
2147
|
"UpdateGroup": doUpdateGroup,
|
1832
|
-
"
|
2148
|
+
"UpdateL3Cidr": doUpdateL3Cidr,
|
2149
|
+
"GetL3ConnList": doGetL3ConnList,
|
2150
|
+
"UpdateL3Conn": doUpdateL3Conn,
|
1833
2151
|
|
1834
2152
|
}
|
1835
2153
|
|