@@ -113,7 +113,7 @@ def get_bucket_config(self, bucket, **kwargs):
113
113
return response
114
114
115
115
116
- def update_bucket_config (self , bucket , firewall = None , activity_tracking = None , metrics_monitoring = None , if_match = None , ** kwargs ):
116
+ def update_bucket_config (self , bucket , firewall = None , activity_tracking = None , metrics_monitoring = None , hard_quota = None , if_match = None , ** kwargs ):
117
117
"""
118
118
Make changes to a bucket's configuration.
119
119
@@ -138,6 +138,7 @@ def update_bucket_config(self, bucket, firewall=None, activity_tracking=None, me
138
138
:param MetricsMonitoring metrics_monitoring: Enables sending metrics to IBM Cloud
139
139
Monitoring. All metrics are sent to the IBM Cloud Monitoring instance defined in
140
140
the `monitoring_crn` field.
141
+ :param int hard_quota: Maximum bytes for this bucket.
141
142
:param str if_match: An Etag previously returned in a header when fetching or
142
143
updating a bucket's metadata. If this value does not match the active Etag, the
143
144
request will fail.
@@ -166,7 +167,8 @@ def update_bucket_config(self, bucket, firewall=None, activity_tracking=None, me
166
167
data = {
167
168
'firewall' : firewall ,
168
169
'activity_tracking' : activity_tracking ,
169
- 'metrics_monitoring' : metrics_monitoring
170
+ 'metrics_monitoring' : metrics_monitoring ,
171
+ 'hard_quota' : hard_quota
170
172
}
171
173
172
174
url = '/b/{0}' .format (* self ._encode_path_vars (bucket ))
@@ -275,6 +277,13 @@ class Bucket(object):
275
277
3339 format. Non-mutable.
276
278
:attr int object_count: (optional) Total number of objects in the bucket. Non-mutable.
277
279
:attr int bytes_used: (optional) Total size of all objects in the bucket. Non-mutable.
280
+ :attr int noncurrent_object_count: (optional) Number of non-current object versions in
281
+ the bucket. Non-mutable.
282
+ :attr int noncurrent_bytes_used: (optional) Total size of all non-current object
283
+ versions in the bucket. Non-mutable.
284
+ :attr int delete_marker_count: (optional) Total number of delete markers in the
285
+ bucket. Non-mutable.
286
+ :attr int hard_quota: (optional) Maximum bytes for this bucket.
278
287
:attr Firewall firewall: (optional) An access control mechanism based on the network
279
288
(IP address) where request originated. Requests not originating from IP addresses
280
289
listed in the `allowed_ip` field will be denied regardless of any access policies
@@ -289,7 +298,7 @@ class Bucket(object):
289
298
the `monitoring_crn` field.
290
299
"""
291
300
292
- def __init__ (self , name = None , crn = None , service_instance_id = None , service_instance_crn = None , time_created = None , time_updated = None , object_count = None , bytes_used = None , firewall = None , activity_tracking = None , metrics_monitoring = None ):
301
+ def __init__ (self , name = None , crn = None , service_instance_id = None , service_instance_crn = None , time_created = None , time_updated = None , object_count = None , bytes_used = None , noncurrent_object_count = None , noncurrent_bytes_used = None , delete_marker_count = None , hard_quota = None , firewall = None , activity_tracking = None , metrics_monitoring = None ):
293
302
"""
294
303
Initialize a Bucket object.
295
304
@@ -308,6 +317,13 @@ def __init__(self, name=None, crn=None, service_instance_id=None, service_instan
308
317
Non-mutable.
309
318
:param int bytes_used: (optional) Total size of all objects in the bucket.
310
319
Non-mutable.
320
+ :param int noncurrent_object_count: (optional) Number of non-current object
321
+ versions in the bucket. Non-mutable.
322
+ :param int noncurrent_bytes_used: (optional) Total size of all non-current object
323
+ versions in the bucket. Non-mutable.
324
+ :param int delete_marker_count: (optional) Total number of delete markers in the
325
+ bucket. Non-mutable.
326
+ :param int hard_quota: (optional) Maximum bytes for this bucket.
311
327
:param Firewall firewall: (optional) An access control mechanism based on the
312
328
network (IP address) where request originated. Requests not originating from IP
313
329
addresses listed in the `allowed_ip` field will be denied regardless of any access
@@ -330,6 +346,10 @@ def __init__(self, name=None, crn=None, service_instance_id=None, service_instan
330
346
self .time_updated = time_updated
331
347
self .object_count = object_count
332
348
self .bytes_used = bytes_used
349
+ self .noncurrent_object_count = noncurrent_object_count
350
+ self .noncurrent_bytes_used = noncurrent_bytes_used
351
+ self .delete_marker_count = delete_marker_count
352
+ self .hard_quota = hard_quota
333
353
self .firewall = firewall
334
354
self .activity_tracking = activity_tracking
335
355
self .metrics_monitoring = metrics_monitoring
@@ -338,7 +358,7 @@ def __init__(self, name=None, crn=None, service_instance_id=None, service_instan
338
358
def _from_dict (cls , _dict ):
339
359
"""Initialize a Bucket object from a json dictionary."""
340
360
args = {}
341
- validKeys = ['name' , 'crn' , 'service_instance_id' , 'service_instance_crn' , 'time_created' , 'time_updated' , 'object_count' , 'bytes_used' , 'firewall' , 'activity_tracking' , 'metrics_monitoring' ]
361
+ validKeys = ['name' , 'crn' , 'service_instance_id' , 'service_instance_crn' , 'time_created' , 'time_updated' , 'object_count' , 'bytes_used' , 'noncurrent_object_count' , 'noncurrent_bytes_used' , 'delete_marker_count' , 'hard_quota' , ' firewall' , 'activity_tracking' , 'metrics_monitoring' ]
342
362
badKeys = set (_dict .keys ()) - set (validKeys )
343
363
if badKeys :
344
364
raise ValueError ('Unrecognized keys detected in dictionary for class Bucket: ' + ', ' .join (badKeys ))
@@ -358,6 +378,14 @@ def _from_dict(cls, _dict):
358
378
args ['object_count' ] = _dict .get ('object_count' )
359
379
if 'bytes_used' in _dict :
360
380
args ['bytes_used' ] = _dict .get ('bytes_used' )
381
+ if 'noncurrent_object_count' in _dict :
382
+ args ['noncurrent_object_count' ] = _dict .get ('noncurrent_object_count' )
383
+ if 'noncurrent_bytes_used' in _dict :
384
+ args ['noncurrent_bytes_used' ] = _dict .get ('noncurrent_bytes_used' )
385
+ if 'delete_marker_count' in _dict :
386
+ args ['delete_marker_count' ] = _dict .get ('delete_marker_count' )
387
+ if 'hard_quota' in _dict :
388
+ args ['hard_quota' ] = _dict .get ('hard_quota' )
361
389
if 'firewall' in _dict :
362
390
args ['firewall' ] = Firewall ._from_dict (_dict .get ('firewall' ))
363
391
if 'activity_tracking' in _dict :
@@ -385,6 +413,14 @@ def _to_dict(self):
385
413
_dict ['object_count' ] = self .object_count
386
414
if hasattr (self , 'bytes_used' ) and self .bytes_used is not None :
387
415
_dict ['bytes_used' ] = self .bytes_used
416
+ if hasattr (self , 'noncurrent_object_count' ) and self .noncurrent_object_count is not None :
417
+ _dict ['noncurrent_object_count' ] = self .noncurrent_object_count
418
+ if hasattr (self , 'noncurrent_bytes_used' ) and self .noncurrent_bytes_used is not None :
419
+ _dict ['noncurrent_bytes_used' ] = self .noncurrent_bytes_used
420
+ if hasattr (self , 'delete_marker_count' ) and self .delete_marker_count is not None :
421
+ _dict ['delete_marker_count' ] = self .delete_marker_count
422
+ if hasattr (self , 'hard_quota' ) and self .hard_quota is not None :
423
+ _dict ['hard_quota' ] = self .hard_quota
388
424
if hasattr (self , 'firewall' ) and self .firewall is not None :
389
425
_dict ['firewall' ] = self .firewall ._to_dict ()
390
426
if hasattr (self , 'activity_tracking' ) and self .activity_tracking is not None :
@@ -505,36 +541,43 @@ class MetricsMonitoring(object):
505
541
506
542
:attr bool usage_metrics_enabled: (optional) If set to `true`, all usage metrics (i.e.
507
543
`bytes_used`) will be sent to the monitoring service.
544
+ :attr bool request_metrics_enabled: (optional) If set to `true`, all request metrics
545
+ (i.e. `rest.object.head`) will be sent to the monitoring service.
508
546
:attr str metrics_monitoring_crn: (optional) Required the first time
509
547
`metrics_monitoring` is configured. The instance of IBM Cloud Monitoring that will
510
548
receive the bucket metrics. The format is "crn:v1:bluemix:public:logdnaat:{bucket
511
549
location}:a/{storage account}:{monitoring service instance}::".
512
550
"""
513
551
514
- def __init__ (self , usage_metrics_enabled = None , metrics_monitoring_crn = None ):
552
+ def __init__ (self , usage_metrics_enabled = None , request_metrics_enabled = None , metrics_monitoring_crn = None ):
515
553
"""
516
554
Initialize a MetricsMonitoring object.
517
555
518
556
:param bool usage_metrics_enabled: (optional) If set to `true`, all usage metrics
519
557
(i.e. `bytes_used`) will be sent to the monitoring service.
558
+ :param bool request_metrics_enabled: (optional) If set to `true`, all request
559
+ metrics (i.e. `rest.object.head`) will be sent to the monitoring service.
520
560
:param str metrics_monitoring_crn: (optional) Required the first time
521
561
`metrics_monitoring` is configured. The instance of IBM Cloud Monitoring that will
522
562
receive the bucket metrics. The format is "crn:v1:bluemix:public:logdnaat:{bucket
523
563
location}:a/{storage account}:{monitoring service instance}::".
524
564
"""
525
565
self .usage_metrics_enabled = usage_metrics_enabled
566
+ self .request_metrics_enabled = request_metrics_enabled
526
567
self .metrics_monitoring_crn = metrics_monitoring_crn
527
568
528
569
@classmethod
529
570
def _from_dict (cls , _dict ):
530
571
"""Initialize a MetricsMonitoring object from a json dictionary."""
531
572
args = {}
532
- validKeys = ['usage_metrics_enabled' , 'metrics_monitoring_crn' ]
573
+ validKeys = ['usage_metrics_enabled' , 'request_metrics_enabled' , ' metrics_monitoring_crn' ]
533
574
badKeys = set (_dict .keys ()) - set (validKeys )
534
575
if badKeys :
535
576
raise ValueError ('Unrecognized keys detected in dictionary for class MetricsMonitoring: ' + ', ' .join (badKeys ))
536
577
if 'usage_metrics_enabled' in _dict :
537
578
args ['usage_metrics_enabled' ] = _dict .get ('usage_metrics_enabled' )
579
+ if 'request_metrics_enabled' in _dict :
580
+ args ['request_metrics_enabled' ] = _dict .get ('request_metrics_enabled' )
538
581
if 'metrics_monitoring_crn' in _dict :
539
582
args ['metrics_monitoring_crn' ] = _dict .get ('metrics_monitoring_crn' )
540
583
return cls (** args )
@@ -544,6 +587,8 @@ def _to_dict(self):
544
587
_dict = {}
545
588
if hasattr (self , 'usage_metrics_enabled' ) and self .usage_metrics_enabled is not None :
546
589
_dict ['usage_metrics_enabled' ] = self .usage_metrics_enabled
590
+ if hasattr (self , 'request_metrics_enabled' ) and self .request_metrics_enabled is not None :
591
+ _dict ['request_metrics_enabled' ] = self .request_metrics_enabled
547
592
if hasattr (self , 'metrics_monitoring_crn' ) and self .metrics_monitoring_crn is not None :
548
593
_dict ['metrics_monitoring_crn' ] = self .metrics_monitoring_crn
549
594
return _dict
0 commit comments