Class: Awshark::S3::Bucket

Inherits:
Object
  • Object
show all
Defined in:
lib/awshark/s3/bucket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Bucket

Returns a new instance of Bucket.



8
9
10
11
12
13
14
15
# File 'lib/awshark/s3/bucket.rb', line 8

def initialize(attributes)
  @name = attributes.name
  @creation_date = attributes.creation_date
  @region = attributes.region

  # fixes S3 quirks
  @region = 'eu-west-1' if @region == 'EU'
end

Instance Attribute Details

#creation_dateObject (readonly)

Returns the value of attribute creation_date.



6
7
8
# File 'lib/awshark/s3/bucket.rb', line 6

def creation_date
  @creation_date
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/awshark/s3/bucket.rb', line 6

def name
  @name
end

#regionObject (readonly)

Returns the value of attribute region.



6
7
8
# File 'lib/awshark/s3/bucket.rb', line 6

def region
  @region
end

Instance Method Details

#byte_sizeObject



17
18
19
# File 'lib/awshark/s3/bucket.rb', line 17

def byte_size
  metric_value(metric_name: 'BucketSizeBytes', storage_type: 'StandardStorage')
end

#number_of_objectsObject



21
22
23
# File 'lib/awshark/s3/bucket.rb', line 21

def number_of_objects
  metric_value(metric_name: 'NumberOfObjects', storage_type: 'AllStorageTypes')
end