Class: Google::Storage::Data::BucketLogging

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/google/storage/property/bucket_logging.rb

Overview

A class to manage data for Logging for bucket.

Direct Known Subclasses

BucketLoggingApi, BucketLoggingCatalog

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#log_bucketObject (readonly)

Returns the value of attribute log_bucket.



37
38
39
# File 'lib/google/storage/property/bucket_logging.rb', line 37

def log_bucket
  @log_bucket
end

#log_object_prefixObject (readonly)

Returns the value of attribute log_object_prefix.



38
39
40
# File 'lib/google/storage/property/bucket_logging.rb', line 38

def log_object_prefix
  @log_object_prefix
end

Instance Method Details

#<=>(other) ⇒ Object



63
64
65
66
67
68
69
70
71
# File 'lib/google/storage/property/bucket_logging.rb', line 63

def <=>(other)
  return false unless other.is_a? BucketLogging
  compare_fields(other).each do |compare|
    next if compare[:self].nil? || compare[:other].nil?
    result = compare[:self] <=> compare[:other]
    return result unless result.zero?
  end
  0
end

#==(other) ⇒ Object



54
55
56
57
58
59
60
61
# File 'lib/google/storage/property/bucket_logging.rb', line 54

def ==(other)
  return false unless other.is_a? BucketLogging
  compare_fields(other).each do |compare|
    next if compare[:self].nil? || compare[:other].nil?
    return false if compare[:self] != compare[:other]
  end
  true
end

#to_json(_arg = nil) ⇒ Object



40
41
42
43
44
45
# File 'lib/google/storage/property/bucket_logging.rb', line 40

def to_json(_arg = nil)
  {
    'logBucket' => log_bucket,
    'logObjectPrefix' => log_object_prefix
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



47
48
49
50
51
52
# File 'lib/google/storage/property/bucket_logging.rb', line 47

def to_s
  {
    log_bucket: log_bucket,
    log_object_prefix: log_object_prefix
  }.reject { |_k, v| v.nil? }.map { |k, v| "#{k}: #{v}" }.join(', ')
end