tccli-intl-en 3.1.16.1__py2.py3-none-any.whl → 3.1.18.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.
@@ -237,7 +237,7 @@ def doDescribeAllScenes(args, parsed_globals):
237
237
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
238
238
 
239
239
 
240
- def doDescribeDiskDiscount(args, parsed_globals):
240
+ def doCancelShareBlueprintAcrossAccounts(args, parsed_globals):
241
241
  g_param = parse_global_arg(parsed_globals)
242
242
 
243
243
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -269,11 +269,11 @@ def doDescribeDiskDiscount(args, parsed_globals):
269
269
  client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
270
270
  client._sdkVersion += ("_CLI_" + __version__)
271
271
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
272
- model = models.DescribeDiskDiscountRequest()
272
+ model = models.CancelShareBlueprintAcrossAccountsRequest()
273
273
  model.from_json_string(json.dumps(args))
274
274
  start_time = time.time()
275
275
  while True:
276
- rsp = client.DescribeDiskDiscount(model)
276
+ rsp = client.CancelShareBlueprintAcrossAccounts(model)
277
277
  result = rsp.to_json_string()
278
278
  try:
279
279
  json_obj = json.loads(result)
@@ -1007,6 +1007,61 @@ def doImportKeyPair(args, parsed_globals):
1007
1007
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1008
1008
 
1009
1009
 
1010
+ def doDescribeImagesToShare(args, parsed_globals):
1011
+ g_param = parse_global_arg(parsed_globals)
1012
+
1013
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1014
+ cred = credential.CVMRoleCredential()
1015
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1016
+ cred = credential.STSAssumeRoleCredential(
1017
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1018
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1019
+ )
1020
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
1021
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
1022
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
1023
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
1024
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1025
+ else:
1026
+ cred = credential.Credential(
1027
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1028
+ )
1029
+ http_profile = HttpProfile(
1030
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1031
+ reqMethod="POST",
1032
+ endpoint=g_param[OptionsDefine.Endpoint],
1033
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1034
+ )
1035
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
1036
+ if g_param[OptionsDefine.Language]:
1037
+ profile.language = g_param[OptionsDefine.Language]
1038
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1039
+ client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
1040
+ client._sdkVersion += ("_CLI_" + __version__)
1041
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1042
+ model = models.DescribeImagesToShareRequest()
1043
+ model.from_json_string(json.dumps(args))
1044
+ start_time = time.time()
1045
+ while True:
1046
+ rsp = client.DescribeImagesToShare(model)
1047
+ result = rsp.to_json_string()
1048
+ try:
1049
+ json_obj = json.loads(result)
1050
+ except TypeError as e:
1051
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1052
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1053
+ break
1054
+ cur_time = time.time()
1055
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1056
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1057
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1058
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1059
+ else:
1060
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1061
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1062
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1063
+
1064
+
1010
1065
  def doDescribeInstancesTrafficPackages(args, parsed_globals):
1011
1066
  g_param = parse_global_arg(parsed_globals)
1012
1067
 
@@ -1392,6 +1447,61 @@ def doDescribeBundleDiscount(args, parsed_globals):
1392
1447
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1393
1448
 
1394
1449
 
1450
+ def doCreateInstances(args, parsed_globals):
1451
+ g_param = parse_global_arg(parsed_globals)
1452
+
1453
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1454
+ cred = credential.CVMRoleCredential()
1455
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1456
+ cred = credential.STSAssumeRoleCredential(
1457
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1458
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1459
+ )
1460
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
1461
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
1462
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
1463
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
1464
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1465
+ else:
1466
+ cred = credential.Credential(
1467
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1468
+ )
1469
+ http_profile = HttpProfile(
1470
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1471
+ reqMethod="POST",
1472
+ endpoint=g_param[OptionsDefine.Endpoint],
1473
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1474
+ )
1475
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
1476
+ if g_param[OptionsDefine.Language]:
1477
+ profile.language = g_param[OptionsDefine.Language]
1478
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1479
+ client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
1480
+ client._sdkVersion += ("_CLI_" + __version__)
1481
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1482
+ model = models.CreateInstancesRequest()
1483
+ model.from_json_string(json.dumps(args))
1484
+ start_time = time.time()
1485
+ while True:
1486
+ rsp = client.CreateInstances(model)
1487
+ result = rsp.to_json_string()
1488
+ try:
1489
+ json_obj = json.loads(result)
1490
+ except TypeError as e:
1491
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1492
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1493
+ break
1494
+ cur_time = time.time()
1495
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1496
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1497
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1498
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1499
+ else:
1500
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1501
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1502
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1503
+
1504
+
1395
1505
  def doAttachCcn(args, parsed_globals):
1396
1506
  g_param = parse_global_arg(parsed_globals)
1397
1507
 
@@ -1667,6 +1777,61 @@ def doDescribeDisksDeniedActions(args, parsed_globals):
1667
1777
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1668
1778
 
1669
1779
 
1780
+ def doRenewInstances(args, parsed_globals):
1781
+ g_param = parse_global_arg(parsed_globals)
1782
+
1783
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1784
+ cred = credential.CVMRoleCredential()
1785
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1786
+ cred = credential.STSAssumeRoleCredential(
1787
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1788
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
1789
+ )
1790
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
1791
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
1792
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
1793
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
1794
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1795
+ else:
1796
+ cred = credential.Credential(
1797
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1798
+ )
1799
+ http_profile = HttpProfile(
1800
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1801
+ reqMethod="POST",
1802
+ endpoint=g_param[OptionsDefine.Endpoint],
1803
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1804
+ )
1805
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
1806
+ if g_param[OptionsDefine.Language]:
1807
+ profile.language = g_param[OptionsDefine.Language]
1808
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1809
+ client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
1810
+ client._sdkVersion += ("_CLI_" + __version__)
1811
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1812
+ model = models.RenewInstancesRequest()
1813
+ model.from_json_string(json.dumps(args))
1814
+ start_time = time.time()
1815
+ while True:
1816
+ rsp = client.RenewInstances(model)
1817
+ result = rsp.to_json_string()
1818
+ try:
1819
+ json_obj = json.loads(result)
1820
+ except TypeError as e:
1821
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1822
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1823
+ break
1824
+ cur_time = time.time()
1825
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1826
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1827
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1828
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1829
+ else:
1830
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1831
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1832
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1833
+
1834
+
1670
1835
  def doDescribeModifyInstanceBundles(args, parsed_globals):
1671
1836
  g_param = parse_global_arg(parsed_globals)
1672
1837
 
@@ -2877,7 +3042,7 @@ def doTerminateInstances(args, parsed_globals):
2877
3042
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
2878
3043
 
2879
3044
 
2880
- def doRenewInstances(args, parsed_globals):
3045
+ def doSyncBlueprint(args, parsed_globals):
2881
3046
  g_param = parse_global_arg(parsed_globals)
2882
3047
 
2883
3048
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -2909,11 +3074,11 @@ def doRenewInstances(args, parsed_globals):
2909
3074
  client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
2910
3075
  client._sdkVersion += ("_CLI_" + __version__)
2911
3076
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
2912
- model = models.RenewInstancesRequest()
3077
+ model = models.SyncBlueprintRequest()
2913
3078
  model.from_json_string(json.dumps(args))
2914
3079
  start_time = time.time()
2915
3080
  while True:
2916
- rsp = client.RenewInstances(model)
3081
+ rsp = client.SyncBlueprint(model)
2917
3082
  result = rsp.to_json_string()
2918
3083
  try:
2919
3084
  json_obj = json.loads(result)
@@ -3647,7 +3812,7 @@ def doModifyFirewallRuleDescription(args, parsed_globals):
3647
3812
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
3648
3813
 
3649
3814
 
3650
- def doResetAttachCcn(args, parsed_globals):
3815
+ def doDescribeDiskDiscount(args, parsed_globals):
3651
3816
  g_param = parse_global_arg(parsed_globals)
3652
3817
 
3653
3818
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -3679,11 +3844,11 @@ def doResetAttachCcn(args, parsed_globals):
3679
3844
  client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
3680
3845
  client._sdkVersion += ("_CLI_" + __version__)
3681
3846
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
3682
- model = models.ResetAttachCcnRequest()
3847
+ model = models.DescribeDiskDiscountRequest()
3683
3848
  model.from_json_string(json.dumps(args))
3684
3849
  start_time = time.time()
3685
3850
  while True:
3686
- rsp = client.ResetAttachCcn(model)
3851
+ rsp = client.DescribeDiskDiscount(model)
3687
3852
  result = rsp.to_json_string()
3688
3853
  try:
3689
3854
  json_obj = json.loads(result)
@@ -3757,7 +3922,7 @@ def doRebootInstances(args, parsed_globals):
3757
3922
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
3758
3923
 
3759
3924
 
3760
- def doCreateInstances(args, parsed_globals):
3925
+ def doCreateInstanceSnapshot(args, parsed_globals):
3761
3926
  g_param = parse_global_arg(parsed_globals)
3762
3927
 
3763
3928
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -3789,11 +3954,66 @@ def doCreateInstances(args, parsed_globals):
3789
3954
  client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
3790
3955
  client._sdkVersion += ("_CLI_" + __version__)
3791
3956
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
3792
- model = models.CreateInstancesRequest()
3957
+ model = models.CreateInstanceSnapshotRequest()
3793
3958
  model.from_json_string(json.dumps(args))
3794
3959
  start_time = time.time()
3795
3960
  while True:
3796
- rsp = client.CreateInstances(model)
3961
+ rsp = client.CreateInstanceSnapshot(model)
3962
+ result = rsp.to_json_string()
3963
+ try:
3964
+ json_obj = json.loads(result)
3965
+ except TypeError as e:
3966
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
3967
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
3968
+ break
3969
+ cur_time = time.time()
3970
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
3971
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
3972
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
3973
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
3974
+ else:
3975
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
3976
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
3977
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
3978
+
3979
+
3980
+ def doModifyImageSharePermission(args, parsed_globals):
3981
+ g_param = parse_global_arg(parsed_globals)
3982
+
3983
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
3984
+ cred = credential.CVMRoleCredential()
3985
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
3986
+ cred = credential.STSAssumeRoleCredential(
3987
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
3988
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
3989
+ )
3990
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
3991
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
3992
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
3993
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
3994
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
3995
+ else:
3996
+ cred = credential.Credential(
3997
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
3998
+ )
3999
+ http_profile = HttpProfile(
4000
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
4001
+ reqMethod="POST",
4002
+ endpoint=g_param[OptionsDefine.Endpoint],
4003
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
4004
+ )
4005
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
4006
+ if g_param[OptionsDefine.Language]:
4007
+ profile.language = g_param[OptionsDefine.Language]
4008
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
4009
+ client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
4010
+ client._sdkVersion += ("_CLI_" + __version__)
4011
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
4012
+ model = models.ModifyImageSharePermissionRequest()
4013
+ model.from_json_string(json.dumps(args))
4014
+ start_time = time.time()
4015
+ while True:
4016
+ rsp = client.ModifyImageSharePermission(model)
3797
4017
  result = rsp.to_json_string()
3798
4018
  try:
3799
4019
  json_obj = json.loads(result)
@@ -3867,6 +4087,61 @@ def doRenewDisks(args, parsed_globals):
3867
4087
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
3868
4088
 
3869
4089
 
4090
+ def doDescribeSnapshotsDeniedActions(args, parsed_globals):
4091
+ g_param = parse_global_arg(parsed_globals)
4092
+
4093
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
4094
+ cred = credential.CVMRoleCredential()
4095
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
4096
+ cred = credential.STSAssumeRoleCredential(
4097
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
4098
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
4099
+ )
4100
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
4101
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
4102
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
4103
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
4104
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
4105
+ else:
4106
+ cred = credential.Credential(
4107
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
4108
+ )
4109
+ http_profile = HttpProfile(
4110
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
4111
+ reqMethod="POST",
4112
+ endpoint=g_param[OptionsDefine.Endpoint],
4113
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
4114
+ )
4115
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
4116
+ if g_param[OptionsDefine.Language]:
4117
+ profile.language = g_param[OptionsDefine.Language]
4118
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
4119
+ client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
4120
+ client._sdkVersion += ("_CLI_" + __version__)
4121
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
4122
+ model = models.DescribeSnapshotsDeniedActionsRequest()
4123
+ model.from_json_string(json.dumps(args))
4124
+ start_time = time.time()
4125
+ while True:
4126
+ rsp = client.DescribeSnapshotsDeniedActions(model)
4127
+ result = rsp.to_json_string()
4128
+ try:
4129
+ json_obj = json.loads(result)
4130
+ except TypeError as e:
4131
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
4132
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
4133
+ break
4134
+ cur_time = time.time()
4135
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
4136
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
4137
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
4138
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
4139
+ else:
4140
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
4141
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
4142
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
4143
+
4144
+
3870
4145
  def doCreateBlueprint(args, parsed_globals):
3871
4146
  g_param = parse_global_arg(parsed_globals)
3872
4147
 
@@ -3922,7 +4197,7 @@ def doCreateBlueprint(args, parsed_globals):
3922
4197
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
3923
4198
 
3924
4199
 
3925
- def doDescribeSnapshotsDeniedActions(args, parsed_globals):
4200
+ def doShareBlueprintAcrossAccounts(args, parsed_globals):
3926
4201
  g_param = parse_global_arg(parsed_globals)
3927
4202
 
3928
4203
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -3954,11 +4229,11 @@ def doDescribeSnapshotsDeniedActions(args, parsed_globals):
3954
4229
  client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
3955
4230
  client._sdkVersion += ("_CLI_" + __version__)
3956
4231
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
3957
- model = models.DescribeSnapshotsDeniedActionsRequest()
4232
+ model = models.ShareBlueprintAcrossAccountsRequest()
3958
4233
  model.from_json_string(json.dumps(args))
3959
4234
  start_time = time.time()
3960
4235
  while True:
3961
- rsp = client.DescribeSnapshotsDeniedActions(model)
4236
+ rsp = client.ShareBlueprintAcrossAccounts(model)
3962
4237
  result = rsp.to_json_string()
3963
4238
  try:
3964
4239
  json_obj = json.loads(result)
@@ -3977,7 +4252,7 @@ def doDescribeSnapshotsDeniedActions(args, parsed_globals):
3977
4252
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
3978
4253
 
3979
4254
 
3980
- def doCreateInstanceSnapshot(args, parsed_globals):
4255
+ def doResetAttachCcn(args, parsed_globals):
3981
4256
  g_param = parse_global_arg(parsed_globals)
3982
4257
 
3983
4258
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -4009,11 +4284,66 @@ def doCreateInstanceSnapshot(args, parsed_globals):
4009
4284
  client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
4010
4285
  client._sdkVersion += ("_CLI_" + __version__)
4011
4286
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
4012
- model = models.CreateInstanceSnapshotRequest()
4287
+ model = models.ResetAttachCcnRequest()
4013
4288
  model.from_json_string(json.dumps(args))
4014
4289
  start_time = time.time()
4015
4290
  while True:
4016
- rsp = client.CreateInstanceSnapshot(model)
4291
+ rsp = client.ResetAttachCcn(model)
4292
+ result = rsp.to_json_string()
4293
+ try:
4294
+ json_obj = json.loads(result)
4295
+ except TypeError as e:
4296
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
4297
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
4298
+ break
4299
+ cur_time = time.time()
4300
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
4301
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
4302
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
4303
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
4304
+ else:
4305
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
4306
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
4307
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
4308
+
4309
+
4310
+ def doResizeDisks(args, parsed_globals):
4311
+ g_param = parse_global_arg(parsed_globals)
4312
+
4313
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
4314
+ cred = credential.CVMRoleCredential()
4315
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
4316
+ cred = credential.STSAssumeRoleCredential(
4317
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
4318
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
4319
+ )
4320
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
4321
+ and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
4322
+ and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
4323
+ and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
4324
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
4325
+ else:
4326
+ cred = credential.Credential(
4327
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
4328
+ )
4329
+ http_profile = HttpProfile(
4330
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
4331
+ reqMethod="POST",
4332
+ endpoint=g_param[OptionsDefine.Endpoint],
4333
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
4334
+ )
4335
+ profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
4336
+ if g_param[OptionsDefine.Language]:
4337
+ profile.language = g_param[OptionsDefine.Language]
4338
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
4339
+ client = mod.LighthouseClient(cred, g_param[OptionsDefine.Region], profile)
4340
+ client._sdkVersion += ("_CLI_" + __version__)
4341
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
4342
+ model = models.ResizeDisksRequest()
4343
+ model.from_json_string(json.dumps(args))
4344
+ start_time = time.time()
4345
+ while True:
4346
+ rsp = client.ResizeDisks(model)
4017
4347
  result = rsp.to_json_string()
4018
4348
  try:
4019
4349
  json_obj = json.loads(result)
@@ -4102,7 +4432,7 @@ ACTION_MAP = {
4102
4432
  "DeleteBlueprints": doDeleteBlueprints,
4103
4433
  "CreateDisks": doCreateDisks,
4104
4434
  "DescribeAllScenes": doDescribeAllScenes,
4105
- "DescribeDiskDiscount": doDescribeDiskDiscount,
4435
+ "CancelShareBlueprintAcrossAccounts": doCancelShareBlueprintAcrossAccounts,
4106
4436
  "CreateFirewallRules": doCreateFirewallRules,
4107
4437
  "DescribeInstancesReturnable": doDescribeInstancesReturnable,
4108
4438
  "ModifyInstancesAttribute": doModifyInstancesAttribute,
@@ -4116,6 +4446,7 @@ ACTION_MAP = {
4116
4446
  "DescribeCcnAttachedInstances": doDescribeCcnAttachedInstances,
4117
4447
  "DescribeInstances": doDescribeInstances,
4118
4448
  "ImportKeyPair": doImportKeyPair,
4449
+ "DescribeImagesToShare": doDescribeImagesToShare,
4119
4450
  "DescribeInstancesTrafficPackages": doDescribeInstancesTrafficPackages,
4120
4451
  "InquirePriceCreateBlueprint": doInquirePriceCreateBlueprint,
4121
4452
  "AttachDisks": doAttachDisks,
@@ -4123,11 +4454,13 @@ ACTION_MAP = {
4123
4454
  "DeleteFirewallRules": doDeleteFirewallRules,
4124
4455
  "DisassociateInstancesKeyPairs": doDisassociateInstancesKeyPairs,
4125
4456
  "DescribeBundleDiscount": doDescribeBundleDiscount,
4457
+ "CreateInstances": doCreateInstances,
4126
4458
  "AttachCcn": doAttachCcn,
4127
4459
  "DescribeBlueprints": doDescribeBlueprints,
4128
4460
  "ResetInstancesPassword": doResetInstancesPassword,
4129
4461
  "ModifyInstancesRenewFlag": doModifyInstancesRenewFlag,
4130
4462
  "DescribeDisksDeniedActions": doDescribeDisksDeniedActions,
4463
+ "RenewInstances": doRenewInstances,
4131
4464
  "DescribeModifyInstanceBundles": doDescribeModifyInstanceBundles,
4132
4465
  "DescribeDisks": doDescribeDisks,
4133
4466
  "DescribeGeneralResourceQuotas": doDescribeGeneralResourceQuotas,
@@ -4150,7 +4483,7 @@ ACTION_MAP = {
4150
4483
  "DescribeSnapshots": doDescribeSnapshots,
4151
4484
  "ModifyFirewallRules": doModifyFirewallRules,
4152
4485
  "TerminateInstances": doTerminateInstances,
4153
- "RenewInstances": doRenewInstances,
4486
+ "SyncBlueprint": doSyncBlueprint,
4154
4487
  "TerminateDisks": doTerminateDisks,
4155
4488
  "DescribeInstanceVncUrl": doDescribeInstanceVncUrl,
4156
4489
  "ModifySnapshotAttribute": doModifySnapshotAttribute,
@@ -4164,13 +4497,16 @@ ACTION_MAP = {
4164
4497
  "IsolateInstances": doIsolateInstances,
4165
4498
  "DescribeDiskConfigs": doDescribeDiskConfigs,
4166
4499
  "ModifyFirewallRuleDescription": doModifyFirewallRuleDescription,
4167
- "ResetAttachCcn": doResetAttachCcn,
4500
+ "DescribeDiskDiscount": doDescribeDiskDiscount,
4168
4501
  "RebootInstances": doRebootInstances,
4169
- "CreateInstances": doCreateInstances,
4502
+ "CreateInstanceSnapshot": doCreateInstanceSnapshot,
4503
+ "ModifyImageSharePermission": doModifyImageSharePermission,
4170
4504
  "RenewDisks": doRenewDisks,
4171
- "CreateBlueprint": doCreateBlueprint,
4172
4505
  "DescribeSnapshotsDeniedActions": doDescribeSnapshotsDeniedActions,
4173
- "CreateInstanceSnapshot": doCreateInstanceSnapshot,
4506
+ "CreateBlueprint": doCreateBlueprint,
4507
+ "ShareBlueprintAcrossAccounts": doShareBlueprintAcrossAccounts,
4508
+ "ResetAttachCcn": doResetAttachCcn,
4509
+ "ResizeDisks": doResizeDisks,
4174
4510
  "ModifyInstancesBundle": doModifyInstancesBundle,
4175
4511
 
4176
4512
  }