bce-python-sdk 0.9.5__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.05'
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):
@@ -1780,7 +1876,7 @@ class BccClient(bce_base_client.BceBaseClient):
1780
1876
  description=None, renew_time_unit=None, renew_time=None,
1781
1877
  cluster_id=None, relation_tag=False,
1782
1878
  tags=None, auto_snapshot_policy=None,
1783
- client_token=None, config=None):
1879
+ client_token=None, config=None, charge_type=None):
1784
1880
  """
1785
1881
  Create a volume with the specified options.
1786
1882
  You can use this method to create a new empty volume by specified options
@@ -1795,7 +1891,7 @@ class BccClient(bce_base_client.BceBaseClient):
1795
1891
  :type cds_size_in_gb: int
1796
1892
 
1797
1893
  :param billing:
1798
- Billing information.
1894
+ Billing information.Deprecated
1799
1895
  :type billing: bcc_model.Billing
1800
1896
 
1801
1897
  :param purchase_count:
@@ -1855,6 +1951,17 @@ class BccClient(bce_base_client.BceBaseClient):
1855
1951
  The optional auto snapshot policy to be bonded.
1856
1952
  :type auto_snapshot_policy: bcc_model.AutoSnapshotPolicyModel
1857
1953
 
1954
+ :param charge_type:
1955
+ The optional parameter to specify the payment for the volume.
1956
+ The billing type and payment method, including Prepaid and Postpaid,
1957
+ need to be specified only when the instanceId is not empty and the corresponding instance type is prepaid.
1958
+ If instanceId is empty:
1959
+ create a post payment type CDS;
1960
+ If the instanceId is not empty:
1961
+ If the instance is prepaid, a chargeType needs to be specified;
1962
+ If the instance is post paid, create a post paid CDS
1963
+ :type charge_type: menu{'Prepaid', 'Postpaid'}
1964
+
1858
1965
  :return:
1859
1966
  :rtype baidubce.bce_response.BceResponse
1860
1967
  """
@@ -1897,6 +2004,8 @@ class BccClient(bce_base_client.BceBaseClient):
1897
2004
  body['encryptKey'] = encrypt_key
1898
2005
  if instance_id is not None:
1899
2006
  body['instanceId'] = instance_id
2007
+ if charge_type is not None:
2008
+ body['chargeType'] = charge_type
1900
2009
  return self._send_request(http_methods.POST, path, json.dumps(body),
1901
2010
  params=params, config=config)
1902
2011
 
@@ -1907,7 +2016,7 @@ class BccClient(bce_base_client.BceBaseClient):
1907
2016
  description=None, renew_time_unit=None, renew_time=None,
1908
2017
  cluster_id=None, relation_tag=False,
1909
2018
  tags=None, auto_snapshot_policy=None,
1910
- config=None):
2019
+ config=None, charge_type=None):
1911
2020
  """
1912
2021
  Create a volume with the specified options.
1913
2022
  You can use this method to create a new empty volume by specified options
@@ -1915,14 +2024,14 @@ class BccClient(bce_base_client.BceBaseClient):
1915
2024
  By using the cdsSizeInGB parameter you can create a newly empty volume.
1916
2025
  By using snapshotId parameter to create a volume form specific snapshot.
1917
2026
 
1918
- :param snapshot_id:
2027
+ :param snapshot_id:xx
1919
2028
  The id of snapshot.
1920
2029
  By specifying the snapshotId,
1921
2030
  it will create volume from the specified snapshot and the parameter cdsSizeInGB will be ignored.
1922
2031
  :type snapshot_id: string
1923
2032
 
1924
2033
  :param billing:
1925
- Billing information.
2034
+ Billing information.Deprecated
1926
2035
  :type billing: bcc_model.Billing
1927
2036
 
1928
2037
  :param purchase_count:
@@ -1982,6 +2091,17 @@ class BccClient(bce_base_client.BceBaseClient):
1982
2091
  https://bce.baidu.com/doc/BCC/API.html#.E5.B9.82.E7.AD.89.E6.80.A7
1983
2092
  :type client_token: string
1984
2093
 
2094
+ :param charge_type:
2095
+ The optional parameter to specify the payment for the volume.
2096
+ The billing type and payment method, including Prepaid and Postpaid,
2097
+ need to be specified only when the instanceId is not empty and the corresponding instance type is prepaid.
2098
+ If instanceId is empty:
2099
+ create a post payment type CDS;
2100
+ If the instanceId is not empty:
2101
+ If the instance is prepaid, a chargeType needs to be specified;
2102
+ If the instance is post paid, create a post paid CDS
2103
+ :type charge_type: menu{'Prepaid', 'Postpaid'}
2104
+
1985
2105
  :return:
1986
2106
  :rtype baidubce.bce_response.BceResponse
1987
2107
  """
@@ -2024,6 +2144,8 @@ class BccClient(bce_base_client.BceBaseClient):
2024
2144
  body['encryptKey'] = encrypt_key
2025
2145
  if instance_id is not None:
2026
2146
  body['instanceId'] = instance_id
2147
+ if charge_type is not None:
2148
+ body['chargeType'] = charge_type
2027
2149
  return self._send_request(http_methods.POST, path, json.dumps(body),
2028
2150
  params=params, config=config)
2029
2151
 
@@ -29,6 +29,8 @@ if sys.version_info[0] == 2:
29
29
  else:
30
30
  value_type = (str, bytes)
31
31
 
32
+ MAX_INSTANCE_NUMBER = 100
33
+
32
34
 
33
35
  class BcmClient(bce_base_client.BceBaseClient):
34
36
  """
@@ -2924,7 +2926,6 @@ class BcmClient(bce_base_client.BceBaseClient):
2924
2926
  }
2925
2927
  return self._send_csm_request(http_methods.GET, path, params=params)
2926
2928
 
2927
-
2928
2929
  def push_metric_data(self, user_id=None, scope=None, metric_data=None, config=None):
2929
2930
 
2930
2931
  """
@@ -2945,7 +2946,6 @@ class BcmClient(bce_base_client.BceBaseClient):
2945
2946
 
2946
2947
  return self._send_request(http_methods.POST, path, body=json.dumps(body), config=config)
2947
2948
 
2948
-
2949
2949
  def get_custom_metric_data(self, user_id=None, namespaces=None, metric_name=None,
2950
2950
  dimensions=None, statistics=None, start_time=None,
2951
2951
  end_time=None, cycle=None, config=None):
@@ -3049,7 +3049,6 @@ class BcmClient(bce_base_client.BceBaseClient):
3049
3049
 
3050
3050
  return self._send_csm_request(http_methods.POST, path, body=json.dumps(body), config=config)
3051
3051
 
3052
-
3053
3052
  def create_site_http_task_config(self, user_id=None, task_name=None, address=None,
3054
3053
  method=None, post_content=None,
3055
3054
  advance_config=None, cycle=None, idc=None, timeout=None, config=None):
@@ -3079,7 +3078,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3079
3078
 
3080
3079
  user_id = compat.convert_to_bytes(user_id)
3081
3080
  path = b'/userId/%s/site/http/create' % (user_id)
3082
- body = {
3081
+ body = {
3083
3082
  "userId": user_id,
3084
3083
  "taskName": task_name,
3085
3084
  "address": address,
@@ -3124,7 +3123,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3124
3123
 
3125
3124
  user_id = compat.convert_to_bytes(user_id)
3126
3125
  path = b'/userId/%s/site/http/update' % (user_id)
3127
- body = {
3126
+ body = {
3128
3127
  "userId": user_id,
3129
3128
  "taskId": task_id,
3130
3129
  "taskName": task_name,
@@ -3188,7 +3187,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3188
3187
 
3189
3188
  user_id = compat.convert_to_bytes(user_id)
3190
3189
  path = b'/userId/%s/site/https/create' % (user_id)
3191
- body = {
3190
+ body = {
3192
3191
  "userId": user_id,
3193
3192
  "taskName": task_name,
3194
3193
  "address": address,
@@ -3233,7 +3232,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3233
3232
 
3234
3233
  user_id = compat.convert_to_bytes(user_id)
3235
3234
  path = b'/userId/%s/site/https/update' % (user_id)
3236
- body = {
3235
+ body = {
3237
3236
  "userId": user_id,
3238
3237
  "taskId": task_id,
3239
3238
  "taskName": task_name,
@@ -3295,7 +3294,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3295
3294
 
3296
3295
  user_id = compat.convert_to_bytes(user_id)
3297
3296
  path = b'/userId/%s/site/ping/create' % (user_id)
3298
- body = {
3297
+ body = {
3299
3298
  "userId": user_id,
3300
3299
  "taskName": task_name,
3301
3300
  "address": address,
@@ -3337,7 +3336,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3337
3336
 
3338
3337
  user_id = compat.convert_to_bytes(user_id)
3339
3338
  path = b'/userId/%s/site/ping/update' % (user_id)
3340
- body = {
3339
+ body = {
3341
3340
  "userId": user_id,
3342
3341
  "taskId": task_id,
3343
3342
  "taskName": task_name,
@@ -3400,7 +3399,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3400
3399
 
3401
3400
  user_id = compat.convert_to_bytes(user_id)
3402
3401
  path = b'/userId/%s/site/tcp/create' % (user_id)
3403
- body = {
3402
+ body = {
3404
3403
  "userId": user_id,
3405
3404
  "taskName": task_name,
3406
3405
  "address": address,
@@ -3456,7 +3455,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3456
3455
 
3457
3456
  user_id = compat.convert_to_bytes(user_id)
3458
3457
  path = b'/userId/%s/site/tcp/update' % (user_id)
3459
- body = {
3458
+ body = {
3460
3459
  "userId": user_id,
3461
3460
  "taskId": task_id,
3462
3461
  "taskName": task_name,
@@ -3523,7 +3522,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3523
3522
 
3524
3523
  user_id = compat.convert_to_bytes(user_id)
3525
3524
  path = b'/userId/%s/site/udp/create' % (user_id)
3526
- body = {
3525
+ body = {
3527
3526
  "userId": user_id,
3528
3527
  "taskName": task_name,
3529
3528
  "address": address,
@@ -3579,7 +3578,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3579
3578
 
3580
3579
  user_id = compat.convert_to_bytes(user_id)
3581
3580
  path = b'/userId/%s/site/udp/update' % (user_id)
3582
- body = {
3581
+ body = {
3583
3582
  "userId": user_id,
3584
3583
  "taskId": task_id,
3585
3584
  "taskName": task_name,
@@ -3650,7 +3649,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3650
3649
 
3651
3650
  user_id = compat.convert_to_bytes(user_id)
3652
3651
  path = b'/userId/%s/site/ftp/create' % (user_id)
3653
- body = {
3652
+ body = {
3654
3653
  "userId": user_id,
3655
3654
  "taskName": task_name,
3656
3655
  "address": address,
@@ -3700,7 +3699,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3700
3699
 
3701
3700
  user_id = compat.convert_to_bytes(user_id)
3702
3701
  path = b'/userId/%s/site/ftp/update' % (user_id)
3703
- body = {
3702
+ body = {
3704
3703
  "userId": user_id,
3705
3704
  "taskId": task_id,
3706
3705
  "taskName": task_name,
@@ -3767,7 +3766,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3767
3766
 
3768
3767
  user_id = compat.convert_to_bytes(user_id)
3769
3768
  path = b'/userId/%s/site/dns/create' % (user_id)
3770
- body = {
3769
+ body = {
3771
3770
  "userId": user_id,
3772
3771
  "taskName": task_name,
3773
3772
  "address": address,
@@ -3814,7 +3813,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3814
3813
 
3815
3814
  user_id = compat.convert_to_bytes(user_id)
3816
3815
  path = b'/userId/%s/site/dns/update' % (user_id)
3817
- body = {
3816
+ body = {
3818
3817
  "userId": user_id,
3819
3818
  "taskId": task_id,
3820
3819
  "taskName": task_name,
@@ -3905,7 +3904,6 @@ class BcmClient(bce_base_client.BceBaseClient):
3905
3904
  b'taskId': task_id,
3906
3905
  }
3907
3906
 
3908
-
3909
3907
  return self._send_csm_request(http_methods.DELETE, path, params=params, config=config)
3910
3908
 
3911
3909
  def get_site_task_config_info(self, user_id=None, task_id=None, config=None):
@@ -3924,7 +3922,6 @@ class BcmClient(bce_base_client.BceBaseClient):
3924
3922
  task_id = compat.convert_to_bytes(task_id)
3925
3923
  path = b'/userId/%s/site/%s' % (user_id, task_id)
3926
3924
 
3927
-
3928
3925
  return self._send_csm_request(http_methods.GET, path, config=config)
3929
3926
 
3930
3927
  def create_site_alarm_config(self, user_id=None, task_id=None, comment=None, alias_name=None,
@@ -3969,7 +3966,7 @@ class BcmClient(bce_base_client.BceBaseClient):
3969
3966
 
3970
3967
  user_id = compat.convert_to_bytes(user_id)
3971
3968
  path = b'/userId/%s/site/alarm/config/create' % (user_id)
3972
- body = {
3969
+ body = {
3973
3970
  "userId": user_id,
3974
3971
  "taskId": task_id,
3975
3972
  "comment": comment,
@@ -4008,7 +4005,6 @@ class BcmClient(bce_base_client.BceBaseClient):
4008
4005
  "alarmNames": alarm_names
4009
4006
  }
4010
4007
 
4011
-
4012
4008
  return self._send_csm_request(http_methods.DELETE, path, body=json.dumps(body), config=config)
4013
4009
 
4014
4010
  def update_site_alarm_config(self, user_id=None, task_id=None, alarm_name=None, comment=None, alias_name=None,
@@ -4055,7 +4051,7 @@ class BcmClient(bce_base_client.BceBaseClient):
4055
4051
 
4056
4052
  user_id = compat.convert_to_bytes(user_id)
4057
4053
  path = b'/userId/%s/site/alarm/config/update' % (user_id)
4058
- body = {
4054
+ body = {
4059
4055
  "userId": user_id,
4060
4056
  "taskId": task_id,
4061
4057
  "alarmName": alarm_name,
@@ -4095,7 +4091,6 @@ class BcmClient(bce_base_client.BceBaseClient):
4095
4091
  b'alarmName': alarm_name,
4096
4092
  }
4097
4093
 
4098
-
4099
4094
  return self._send_csm_request(http_methods.GET, path, params=params, config=config)
4100
4095
 
4101
4096
  def get_site_alarm_config_list(self, user_id=None, task_id=None, alarm_name=None,
@@ -4122,7 +4117,6 @@ class BcmClient(bce_base_client.BceBaseClient):
4122
4117
  path = b'/userId/%s/site/alarm/config/list' % (user_id)
4123
4118
  params = {}
4124
4119
 
4125
-
4126
4120
  if task_id is not None:
4127
4121
  params[b'taskId'] = task_id
4128
4122
  if alarm_name is not None:
@@ -4248,7 +4242,6 @@ class BcmClient(bce_base_client.BceBaseClient):
4248
4242
  "taskId": task_id
4249
4243
  }
4250
4244
 
4251
-
4252
4245
  return self._send_csm_request(http_methods.GET, path, params=params,
4253
4246
  body_parser=bcm_handler.parse_json_list, config=config)
4254
4247
 
@@ -4273,7 +4266,6 @@ class BcmClient(bce_base_client.BceBaseClient):
4273
4266
  "isp": isp
4274
4267
  }
4275
4268
 
4276
-
4277
4269
  return self._send_csm_request(http_methods.GET, path, params=params,
4278
4270
  body_parser=bcm_handler.parse_json_list, config=config)
4279
4271
 
@@ -4290,7 +4282,6 @@ class BcmClient(bce_base_client.BceBaseClient):
4290
4282
  user_id = compat.convert_to_bytes(user_id)
4291
4283
  path = b'/userId/%s/site/agent/list' % (user_id)
4292
4284
 
4293
-
4294
4285
  return self._send_csm_request(http_methods.GET, path, body_parser=bcm_handler.parse_json_list, config=config)
4295
4286
 
4296
4287
  def get_site_agent_for_task(self, user_id=None, task_id=None, config=None):
@@ -4313,7 +4304,6 @@ class BcmClient(bce_base_client.BceBaseClient):
4313
4304
 
4314
4305
  return self._send_csm_request(http_methods.GET, path, params=params, config=config)
4315
4306
 
4316
-
4317
4307
  def create_alarm_config(self, user_id, alias_name, scope, level, region, monitor_object, alarm_actions, rules,
4318
4308
  src_type="INSTANCE", ok_actions=None, insufficient_actions=None, config_type="NORMAL",
4319
4309
  insufficient_cycle=0, max_repeat_count=0, repeat_alarm_cycle=0, callback_url="",
@@ -5631,4 +5621,254 @@ class BcmClient(bce_base_client.BceBaseClient):
5631
5621
  b'ipType': ip_type,
5632
5622
  }
5633
5623
  path = b'/site/once/siteAgent'
5634
- return self._send_csm_request(http_methods.GET, path, params=params)
5624
+ return self._send_csm_request(http_methods.GET, path, params=params)
5625
+
5626
+ @required(user_id=str, scope=str, region=str, resource_type=str, dimensions=list,
5627
+ metric_names=list, timestamp=str, statistics=list, cycle=int)
5628
+ def get_multi_dimension_latest_metrics(self, user_id, scope, region=None, resource_type=None, dimensions=None,
5629
+ metric_names=None, timestamp=None, statistics=None, cycle=None):
5630
+ """
5631
+ :param user_id: str
5632
+ :param scope: str
5633
+ :param region: str
5634
+ :param resource_type: str
5635
+ :param dimensions: list
5636
+ :param metric_names: list
5637
+ :param timestamp: str
5638
+ :param statistics: list
5639
+ :param cycle: int
5640
+
5641
+ :return:
5642
+ """
5643
+ if len(user_id) <= 0:
5644
+ raise ValueError("user_id should not be null")
5645
+ if len(scope) <= 0:
5646
+ raise ValueError("scope should not be null")
5647
+ if metric_names is None:
5648
+ raise ValueError("metric_names should not be null")
5649
+ if len(dimensions) > MAX_INSTANCE_NUMBER:
5650
+ raise ValueError("dimensions size cannot more than " + MAX_INSTANCE_NUMBER)
5651
+ if cycle is None:
5652
+ cycle = 60
5653
+ body = {
5654
+ "userId": user_id,
5655
+ "scope": scope,
5656
+ "cycle": cycle
5657
+ }
5658
+ metric_names_req = []
5659
+ for res in metric_names:
5660
+ metric_names_req.append(res)
5661
+ body["metricNames"] = metric_names_req
5662
+ if region is not None:
5663
+ body["region"] = region
5664
+ if resource_type is not None:
5665
+ body["resourceType"] = resource_type
5666
+ if dimensions is not None:
5667
+ dimensions_res = []
5668
+ for res in dimensions:
5669
+ dimensions_res.append(res)
5670
+ body["dimensions"] = dimensions_res
5671
+ if timestamp is not None:
5672
+ body["timestamp"] = timestamp
5673
+ if statistics is not None:
5674
+ body["statistics"] = statistics
5675
+ user_id = compat.convert_to_bytes(user_id)
5676
+ scope = compat.convert_to_bytes(scope)
5677
+ path = b'/userId/%s/services/%s/data/metricData/latest/batch' % (user_id, scope)
5678
+ return self._send_csm_request(http_methods.POST, path, version=b'/v2', body=json.dumps(body))
5679
+
5680
+
5681
+ def get_metrics_by_partial_dimensions(self, user_id, scope, statistics, metric_name, start_time, end_time,
5682
+ region=None, resource_type=None, dimensions=None, cycle=None,
5683
+ pageNo=None, pageSize=None):
5684
+ """
5685
+ :param user_id: str
5686
+ :param scope: str
5687
+ :param statistics: list
5688
+ :param metric_name: str
5689
+ :param start_time: str
5690
+ :param end_time: str
5691
+ :param region: str
5692
+ :param resource_type: str
5693
+ :param dimensions: list
5694
+ :param cycle: int
5695
+ :param pageNo: int
5696
+ :param pageSize: int
5697
+
5698
+ :return:
5699
+ """
5700
+ if len(user_id) <= 0:
5701
+ raise ValueError("user_id should not be null")
5702
+ if len(scope) <= 0:
5703
+ raise ValueError("scope should not be null")
5704
+ if len(metric_name) <= 0:
5705
+ raise ValueError("metric_name should not be null")
5706
+ if len(start_time) <= 0:
5707
+ raise ValueError("start_time should not be null")
5708
+ if len(end_time) <= 0:
5709
+ raise ValueError("end_time should not be null")
5710
+ if len(statistics) <= 0:
5711
+ raise ValueError("statistics should not be null")
5712
+ if len(dimensions) > MAX_INSTANCE_NUMBER:
5713
+ raise ValueError("dimensions size cannot more than " + MAX_INSTANCE_NUMBER)
5714
+ body = {
5715
+ "userId": user_id,
5716
+ "scope": scope,
5717
+ "startTime": start_time,
5718
+ "endTime": end_time,
5719
+ "statistics": statistics,
5720
+ "metricName": metric_name
5721
+ }
5722
+ if region is not None:
5723
+ body["region"] = region
5724
+ if resource_type is not None:
5725
+ body["resourceType"] = resource_type
5726
+ if dimensions is not None:
5727
+ dimensions_res = []
5728
+ for res in dimensions:
5729
+ dimensions_res.append(res)
5730
+ body["dimensions"] = dimensions_res
5731
+ if cycle is not None:
5732
+ body["cycle"] = cycle
5733
+ if pageNo is not None:
5734
+ body["pageNo"] = pageNo
5735
+ if pageSize is not None:
5736
+ body["pageSize"] = pageSize
5737
+ user_id = compat.convert_to_bytes(user_id)
5738
+ scope = compat.convert_to_bytes(scope)
5739
+ path = b'/userId/%s/services/%s/data/metricData/PartialDimension' % (user_id, scope)
5740
+ return self._send_csm_request(http_methods.POST, path, version=b'/v2', body=json.dumps(body))
5741
+
5742
+ def get_all_data_metrics_v2(self, user_id, scope, region, dimensions, metric_names, statistics,
5743
+ start_time, end_time, type="Instance", cycle=60):
5744
+
5745
+ """
5746
+ :param user_id: user_id
5747
+ :type string
5748
+
5749
+ :param scope: scope
5750
+ :type string
5751
+
5752
+ :param region: region
5753
+ :type string
5754
+
5755
+ :param type: resource type
5756
+ :type string
5757
+
5758
+ :param dimensions: dimensions
5759
+ :type double string array
5760
+
5761
+ :param metric_names: metric names
5762
+ :type string array
5763
+
5764
+ :param statistics: statistics
5765
+ :type string array
5766
+
5767
+ :param cycle: cycle
5768
+ :type int
5769
+
5770
+ :param start_time: start time
5771
+ :type string
5772
+
5773
+ :param end_time: end time
5774
+ :type string
5775
+ :return:
5776
+ """
5777
+ if len(user_id) <= 0:
5778
+ raise ValueError("user_id should not be null")
5779
+ if len(scope) <= 0:
5780
+ raise ValueError("scope should not be null")
5781
+ if len(region) <= 0:
5782
+ raise ValueError("region should not be null")
5783
+ if metric_names is None:
5784
+ raise ValueError("metric_names should not be null")
5785
+ if dimensions is None:
5786
+ raise ValueError("dimensions should not be null")
5787
+ if statistics is None:
5788
+ raise ValueError("statistics should not be null")
5789
+ if len(dimensions) > MAX_INSTANCE_NUMBER:
5790
+ raise ValueError("dimensions size cannot more than " + MAX_INSTANCE_NUMBER)
5791
+ body = {
5792
+ "userId": user_id,
5793
+ "scope": scope,
5794
+ "cycle": cycle,
5795
+ "region": region,
5796
+ "startTime": start_time,
5797
+ "endTime": end_time,
5798
+ "metricNames": metric_names,
5799
+ "dimensions": dimensions,
5800
+ "statistics": statistics
5801
+ }
5802
+ if type is not None:
5803
+ body["type"] = type
5804
+
5805
+ path = b'/data/metricAllData'
5806
+ return self._send_csm_request(http_methods.POST, path, version=b'/v2', body=json.dumps(body))
5807
+
5808
+ def batch_get_all_data_metrics_v2(self, user_id, scope, region, dimensions, metric_names, statistics,
5809
+ start_time, end_time, type="Instance", cycle=60):
5810
+
5811
+ """
5812
+ :param user_id: user_id
5813
+ :type string
5814
+
5815
+ :param scope: scope
5816
+ :type string
5817
+
5818
+ :param region: region
5819
+ :type string
5820
+
5821
+ :param dimensions: dimensions
5822
+ :type double dimensional dict array
5823
+
5824
+ :param metric_names: metric names
5825
+ :type string array
5826
+
5827
+ :param statistics: statistics
5828
+ :type string array
5829
+
5830
+ :param start_time: start time
5831
+ :type string
5832
+
5833
+ :param end_time: end time
5834
+ :type string
5835
+
5836
+ :param type: type
5837
+ :type string
5838
+
5839
+ :param cycle: cycle
5840
+ :type int
5841
+ :return:
5842
+ """
5843
+ if len(user_id) <= 0:
5844
+ raise ValueError("user_id should not be null")
5845
+ if len(scope) <= 0:
5846
+ raise ValueError("scope should not be null")
5847
+ if len(region) <= 0:
5848
+ raise ValueError("region should not be null")
5849
+ if len(metric_names) <= 0:
5850
+ raise ValueError("metric_names should not be null")
5851
+ if len(dimensions) <= 0:
5852
+ raise ValueError("dimensions should not be null")
5853
+ if len(statistics) <= 0:
5854
+ raise ValueError("statistics should not be null")
5855
+ if len(dimensions) > MAX_INSTANCE_NUMBER:
5856
+ raise ValueError("dimensions size cannot more than " + MAX_INSTANCE_NUMBER)
5857
+ body = {
5858
+ "userId": user_id,
5859
+ "scope": scope,
5860
+ "cycle": cycle,
5861
+ "region": region,
5862
+ "startTime": start_time,
5863
+ "endTime": end_time,
5864
+ "metricNames": metric_names,
5865
+ "dimensions": dimensions,
5866
+ "statistics": statistics
5867
+ }
5868
+ if type is not None:
5869
+ body["type"] = type
5870
+
5871
+ path = b'/data/metricAllData/batch'
5872
+ return self._send_csm_request(http_methods.POST, path, version=b'/v2', body=json.dumps(body))
5873
+
5874
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bce-python-sdk
3
- Version: 0.9.5
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=N7KCV8AH2ZEDgPkHudFw9lvPOJZXNxtg6EmTkyeHrI4,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,15 +24,15 @@ 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=AakHV-83Y6Rt67lyfKsFb322amnZuPFOh-HfqFSB1Zk,232505
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
34
34
  baidubce/services/bcm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- baidubce/services/bcm/bcm_client.py,sha256=NFX4O57LO97x8EcHligkPOCblXyDJrQgPVwn5kiMuaY,200495
35
+ baidubce/services/bcm/bcm_client.py,sha256=XMlto3h2u0wxwfSeQNjqbbLgFMAnIyVK6Y_8agtr9zM,209237
36
36
  baidubce/services/bcm/bcm_handler.py,sha256=UK_wuEykhXHIFSQr-5mcIvXf356xvPnju2XiN7U7GsM,3315
37
37
  baidubce/services/bcm/bcm_model.py,sha256=cJKyuS9c4Lf_4j0Nl8ECjoWBLN31qDiT0eKbMcxlZtA,22095
38
38
  baidubce/services/bes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.5.dist-info/METADATA,sha256=CLSJyCzdWq7taf8IZZ8IrF0qLOx_vX2WtC3JdmPsah0,318
170
- bce_python_sdk-0.9.5.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
171
- bce_python_sdk-0.9.5.dist-info/top_level.txt,sha256=Oh6eo_-T_AuEDpIaR54biUUPThxsoQiYMVHLBTaweQs,9
172
- bce_python_sdk-0.9.5.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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5