bce-python-sdk 0.9.76__py3-none-any.whl → 0.9.79__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.76'
21
+ SDK_VERSION = b'0.9.79'
22
22
  DEFAULT_SERVICE_DOMAIN = b'bcebos.com'
23
23
  URL_PREFIX = b'/v1'
24
24
  DEFAULT_ENCODING = 'UTF-8'
@@ -3241,6 +3241,172 @@ class BccClient(bce_base_client.BceBaseClient):
3241
3241
  path = b'/snapshot/%s' % snapshot_id
3242
3242
  return self._send_request(http_methods.DELETE, path, config=config)
3243
3243
 
3244
+ @required(instance_id=(bytes, str), # ***Unicode***
3245
+ name=(bytes, str)) # ***Unicode***
3246
+ def create_instance_snapshot(self,
3247
+ instance_id,
3248
+ name,
3249
+ desc=None,
3250
+ volumes=None,
3251
+ retention_in_days=None,
3252
+ res_group_id=None,
3253
+ tags=None,
3254
+ config=None):
3255
+ """
3256
+ Creating an instance snapshot (a consistent snapshot group) for the specified instance.
3257
+ All the parameters are carried by the JSON request body instead of the query string.
3258
+ This is an asynchronous interface,
3259
+ you can get the latest status by BccClient.list_instance_snapshot.
3260
+
3261
+ :param instance_id:
3262
+ The id of the instance which the instance snapshot will be created from.
3263
+ :type instance_id: string
3264
+
3265
+ :param name:
3266
+ The name for the instance snapshot that will be created.
3267
+ :type name: string
3268
+
3269
+ :param desc:
3270
+ The optional parameter to describe the information of the new instance snapshot.
3271
+ :type desc: string
3272
+
3273
+ :param volumes:
3274
+ The optional list of the volume id to be included in the instance snapshot.
3275
+ If it's not specified, all the volumes of the instance will be included.
3276
+ :type volumes: list<string>
3277
+
3278
+ :param retention_in_days:
3279
+ The optional parameter to specify how many days the instance snapshot will be retained.
3280
+ :type retention_in_days: int
3281
+
3282
+ :param res_group_id:
3283
+ The optional parameter to specify the id of the resource group.
3284
+ :type res_group_id: string
3285
+
3286
+ :param tags:
3287
+ The optional list of tag to be bonded.
3288
+ :type tags: list<bcc_model.TagModel>
3289
+
3290
+ :return:
3291
+ The response body contains inSnapshotId(string) and snapshotIds(list<string>).
3292
+ :rtype baidubce.bce_response.BceResponse
3293
+ """
3294
+ path = b'/snapshot/insnap/create'
3295
+ body = {
3296
+ 'instanceId': instance_id,
3297
+ 'name': name
3298
+ }
3299
+ if desc is not None:
3300
+ body['desc'] = desc
3301
+ if volumes is not None:
3302
+ body['volumes'] = volumes
3303
+ if retention_in_days is not None:
3304
+ body['retentionInDays'] = retention_in_days
3305
+ if res_group_id is not None:
3306
+ body['resGroupId'] = res_group_id
3307
+ if tags is not None:
3308
+ tag_list = [tag if isinstance(tag, dict) else tag.__dict__ for tag in tags]
3309
+ body['tags'] = tag_list
3310
+ return self._send_request(http_methods.POST, path, json.dumps(body), config=config)
3311
+
3312
+ @required(delete_insnap_ids=list)
3313
+ def delete_instance_snapshot(self, delete_insnap_ids, config=None):
3314
+ """
3315
+ Deleting the specified instance snapshots.
3316
+ All the parameters are carried by the JSON request body instead of the query string.
3317
+ There is no response body for this interface.
3318
+
3319
+ :param delete_insnap_ids:
3320
+ The list of the instance snapshot id which will be deleted.
3321
+ :type delete_insnap_ids: list<string>
3322
+
3323
+ :return:
3324
+ :rtype baidubce.bce_response.BceResponse
3325
+ """
3326
+ path = b'/snapshot/insnap/delete'
3327
+ body = {
3328
+ 'deleteInsnapIds': delete_insnap_ids
3329
+ }
3330
+ return self._send_request(http_methods.POST, path, json.dumps(body), config=config)
3331
+
3332
+ @required(name=(bytes, str)) # ***Unicode***
3333
+ def rename_instance_snapshot(self, insnap_ids, name, config=None):
3334
+ """
3335
+ Renaming the specified instance snapshots.
3336
+ All the parameters are carried by the JSON request body instead of the query string.
3337
+ There is no response body for this interface.
3338
+
3339
+ :param insnap_ids:
3340
+ The list of the instance snapshot id which will be renamed.
3341
+ :type insnap_ids: list<string>
3342
+
3343
+ :param name:
3344
+ The new name for the specified instance snapshots.
3345
+ :type name: string
3346
+
3347
+ :return:
3348
+ :rtype baidubce.bce_response.BceResponse
3349
+ """
3350
+ path = b'/snapshot/insnap/rename'
3351
+ body = {
3352
+ 'name': name
3353
+ }
3354
+ if insnap_ids is not None:
3355
+ body['insnapIds'] = insnap_ids
3356
+ return self._send_request(http_methods.POST, path, json.dumps(body), config=config)
3357
+
3358
+ def list_instance_snapshot(self, marker=None, max_keys=None, instance_ids=None,
3359
+ instance_snapshot_ids=None, config=None):
3360
+ """
3361
+ Listing the instance snapshots owned by the authenticated user.
3362
+ All the parameters, including marker and maxKeys, are carried by the JSON
3363
+ request body instead of the query string.
3364
+
3365
+ :param marker:
3366
+ The optional parameter marker specified in the original request to specify
3367
+ where in the results to begin listing.
3368
+ Together with the marker, specifies the list result which listing should begin.
3369
+ If the marker is not specified, the list result will listing from the first one.
3370
+ :type marker: string
3371
+
3372
+ :param max_keys:
3373
+ The optional parameter to specifies the max number of list result to return.
3374
+ :type max_keys: int
3375
+
3376
+ :param instance_ids:
3377
+ The optional list of the instance id used to filter the result.
3378
+ :type instance_ids: list<string>
3379
+
3380
+ :param instance_snapshot_ids:
3381
+ The optional list of the instance snapshot id used to filter the result.
3382
+ :type instance_snapshot_ids: list<string>
3383
+
3384
+ :return:
3385
+ The response body contains marker(string), isTruncated(bool),
3386
+ nextMarker(string), maxKeys(int) and instanceSnapshots(list).
3387
+ Every item of instanceSnapshots contains instanceSnapshotId,
3388
+ instanceSnapshotName, instanceSnapshotSizeInGiB, createdTime,
3389
+ instanceSnapshotStatus, instanceId and snapshots(list).
3390
+ Every item of snapshots contains snapshotId, snapshotName,
3391
+ snapshotSizeInGiB, snapshotStatus, volumeId, instanceSnapshotId,
3392
+ creationMethod, description, createdTime, expiredTime, encrypted,
3393
+ imageId, includeDataVolumes, progress and tags. Attention:
3394
+ includeDataVolumes, progress and tags are always null because they are
3395
+ not returned by this interface.
3396
+ :rtype baidubce.bce_response.BceResponse
3397
+ """
3398
+ path = b'/snapshot/insnap/list'
3399
+ body = {}
3400
+ if marker is not None:
3401
+ body['marker'] = marker
3402
+ if max_keys is not None:
3403
+ body['maxKeys'] = max_keys
3404
+ if instance_ids is not None:
3405
+ body['instanceIds'] = instance_ids
3406
+ if instance_snapshot_ids is not None:
3407
+ body['instanceSnapshotIds'] = instance_snapshot_ids
3408
+ return self._send_request(http_methods.POST, path, json.dumps(body), config=config)
3409
+
3244
3410
  @required(name=(bytes, str), # ***Unicode***
3245
3411
  rules=list)
3246
3412
  def create_security_group(self,
@@ -207,3 +207,48 @@ class FileSystemModel(object):
207
207
  self.mountAds = mountAds
208
208
  self.path = path
209
209
  self.protocol = protocol
210
+
211
+
212
+ class InstanceSnapshotStatus(object):
213
+ """
214
+ This class define the status of an instance snapshot (consistent snapshot group).
215
+
216
+ Attention: it is a totally different enum from SnapshotStatus which is used by
217
+ the sub snapshots inside the group. This one keeps the raw lowercase values
218
+ returned by the server, and note that ERROR_DELETING is the only one spelled
219
+ with an underline.
220
+ """
221
+ CREATING = 'creating'
222
+ ACTIVE = 'active'
223
+ ROLLBACK = 'rollback'
224
+ ERROR_ROLLBACK = 'errorRollback'
225
+ DELETING = 'deleting'
226
+ ERROR_DELETING = 'error_deleting'
227
+ ERROR_DELETE = 'errorDelete'
228
+ DELETED = 'deleted'
229
+ ERROR = 'error'
230
+ UNKNOWN = 'unknown'
231
+
232
+
233
+ class SnapshotStatus(object):
234
+ """
235
+ This class define the status of a single volume snapshot, which is used by the
236
+ sub snapshots (the "snapshots" field) inside an instance snapshot group.
237
+
238
+ Attention: the values are capitalized, they do NOT overlap with
239
+ InstanceSnapshotStatus.
240
+ """
241
+ AVAILABLE = 'Available'
242
+ CREATING = 'Creating'
243
+ NOT_AVAILABLE = 'NotAvailable'
244
+ CREATED_FAILED = 'CreatedFailed'
245
+
246
+
247
+ class SnapshotCreationMethod(object):
248
+ """
249
+ This class define how a snapshot was created.
250
+ """
251
+ MANUAL = 'MANUAL'
252
+ AUTO = 'AUTO'
253
+ MIGRATION = 'MIGRATION'
254
+ UNKNOWN = 'UNKNOWN'
@@ -381,6 +381,11 @@ class DuMemoryClient(object):
381
381
  bank_id=bank_id,
382
382
  **self._kw(**self._options_kwargs(options))))
383
383
 
384
+ def get_operation_status(self, bank_id, operation_id):
385
+ """GET /v1/default/banks/{bankId}/operations/{operationId}."""
386
+ return _run_async(self._operations.get_operation_status(
387
+ bank_id=bank_id, operation_id=operation_id, **self._kw()))
388
+
384
389
  def cancel_operation(self, bank_id, operation_id):
385
390
  """DELETE /v1/default/banks/{bankId}/operations/{operationId}."""
386
391
  return _run_async(self._operations.cancel_operation(
@@ -139,7 +139,7 @@ def _install_hindsight_stubs():
139
139
  "update_directive", "delete_directive",
140
140
  ]),
141
141
  "operations_api": ("OperationsApi", [
142
- "list_operations", "cancel_operation",
142
+ "list_operations", "get_operation_status", "cancel_operation",
143
143
  ]),
144
144
  "entities_api": ("EntitiesApi", [
145
145
  "list_entities", "get_entity_graph",
@@ -608,6 +608,16 @@ class OperationsTest(unittest.TestCase):
608
608
  self.assertEqual(kw["status"], "pending")
609
609
  self.assertEqual(kw["limit"], 5)
610
610
 
611
+ def test_get_operation_status(self):
612
+ """Verify get operation status behavior."""
613
+ cli = _new_client()
614
+ cli.get_operation_status("b", "op")
615
+ api, method, kw = _last_call()
616
+ self.assertEqual((api, method),
617
+ ("OperationsApi", "get_operation_status"))
618
+ self.assertEqual(kw["bank_id"], "b")
619
+ self.assertEqual(kw["operation_id"], "op")
620
+
611
621
  def test_cancel_operation(self):
612
622
  """Verify cancel operation behavior."""
613
623
  cli = _new_client()
@@ -911,7 +921,7 @@ class CoverageTest(unittest.TestCase):
911
921
  "refresh_mental_model",
912
922
  "list_directives", "create_directive", "get_directive",
913
923
  "update_directive", "delete_directive",
914
- "list_operations", "cancel_operation",
924
+ "list_operations", "get_operation_status", "cancel_operation",
915
925
  "files_retain",
916
926
  "retain_with_scope", "recall_with_scope", "reflect_with_scope",
917
927
  "get_memory_with_scope", "list_tags_with_scope",
File without changes
@@ -0,0 +1,651 @@
1
+ # Copyright (c) 2014 Baidu.com, Inc. All Rights Reserved
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
4
+ # except in compliance with the License. You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software distributed under the
9
+ # License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
10
+ # either express or implied. See the License for the specific language governing permissions
11
+ # and limitations under the License.
12
+
13
+ """
14
+ This module provides a client class for EO.
15
+ """
16
+
17
+ import copy
18
+ import json
19
+ import logging
20
+ import baidubce
21
+
22
+ from baidubce import bce_base_client
23
+ from baidubce.auth import bce_v1_signer
24
+ from baidubce.http import bce_http_client
25
+ from baidubce.http import handler
26
+ from baidubce.http import http_content_types
27
+ from baidubce.http import http_headers
28
+ from baidubce.http import http_methods
29
+ from baidubce.exception import BceClientError
30
+ from baidubce.exception import BceServerError
31
+ from baidubce.utils import required
32
+ from baidubce import utils
33
+
34
+ _logger = logging.getLogger(__name__)
35
+
36
+
37
+ class EoClient(bce_base_client.BceBaseClient):
38
+ """
39
+ EoClient
40
+ """
41
+ prefix = b"/v2/geo"
42
+
43
+ def __init__(self, config=None):
44
+ bce_base_client.BceBaseClient.__init__(self, config)
45
+
46
+ @required(tasks=list, site=str)
47
+ def purge(self, tasks, site, config=None):
48
+ """
49
+ purge the cache of specified url or directory
50
+ :param tasks: url or directory list to purge
51
+ :type tasks: list
52
+ :param site: the site of the purge tasks
53
+ :type site: string
54
+ :param config: None
55
+ :type config: baidubce.BceClientConfiguration
56
+
57
+ :return:
58
+ :rtype: baidubce.bce_response.BceResponse
59
+ """
60
+ body = {}
61
+ body['tasks'] = tasks
62
+ body['site'] = site
63
+ return self._send_request(
64
+ http_methods.POST, '/cache/purge',
65
+ config=config, body=json.dumps(body))
66
+
67
+ @required(site=str)
68
+ def list_purge_tasks(self, site, id=None, startTime=None,
69
+ endTime=None, type=None, marker=None, config=None):
70
+ """
71
+ query the status of purge tasks
72
+ :param site: the site of the purge tasks
73
+ :type site: string
74
+ :param id: purge task id to query
75
+ :type id: string
76
+ :param startTime: query start time
77
+ :type startTime: Timestamp
78
+ :param endTime: query end time
79
+ :type endTime: Timestamp
80
+ :param type: purge type to query, 'url' or 'directory'
81
+ :type type: string
82
+ :param marker: 'nextMarker' get from last query
83
+ :type marker: string
84
+ :param config: None
85
+ :type config: baidubce.BceClientConfiguration
86
+
87
+ :return:
88
+ :rtype: baidubce.bce_response.BceResponse
89
+ """
90
+ params = {}
91
+ params['site'] = site
92
+ params['id'] = id
93
+ if startTime is not None:
94
+ params['startTime'] = startTime
95
+
96
+ if endTime is not None:
97
+ params['endTime'] = endTime
98
+
99
+ params['type'] = type
100
+ params['marker'] = marker
101
+
102
+ return self._send_request(
103
+ http_methods.GET, '/cache/purge',
104
+ params=params,
105
+ config=config)
106
+
107
+ @required(tasks=list, site=str)
108
+ def prefetch(self, tasks, site, config=None):
109
+ """
110
+ prefetch the source of specified url from origin
111
+ :param tasks: url list need prefetch
112
+ :type tasks: list
113
+ :param site: the site of the prefetch tasks
114
+ :type site: string
115
+ :param config: None
116
+ :type config: baidubce.BceClientConfiguration
117
+
118
+ :return:
119
+ :rtype: baidubce.bce_response.BceResponse
120
+ """
121
+ body = {}
122
+ body['tasks'] = tasks
123
+ body['site'] = site
124
+ return self._send_request(
125
+ http_methods.POST,
126
+ '/cache/prefetch',
127
+ config=config, body=json.dumps(body))
128
+
129
+ @required(site=str)
130
+ def list_prefetch_tasks(self, site, id=None, startTime=None,
131
+ endTime=None, marker=None, config=None):
132
+ """
133
+ query the status of prefetch tasks
134
+ :param site: the site of the prefetch tasks
135
+ :type site: string
136
+ :param id: prefetch task id to query
137
+ :type id: string
138
+ :param startTime: query start time
139
+ :type startTime: Timestamp
140
+ :param endTime: query end time
141
+ :type endTime: Timestamp
142
+ :param marker: 'nextMarker' get from last query
143
+ :type marker: string
144
+ :param config: None
145
+ :type config: baidubce.BceClientConfiguration
146
+
147
+ :return:
148
+ :rtype: baidubce.bce_response.BceResponse
149
+ """
150
+ params = {}
151
+ params['site'] = site
152
+ params['id'] = id
153
+ if startTime is not None:
154
+ params['startTime'] = startTime
155
+
156
+ if endTime is not None:
157
+ params['endTime'] = endTime
158
+
159
+ params['marker'] = marker
160
+
161
+ return self._send_request(
162
+ http_methods.GET, '/cache/prefetch',
163
+ params=params,
164
+ config=config)
165
+
166
+ @required(site=str)
167
+ def get_domain_log(self, site, startTime=None, endTime=None,
168
+ domainList=None, pageNo=None, pageSize=None, config=None):
169
+ """
170
+ get the download url of the offline log of one or more domains of a site
171
+ :param site: the site of the domains
172
+ :type site: string
173
+ :param startTime: query start time
174
+ :type startTime: Timestamp
175
+ :param endTime: query end time
176
+ :type endTime: Timestamp
177
+ :param domainList: the domain list to query
178
+ :type domainList: list
179
+ :param pageNo: page number, default is 1
180
+ :type pageNo: int
181
+ :param pageSize: log number per page, default is 20
182
+ :type pageSize: int
183
+ :param config: None
184
+ :type config: baidubce.BceClientConfiguration
185
+
186
+ :return:
187
+ :rtype: baidubce.bce_response.BceResponse
188
+ """
189
+ body = {}
190
+ body['site'] = site
191
+ if startTime is not None:
192
+ body['startTime'] = startTime
193
+
194
+ if endTime is not None:
195
+ body['endTime'] = endTime
196
+
197
+ if domainList is not None:
198
+ body['domainList'] = domainList
199
+
200
+ if pageNo is not None:
201
+ body['pageNo'] = pageNo
202
+
203
+ if pageSize is not None:
204
+ body['pageSize'] = pageSize
205
+
206
+ return self._send_request(
207
+ http_methods.POST, '/log',
208
+ config=config, body=json.dumps(body))
209
+
210
+ @required(metrics=list)
211
+ def stat(self, metrics, startTime=None, endTime=None, showType=None,
212
+ group=None, filter=None, limit=None, config=None):
213
+ """
214
+ query the statistic metrics of a site or domain
215
+ :param metrics: metric type list, e.g. 'sum_bps', 'sum_flow', 'pv'
216
+ :type metrics: list
217
+ :param startTime: query start time
218
+ :type startTime: Timestamp
219
+ :param endTime: query end time
220
+ :type endTime: Timestamp
221
+ :param showType: show type, 'peak', 'time', 'sum' or 'top', default 'time'
222
+ :type showType: string
223
+ :param group: group fields, e.g. 'code', 'host', 'ip'
224
+ :type group: list
225
+ :param filter: filter items, each is a dict of key/value/operation
226
+ :type filter: list
227
+ :param limit: limit field, e.g. {'pageSize': 100}
228
+ :type limit: dict
229
+ :param config: None
230
+ :type config: baidubce.BceClientConfiguration
231
+
232
+ :return:
233
+ :rtype: baidubce.bce_response.BceResponse
234
+ """
235
+ body = {}
236
+ body['metrics'] = metrics
237
+ if startTime is not None:
238
+ body['startTime'] = startTime
239
+
240
+ if endTime is not None:
241
+ body['endTime'] = endTime
242
+
243
+ if showType is not None:
244
+ body['showType'] = showType
245
+
246
+ if group is not None:
247
+ body['group'] = group
248
+
249
+ if filter is not None:
250
+ body['filter'] = filter
251
+
252
+ if limit is not None:
253
+ body['limit'] = limit
254
+
255
+ return self._send_request(
256
+ http_methods.POST, '/stat',
257
+ config=config, body=json.dumps(body))
258
+
259
+ @required(site=str, cacheTtl=list)
260
+ def set_site_config(self, site, cacheTtl, config=None):
261
+ """
262
+ set the node cache config of a site
263
+ :param site: the site to set config
264
+ :type site: string
265
+ :param cacheTtl: the cache rules of the node
266
+ :type cacheTtl: list
267
+ :param config: None
268
+ :type config: baidubce.BceClientConfiguration
269
+
270
+ :return:
271
+ :rtype: baidubce.bce_response.BceResponse
272
+ """
273
+ body = {}
274
+ body['cacheTtl'] = cacheTtl
275
+ return self._send_request(
276
+ http_methods.PUT,
277
+ '/site/' + site + '/config',
278
+ config=config, body=json.dumps(body))
279
+
280
+ @required(site=str)
281
+ def get_site_config(self, site, config=None):
282
+ """
283
+ get the node cache config of a site
284
+ :param site: the site to query
285
+ :type site: string
286
+ :param config: None
287
+ :type config: baidubce.BceClientConfiguration
288
+
289
+ :return:
290
+ :rtype: baidubce.bce_response.BceResponse
291
+ """
292
+ return self._send_request(
293
+ http_methods.GET,
294
+ '/site/' + site + '/config',
295
+ config=config)
296
+
297
+ @required(site=str, keys=list)
298
+ def get_site_config_items(self, site, keys, config=None):
299
+ """
300
+ get the specified config items of a site.
301
+ :param site: the site to query
302
+ :type site: string
303
+ :param keys: the config item keys to return, in api style, e.g. ['cacheTtl']
304
+ :type keys: list
305
+ :param config: None
306
+ :type config: baidubce.BceClientConfiguration
307
+
308
+ :return: a dict mapping each requested key to its config value
309
+ :rtype: dict
310
+ """
311
+ response = self.get_site_config(site, config=config)
312
+ result = {}
313
+ for key in keys:
314
+ attr = utils.pythonize_name(key)
315
+ if attr in response.__dict__:
316
+ result[key] = response.__dict__[attr]
317
+ return result
318
+
319
+ @required(site=str, cacheKey=dict)
320
+ def set_site_cache_key(self, site, cacheKey, config=None):
321
+ """
322
+ set the query string (cache key) config of a site
323
+ :param site: the site to set config
324
+ :type site: string
325
+ :param cacheKey: the query string config, e.g. {'query': True}
326
+ :type cacheKey: dict
327
+ :param config: None
328
+ :type config: baidubce.BceClientConfiguration
329
+
330
+ :return:
331
+ :rtype: baidubce.bce_response.BceResponse
332
+ """
333
+ body = {}
334
+ body['cacheKey'] = cacheKey
335
+ return self._send_request(
336
+ http_methods.PUT,
337
+ '/site/' + site + '/config',
338
+ config=config, body=json.dumps(body))
339
+
340
+ @required(site=str, offlineMode=str)
341
+ def set_site_offline_mode(self, site, offlineMode, config=None):
342
+ """
343
+ set the offline mode config of a site
344
+ :param site: the site to set config
345
+ :type site: string
346
+ :param offlineMode: 'ON' to enable offline mode, 'OFF' to disable
347
+ :type offlineMode: string
348
+ :param config: None
349
+ :type config: baidubce.BceClientConfiguration
350
+
351
+ :return:
352
+ :rtype: baidubce.bce_response.BceResponse
353
+ """
354
+ body = {}
355
+ body['offlineMode'] = offlineMode
356
+ return self._send_request(
357
+ http_methods.PUT,
358
+ '/site/' + site + '/config',
359
+ config=config, body=json.dumps(body))
360
+
361
+ @required(site=str, httpToHttpsEnabled=str)
362
+ def set_site_https_redirect(self, site, httpToHttpsEnabled,
363
+ httpToHttpsCode=None, config=None):
364
+ """
365
+ set the force https redirect config of a site
366
+ :param site: the site to set config
367
+ :type site: string
368
+ :param httpToHttpsEnabled: 'ON' to enable force https redirect, 'OFF' to disable
369
+ :type httpToHttpsEnabled: string
370
+ :param httpToHttpsCode: redirect status code, '301' or '302',
371
+ invalid when httpToHttpsEnabled is 'OFF'
372
+ :type httpToHttpsCode: string
373
+ :param config: None
374
+ :type config: baidubce.BceClientConfiguration
375
+
376
+ :return:
377
+ :rtype: baidubce.bce_response.BceResponse
378
+ """
379
+ body = {}
380
+ body['httpToHttpsEnabled'] = httpToHttpsEnabled
381
+ if httpToHttpsCode is not None:
382
+ body['httpToHttpsCode'] = httpToHttpsCode
383
+
384
+ return self._send_request(
385
+ http_methods.PUT,
386
+ '/site/' + site + '/config',
387
+ config=config, body=json.dumps(body))
388
+
389
+ @required(site=str, hsts=dict)
390
+ def set_site_hsts(self, site, hsts, config=None):
391
+ """
392
+ set the hsts config of a site
393
+ :param site: the site to set config
394
+ :type site: string
395
+ :param hsts: the hsts config
396
+ :type hsts: dict
397
+ :param config: None
398
+ :type config: baidubce.BceClientConfiguration
399
+
400
+ :return:
401
+ :rtype: baidubce.bce_response.BceResponse
402
+ """
403
+ body = {}
404
+ body['hsts'] = hsts
405
+ return self._send_request(
406
+ http_methods.PUT,
407
+ '/site/' + site + '/config',
408
+ config=config, body=json.dumps(body))
409
+
410
+ @required(site=str, clientMaxBodySize=str)
411
+ def set_site_client_max_body_size(self, site, clientMaxBodySize, config=None):
412
+ """
413
+ set the max upload body size config of a site
414
+ :param site: the site to set config
415
+ :type site: string
416
+ :param clientMaxBodySize: the max upload size
417
+ :type clientMaxBodySize: string
418
+ :param config: None
419
+ :type config: baidubce.BceClientConfiguration
420
+
421
+ :return:
422
+ :rtype: baidubce.bce_response.BceResponse
423
+ """
424
+ body = {}
425
+ body['clientMaxBodySize'] = clientMaxBodySize
426
+ return self._send_request(
427
+ http_methods.PUT,
428
+ '/site/' + site + '/config',
429
+ config=config, body=json.dumps(body))
430
+
431
+ @required(site=str, compress=str, compressMethodArray=list)
432
+ def set_site_compress(self, site, compress, compressMethodArray, config=None):
433
+ """
434
+ set the page compress config of a site
435
+ :param site: the site to set config
436
+ :type site: string
437
+ :param compress: 'ON' to enable page compress, 'OFF' to disable
438
+ :type compress: string
439
+ :param compressMethodArray: the compress methods, e.g. ['gzip', 'br']
440
+ :type compressMethodArray: list
441
+ :param config: None
442
+ :type config: baidubce.BceClientConfiguration
443
+
444
+ :return:
445
+ :rtype: baidubce.bce_response.BceResponse
446
+ """
447
+ body = {}
448
+ body['compress'] = compress
449
+ body['compressMethodArray'] = compressMethodArray
450
+ return self._send_request(
451
+ http_methods.PUT,
452
+ '/site/' + site + '/config',
453
+ config=config, body=json.dumps(body))
454
+
455
+ @required(site=str, isa=str)
456
+ def set_site_isa(self, site, isa, config=None):
457
+ """
458
+ set the intelligent acceleration config of a site
459
+ :param site: the site to set config
460
+ :type site: string
461
+ :param isa: 'ON' to enable intelligent acceleration, 'OFF' to disable
462
+ :type isa: string
463
+ :param config: None
464
+ :type config: baidubce.BceClientConfiguration
465
+
466
+ :return:
467
+ :rtype: baidubce.bce_response.BceResponse
468
+ """
469
+ body = {}
470
+ body['isa'] = isa
471
+ return self._send_request(
472
+ http_methods.PUT,
473
+ '/site/' + site + '/config',
474
+ config=config, body=json.dumps(body))
475
+
476
+ @required(site=str, httpHeader=list)
477
+ def set_site_http_header(self, site, httpHeader, config=None):
478
+ """
479
+ set the custom http header config of a site.
480
+ Note: this is a full-replace interface, the existing header settings
481
+ must be included together, otherwise they will be overwritten.
482
+ :param site: the site to set config
483
+ :type site: string
484
+ :param httpHeader: the custom http header config, each item is a dict of
485
+ type/header/value/action
486
+ :type httpHeader: list
487
+ :param config: None
488
+ :type config: baidubce.BceClientConfiguration
489
+
490
+ :return:
491
+ :rtype: baidubce.bce_response.BceResponse
492
+ """
493
+ body = {}
494
+ body['httpHeader'] = httpHeader
495
+ return self._send_request(
496
+ http_methods.PUT,
497
+ '/site/' + site + '/config',
498
+ config=config, body=json.dumps(body))
499
+
500
+ @required(site=str, cacheCodeTtl=list)
501
+ def set_site_cache_code_ttl(self, site, cacheCodeTtl, config=None):
502
+ """
503
+ set the status code cache config of a site
504
+ :param site: the site to set config
505
+ :type site: string
506
+ :param cacheCodeTtl: the status code cache rules, each item is a dict of
507
+ value/weight/overrideOrigin/ttl/type
508
+ :type cacheCodeTtl: list
509
+ :param config: None
510
+ :type config: baidubce.BceClientConfiguration
511
+
512
+ :return:
513
+ :rtype: baidubce.bce_response.BceResponse
514
+ """
515
+ body = {}
516
+ body['cacheCodeTtl'] = cacheCodeTtl
517
+ return self._send_request(
518
+ http_methods.PUT,
519
+ '/site/' + site + '/config',
520
+ config=config, body=json.dumps(body))
521
+
522
+ @required(site=str, grpcOrigin=str)
523
+ def set_site_grpc_origin(self, site, grpcOrigin, config=None):
524
+ """
525
+ set the grpc origin config of a site
526
+ :param site: the site to set config
527
+ :type site: string
528
+ :param grpcOrigin: 'ON' to enable grpc origin, 'OFF' to disable
529
+ :type grpcOrigin: string
530
+ :param config: None
531
+ :type config: baidubce.BceClientConfiguration
532
+
533
+ :return:
534
+ :rtype: baidubce.bce_response.BceResponse
535
+ """
536
+ body = {}
537
+ body['grpcOrigin'] = grpcOrigin
538
+ return self._send_request(
539
+ http_methods.PUT,
540
+ '/site/' + site + '/config',
541
+ config=config, body=json.dumps(body))
542
+
543
+ @required(site=str, http2Origin=str)
544
+ def set_site_http2_origin(self, site, http2Origin, config=None):
545
+ """
546
+ set the http2 origin config of a site
547
+ :param site: the site to set config
548
+ :type site: string
549
+ :param http2Origin: 'ON' to enable http2 origin, 'OFF' to disable
550
+ :type http2Origin: string
551
+ :param config: None
552
+ :type config: baidubce.BceClientConfiguration
553
+
554
+ :return:
555
+ :rtype: baidubce.bce_response.BceResponse
556
+ """
557
+ body = {}
558
+ body['http2Origin'] = http2Origin
559
+ return self._send_request(
560
+ http_methods.PUT,
561
+ '/site/' + site + '/config',
562
+ config=config, body=json.dumps(body))
563
+
564
+ @required(site=str, pageRules=list)
565
+ def set_site_page_rules(self, site, pageRules, config=None):
566
+ """
567
+ set the rule engine config of a site.
568
+ Note: this is a full-replace interface, the existing rules must be
569
+ included together, otherwise they will be overwritten.
570
+ :param site: the site to set config
571
+ :type site: string
572
+ :param pageRules: the rule engine config, each item is a PageRule dict of
573
+ name/status/rules/config
574
+ :type pageRules: list
575
+ :param config: None
576
+ :type config: baidubce.BceClientConfiguration
577
+
578
+ :return:
579
+ :rtype: baidubce.bce_response.BceResponse
580
+ """
581
+ body = {}
582
+ body['pageRules'] = pageRules
583
+ return self._send_request(
584
+ http_methods.PUT,
585
+ '/site/' + site + '/config',
586
+ config=config, body=json.dumps(body))
587
+
588
+ @required(site=str, http2Disable=str)
589
+ def set_site_http2_disable(self, site, http2Disable, config=None):
590
+ """
591
+ set the http2 config of a site.
592
+ Note: 'ON' means disable http2, 'OFF' means enable http2.
593
+ :param site: the site to set config
594
+ :type site: string
595
+ :param http2Disable: 'ON' to disable http2, 'OFF' to enable http2
596
+ :type http2Disable: string
597
+ :param config: None
598
+ :type config: baidubce.BceClientConfiguration
599
+
600
+ :return:
601
+ :rtype: baidubce.bce_response.BceResponse
602
+ """
603
+ body = {}
604
+ body['http2Disable'] = http2Disable
605
+ return self._send_request(
606
+ http_methods.PUT,
607
+ '/site/' + site + '/config',
608
+ config=config, body=json.dumps(body))
609
+
610
+ @required(site=str, http3=dict)
611
+ def set_site_http3(self, site, http3, config=None):
612
+ """
613
+ set the http3 config of a site
614
+ :param site: the site to set config
615
+ :type site: string
616
+ :param http3: the http3 config, e.g. {'enable': True}
617
+ :type http3: dict
618
+ :param config: None
619
+ :type config: baidubce.BceClientConfiguration
620
+
621
+ :return:
622
+ :rtype: baidubce.bce_response.BceResponse
623
+ """
624
+ body = {}
625
+ body['http3'] = http3
626
+ return self._send_request(
627
+ http_methods.PUT,
628
+ '/site/' + site + '/config',
629
+ config=config, body=json.dumps(body))
630
+
631
+ @staticmethod
632
+ def _merge_config(self, config):
633
+ if config is None:
634
+ return self.config
635
+ else:
636
+ new_config = copy.copy(self.config)
637
+ new_config.merge_non_none_values(config)
638
+ return new_config
639
+
640
+ def _send_request(
641
+ self, http_method, path,
642
+ body=None, headers=None, params=None,
643
+ config=None,
644
+ body_parser=None):
645
+ config = self._merge_config(self, config)
646
+ if body_parser is None:
647
+ body_parser = handler.parse_json
648
+
649
+ return bce_http_client.send_request(
650
+ config, bce_v1_signer.sign, [handler.parse_error, body_parser],
651
+ http_method, utils.append_uri(EoClient.prefix, path), body, headers, params)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bce-python-sdk
3
- Version: 0.9.76
3
+ Version: 0.9.79
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=VEesFRB8ie5cwiMGxT3nJ3WYG7_iz59OWAOT0RY7H-4,813
1
+ baidubce/__init__.py,sha256=7C_vDgIyEkrxCUKqxBbLmAFriLYwX_K93rIh9K9cPbY,813
2
2
  baidubce/bce_base_client.py,sha256=7gjkRy_YlTTb6TXHYHyZRYMjdVO7FTtHMdwXx8bPgsE,3428
3
3
  baidubce/bce_client_configuration.py,sha256=r6DGTdNSjWz857Ae_K1wedrV1WdxZUNmN9xkxYCOC0Y,3478
4
4
  baidubce/bce_response.py,sha256=kcebmFaCG6twa_GSchLGS5CQ5C8B9vV_4WszpbSqYtY,3326
@@ -51,8 +51,8 @@ baidubce/services/bbc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
51
51
  baidubce/services/bbc/bbc_client.py,sha256=6x2fWmjyKSZ02WvsmQ1pryE0c_mtXHCjI0Ev80MfzbY,38951
52
52
  baidubce/services/bbc/bbc_model.py,sha256=Dy80LZ4ro_iS3UejJ_CL9kI7OyMSBoDitTE4J1XAC_g,1790
53
53
  baidubce/services/bcc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- baidubce/services/bcc/bcc_client.py,sha256=WnHxTWNE26wltkIy8giyZH8RbdFEDpSdB8MO3CurNwA,313483
55
- baidubce/services/bcc/bcc_model.py,sha256=xKYC4Z-gxWjFhe8b1AmMBEN_wYhnwcqAmer29ysS17k,6788
54
+ baidubce/services/bcc/bcc_client.py,sha256=WhwpqfynFJthHUz6ocLCf08I07MojuGIOuf_Oqek_Yg,320510
55
+ baidubce/services/bcc/bcc_model.py,sha256=X6d28tefrzuOliSLIzlpT7hZAshGNly9aQ0755hIsZU,8103
56
56
  baidubce/services/bcc/fpga_card_type.py,sha256=n6goqnapIgAC9_sciA_2he5HFqPRbRv109qitO7qpd8,948
57
57
  baidubce/services/bcc/gpu_card_type.py,sha256=HEfMzne-UC5F295JPrPUu7V9F5g-hbXF2TNBontEFes,1054
58
58
  baidubce/services/bcm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -112,9 +112,9 @@ baidubce/services/dns/api/dns_api.py,sha256=SC75uJG-SU8XsnZnNvP0tzI3j-dV-BML4y9s
112
112
  baidubce/services/dumap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
113
  baidubce/services/dumap/dumap_client.py,sha256=1hofadH3WIMbAJZrIld_blz0enc5kSnVHFASnhLlp3s,3955
114
114
  baidubce/services/dumemory/__init__.py,sha256=lWGFhsb6Tpb7qkChqQ0pxUdyW-tLa8x5k5Rc5PkGd38,616
115
- baidubce/services/dumemory/dumemory_client.py,sha256=CzY8Sr7c-oB4GUm5TjQUOBj1j2izAQr4PNZtW5V2e-8,26693
115
+ baidubce/services/dumemory/dumemory_client.py,sha256=opzB4L-7KyIi5aGOeGJK3FNTegseCTwbjnS_8EK0-0U,26960
116
116
  baidubce/services/dumemory/dumemory_model.py,sha256=3WtdkVMZuixWMWMAvsvB3gZx4FfP_wdO2y89IM-sILc,11211
117
- baidubce/services/dumemory/test_dumemory_client.py,sha256=MwlNNpQeKSKEK83MIkkubpLGSyedGFEip69RgL_d44A,38891
117
+ baidubce/services/dumemory/test_dumemory_client.py,sha256=LL0Zg1gfsOs52k1y6kRV1cySJehgQsZCn_37oCcy0Vw,39348
118
118
  baidubce/services/eip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
119
  baidubce/services/eip/eip_bp_client.py,sha256=eUUKJr4jtpQzde4wy7fKl3LeIHhWjb_El0XmAq922b4,13418
120
120
  baidubce/services/eip/eip_client.py,sha256=b6Az9Ywx8gZQmRaQBrEhZ084irZmg_c0eGBMfqz6w-M,36640
@@ -128,6 +128,8 @@ baidubce/services/endpoint/model.py,sha256=Whfo_jYAV8VYPHQ65BFcPycxbjEwsw-PGOdB4
128
128
  baidubce/services/eni/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
129
  baidubce/services/eni/eni_client.py,sha256=OG6Tf3hF1-eXAQmB2go9EovymmdSJf24qjmTige2mjU,26311
130
130
  baidubce/services/eni/eni_model.py,sha256=YQzPCcUdf6AkAEkHwShC9lYC0uVRweC7_s5b6BVuySg,1165
131
+ baidubce/services/eo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
132
+ baidubce/services/eo/eo_client.py,sha256=ThVhK9B-qtLwXLeRuc13jQif6zZKS2h1hgNLeJbZekg,22100
131
133
  baidubce/services/esg/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
132
134
  baidubce/services/esg/esg_client.py,sha256=8nqs7vnLrzaQ43tNSEZ_6tqQDhxu9hdTDu0yVidijJM,15504
133
135
  baidubce/services/esg/esg_model.py,sha256=4QOhtO3QzmwhNxveeVWfnbw9UmUpWPOAQvEbFMUOgj8,4159
@@ -205,7 +207,7 @@ baidubce/services/vpc/vpc_client.py,sha256=hTh_weKp7DzGkYxq-cfHPlzZp4v6NWgIPlrlX
205
207
  baidubce/services/vpn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
206
208
  baidubce/services/vpn/vpn_client.py,sha256=9OMhSPDVnSkLlJets2LbdTY7_2qqW4cB0_4a8kAxyhk,31571
207
209
  baidubce/services/vpn/vpn_model.py,sha256=C9rEBYyFIDjrqvqJG4WEin6qVzEIvbhPvT5KwDYm1qA,3365
208
- bce_python_sdk-0.9.76.dist-info/METADATA,sha256=2hbzah0jlJvk9vhULGqX9jfRl_g9Yjr5LH3muhzw83Q,558
209
- bce_python_sdk-0.9.76.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
210
- bce_python_sdk-0.9.76.dist-info/top_level.txt,sha256=Oh6eo_-T_AuEDpIaR54biUUPThxsoQiYMVHLBTaweQs,9
211
- bce_python_sdk-0.9.76.dist-info/RECORD,,
210
+ bce_python_sdk-0.9.79.dist-info/METADATA,sha256=3kW--tRekGVvTI1VFwlKO6VBrdMi6yM66eZ-96verHw,558
211
+ bce_python_sdk-0.9.79.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
212
+ bce_python_sdk-0.9.79.dist-info/top_level.txt,sha256=Oh6eo_-T_AuEDpIaR54biUUPThxsoQiYMVHLBTaweQs,9
213
+ bce_python_sdk-0.9.79.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (83.0.0)
2
+ Generator: setuptools (84.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5