bce-python-sdk 0.9.6__py3-none-any.whl → 0.9.7__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.
baidubce/__init__.py CHANGED
@@ -18,7 +18,7 @@ from builtins import bytes
18
18
  from . import protocol
19
19
 
20
20
 
21
- SDK_VERSION = b'0.9.06'
21
+ SDK_VERSION = b'0.9.07'
22
22
  DEFAULT_SERVICE_DOMAIN = b'bcebos.com'
23
23
  URL_PREFIX = b'/v1'
24
24
  DEFAULT_ENCODING = 'UTF-8'
@@ -41,6 +41,7 @@ class BbcClient(bce_base_client.BceBaseClient):
41
41
  Bbc client sdk
42
42
  """
43
43
 
44
+ prefix_v2 = b'/v2'
44
45
  def __init__(self, config=None):
45
46
  bce_base_client.BceBaseClient.__init__(self, config)
46
47
 
@@ -685,6 +686,47 @@ class BbcClient(bce_base_client.BceBaseClient):
685
686
  return self._send_request(http_methods.PUT, path, body=json.dumps(body),
686
687
  params=params, config=config)
687
688
 
689
+ @required(reserved_instance_ids=list,
690
+ tags=list)
691
+ def bind_reserved_instance_to_tags(self, reserved_instance_ids, tags, config=None):
692
+ """
693
+ :param reserved_instance_ids:
694
+ :param tags:
695
+ :param config:
696
+ :return:
697
+ """
698
+ path = b'/bbc/reserved/tag'
699
+ tag_list = [tag.__dict__ for tag in tags]
700
+ body = {
701
+ 'changeTags': tag_list,
702
+ 'reservedInstanceIds': reserved_instance_ids
703
+ }
704
+ params = {
705
+ 'bind': None
706
+ }
707
+ return self._send_request(http_methods.PUT, path, json.dumps(body),
708
+ params=params, config=config, api_version=self.prefix_v2)
709
+
710
+ @required(reserved_instance_ids=list,
711
+ tags=list)
712
+ def unbind_reserved_instance_from_tags(self, reserved_instance_ids, tags, config=None):
713
+ """
714
+ :param reserved_instance_ids:
715
+ :param tags:
716
+ :param config:
717
+ :return:
718
+ """
719
+ path = b'/bbc/reserved/tag'
720
+ tag_list = [tag.__dict__ for tag in tags]
721
+ body = {
722
+ 'changeTags': tag_list,
723
+ 'reservedInstanceIds': reserved_instance_ids
724
+ }
725
+ params = {
726
+ 'unbind': None
727
+ }
728
+ return self._send_request(http_methods.PUT, path, json.dumps(body),
729
+ params=params, config=config, api_version=self.prefix_v2)
688
730
 
689
731
  def list_flavors(self, config=None):
690
732
  """
@@ -32,10 +32,21 @@ class Billing(object):
32
32
  param: reservationTimeUnit:
33
33
  The time unit to specify the duration ,only "Month" can be used now.
34
34
  """
35
+
35
36
  def __init__(self, paymentTiming=None, reservationLength=1, reservationTimeUnit='Month'):
36
37
  if paymentTiming:
37
38
  self.paymentTiming = paymentTiming
38
39
  self.reservation = {
39
- 'reservationLength': reservationLength,
40
- 'reservationTimeUnit': reservationTimeUnit
41
- }
40
+ 'reservationLength': reservationLength,
41
+ 'reservationTimeUnit': reservationTimeUnit
42
+ }
43
+
44
+
45
+ class TagModel(object):
46
+ """
47
+ TAGModel
48
+ """
49
+
50
+ def __init__(self, tagKey=None, tagValue=None):
51
+ self.tagKey = tagKey
52
+ self.tagValue = tagValue
@@ -50,6 +50,7 @@ class BccClient(bce_base_client.BceBaseClient):
50
50
  """
51
51
 
52
52
  prefix = b'/v2'
53
+ prefix_v3 = b'/v3'
53
54
 
54
55
  def __init__(self, config=None):
55
56
  bce_base_client.BceBaseClient.__init__(self, config)
@@ -1065,7 +1066,7 @@ class BccClient(bce_base_client.BceBaseClient):
1065
1066
  def list_instances(self, marker=None, max_keys=None, internal_ip=None, dedicated_host_id=None,
1066
1067
  zone_name=None, instance_ids=None, instance_names=None, cds_ids=None,
1067
1068
  deployset_ids=None, security_group_ids=None, payment_timing=None, status=None, tags=None,
1068
- vpc_id=None, private_ips=None, auto_renew=None, config=None):
1069
+ vpc_id=None, private_ips=None, ipv6_addresses=None, auto_renew=None, config=None):
1069
1070
  """
1070
1071
  Return a list of instances owned by the authenticated user.
1071
1072
 
@@ -1135,6 +1136,11 @@ class BccClient(bce_base_client.BceBaseClient):
1135
1136
  vpc_id
1136
1137
  :type private_ips: string
1137
1138
 
1139
+ :param ipv6_addresses:
1140
+ filter instance list with multiple ipv6 private ips join by ',', the parameter should be used with
1141
+ vpc_id
1142
+ :type ipv6_addresses: string
1143
+
1138
1144
  :param auto_renew:
1139
1145
  :type auto_renew: boolean
1140
1146
 
@@ -1174,6 +1180,8 @@ class BccClient(bce_base_client.BceBaseClient):
1174
1180
  params['vpcId'] = vpc_id
1175
1181
  if private_ips is not None:
1176
1182
  params['privateIps'] = private_ips
1183
+ if ipv6_addresses is not None:
1184
+ params['ipv6Addresses'] = ipv6_addresses
1177
1185
  if auto_renew is not None:
1178
1186
  params['autoRenew'] = auto_renew
1179
1187
  return self._send_request(http_methods.GET, path, params=params, config=config)
@@ -1640,6 +1648,94 @@ class BccClient(bce_base_client.BceBaseClient):
1640
1648
  return self._send_request(http_methods.PUT, path, json.dumps(body),
1641
1649
  params=params, config=config)
1642
1650
 
1651
+ @required(reserved_instance_ids=list,
1652
+ tags=list)
1653
+ def bind_reserved_instance_to_tags(self, reserved_instance_ids, tags, config=None):
1654
+ """
1655
+ :param reserved_instance_ids:
1656
+ :param tags:
1657
+ :param config:
1658
+ :return:
1659
+ """
1660
+ path = b'/bcc/reserved/tag'
1661
+ tag_list = [tag.__dict__ for tag in tags]
1662
+ body = {
1663
+ 'changeTags': tag_list,
1664
+ 'reservedInstanceIds': reserved_instance_ids
1665
+ }
1666
+ params = {
1667
+ 'bind': None
1668
+ }
1669
+ return self._send_request(http_methods.PUT, path, json.dumps(body),
1670
+ params=params, config=config)
1671
+
1672
+ @required(reserved_instance_ids=list,
1673
+ tags=list)
1674
+ def unbind_reserved_instance_from_tags(self, reserved_instance_ids, tags, config=None):
1675
+ """
1676
+ :param reserved_instance_ids:
1677
+ :param tags:
1678
+ :param config:
1679
+ :return:
1680
+ """
1681
+ path = b'/bcc/reserved/tag'
1682
+ tag_list = [tag.__dict__ for tag in tags]
1683
+ body = {
1684
+ 'changeTags': tag_list,
1685
+ 'reservedInstanceIds': reserved_instance_ids
1686
+ }
1687
+ params = {
1688
+ 'unbind': None
1689
+ }
1690
+ return self._send_request(http_methods.PUT, path, json.dumps(body),
1691
+ params=params, config=config)
1692
+
1693
+ def bind_tags_batch_by_resource_type(self, resource_type, resource_ids, tags, is_relation_tag, config=None):
1694
+ """
1695
+ :param resource_type:
1696
+ :param resource_ids:
1697
+ :param tags:
1698
+ :param is_relation_tag:
1699
+ :param config:
1700
+ :return:
1701
+ """
1702
+ path = b'/bcc/tag'
1703
+ tag_list = [tag.__dict__ for tag in tags]
1704
+ body = {
1705
+ 'resourceType': resource_type,
1706
+ 'resourceIds': resource_ids,
1707
+ 'tags': tag_list,
1708
+ 'isRelationTag': is_relation_tag
1709
+ }
1710
+ params = {
1711
+ 'action': 'AttachTags'
1712
+ }
1713
+ return self._send_request(http_methods.POST, path, json.dumps(body),
1714
+ params=params, config=config, prefix=self.prefix_v3)
1715
+
1716
+ def unbind_tags_batch_by_resource_type(self, resource_type, resource_ids, tags, is_relation_tag, config=None):
1717
+ """
1718
+ :param resource_type:
1719
+ :param resource_ids:
1720
+ :param tags:
1721
+ :param is_relation_tag:
1722
+ :param config:
1723
+ :return:
1724
+ """
1725
+ path = b'/bcc/tag'
1726
+ tag_list = [tag.__dict__ for tag in tags]
1727
+ body = {
1728
+ 'resourceType': resource_type,
1729
+ 'resourceIds': resource_ids,
1730
+ 'tags': tag_list,
1731
+ 'isRelationTag': is_relation_tag
1732
+ }
1733
+ params = {
1734
+ 'action': 'DetachTags'
1735
+ }
1736
+ return self._send_request(http_methods.POST, path, json.dumps(body),
1737
+ params=params, config=config, prefix=self.prefix_v3)
1738
+
1643
1739
  @required(instance_id=(bytes, str),
1644
1740
  tags=list)
1645
1741
  def bind_instance_to_tags(self, instance_id, tags, config=None):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bce-python-sdk
3
- Version: 0.9.6
3
+ Version: 0.9.7
4
4
  Summary: BCE SDK for python
5
5
  Home-page: http://bce.baidu.com
6
6
  Author:
@@ -1,4 +1,4 @@
1
- baidubce/__init__.py,sha256=4pnkvyMrf76aBZjNydEF6C7ykK7BcgF4sJ0epzwkj5w,813
1
+ baidubce/__init__.py,sha256=Ed1lR-gczSH4FFMwsYA4mhT1rGS_vAGYFJ_wjkNQQYY,813
2
2
  baidubce/bce_base_client.py,sha256=7gjkRy_YlTTb6TXHYHyZRYMjdVO7FTtHMdwXx8bPgsE,3428
3
3
  baidubce/bce_client_configuration.py,sha256=Wzuu9JR11hcHxgcKQIP63qIChEzVrT9ZA_fyqIfqqP4,3055
4
4
  baidubce/bce_response.py,sha256=V5a3bgRj04cM3Ml3s1OByLyZZSGDUy9PL52JSugmCgM,1655
@@ -24,10 +24,10 @@ baidubce/services/autoscaling/as_client.py,sha256=X4eiHV71qqz6BwXGNmEx43O7aM2qcM
24
24
  baidubce/services/autoscaling/as_handler.py,sha256=UXzfERwnVJETsQi8pIrzpxY_DX2U4rm1zXyrZ--umJQ,3332
25
25
  baidubce/services/autoscaling/as_model.py,sha256=5MBy7xgRMZWzSjDT34SSwM9kYYj7HuQWjBCG1nyjhd0,8501
26
26
  baidubce/services/bbc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- baidubce/services/bbc/bbc_client.py,sha256=9jcIyysPYv9iLj0qD-NSENHmNZs7Lsfb3F1khqb__2I,35864
28
- baidubce/services/bbc/bbc_model.py,sha256=Dx7HoUw73Uk3I2dxBL188-3i4pbt5v-8SZe4T1K99dg,1595
27
+ baidubce/services/bbc/bbc_client.py,sha256=ewS7ju_qF3v4WBfqWhr1H4XX5QldItnarD3ZPrt0SQ0,37306
28
+ baidubce/services/bbc/bbc_model.py,sha256=Dy80LZ4ro_iS3UejJ_CL9kI7OyMSBoDitTE4J1XAC_g,1790
29
29
  baidubce/services/bcc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- baidubce/services/bcc/bcc_client.py,sha256=MTbQR-2KLoTnILhZYG9cMd7MPGZTtZYEkOX8XGVn71s,233985
30
+ baidubce/services/bcc/bcc_client.py,sha256=GopNQWfXsTbU9fnej_z40bmxFD5WL1HkBrp8CrHewRE,237248
31
31
  baidubce/services/bcc/bcc_model.py,sha256=7v5WzqDDhl7MmI3vDdOuyM5S9isxkKoaIv5RAqzzTRI,5919
32
32
  baidubce/services/bcc/fpga_card_type.py,sha256=n6goqnapIgAC9_sciA_2he5HFqPRbRv109qitO7qpd8,948
33
33
  baidubce/services/bcc/gpu_card_type.py,sha256=HEfMzne-UC5F295JPrPUu7V9F5g-hbXF2TNBontEFes,1054
@@ -166,7 +166,7 @@ baidubce/services/vpc/vpc_client.py,sha256=6HD-TIxmNPujzIVc37Z9OOp_JUOoITUPzTwjm
166
166
  baidubce/services/vpn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
167
  baidubce/services/vpn/vpn_client.py,sha256=VGmPmnl7Il_NcbGMAgASmVK_1IF9HQ8PJ-WLij-7Axc,28554
168
168
  baidubce/services/vpn/vpn_model.py,sha256=r9V2At9ll9cZTOryGflS9tH9DlHdeelKYuGXvTNyTgg,3364
169
- bce_python_sdk-0.9.6.dist-info/METADATA,sha256=d4aQYNpBTVPTUbjz8gTDAMNu4N3Dlt-7jLNgxFzm2pw,318
170
- bce_python_sdk-0.9.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
171
- bce_python_sdk-0.9.6.dist-info/top_level.txt,sha256=Oh6eo_-T_AuEDpIaR54biUUPThxsoQiYMVHLBTaweQs,9
172
- bce_python_sdk-0.9.6.dist-info/RECORD,,
169
+ bce_python_sdk-0.9.7.dist-info/METADATA,sha256=s2rDcPlJlzpvVnoqrTFXEsYy1xBUnacgr33zoPiENVs,318
170
+ bce_python_sdk-0.9.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
171
+ bce_python_sdk-0.9.7.dist-info/top_level.txt,sha256=Oh6eo_-T_AuEDpIaR54biUUPThxsoQiYMVHLBTaweQs,9
172
+ bce_python_sdk-0.9.7.dist-info/RECORD,,