Class: Google::Compute::Data::ImageRawDisk

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

Overview

A class to manage data for raw_disk for image.

Direct Known Subclasses

ImageRawDiskApi, ImageRawDiskCatalog

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#container_typeObject (readonly)

Returns the value of attribute container_type.



37
38
39
# File 'lib/google/compute/property/image_raw_disk.rb', line 37

def container_type
  @container_type
end

#sha1_checksumObject (readonly)

Returns the value of attribute sha1_checksum.



38
39
40
# File 'lib/google/compute/property/image_raw_disk.rb', line 38

def sha1_checksum
  @sha1_checksum
end

#sourceObject (readonly)

Returns the value of attribute source.



39
40
41
# File 'lib/google/compute/property/image_raw_disk.rb', line 39

def source
  @source
end

Instance Method Details

#<=>(other) ⇒ Object



66
67
68
69
70
71
72
73
74
# File 'lib/google/compute/property/image_raw_disk.rb', line 66

def <=>(other)
  return false unless other.is_a? ImageRawDisk
  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



57
58
59
60
61
62
63
64
# File 'lib/google/compute/property/image_raw_disk.rb', line 57

def ==(other)
  return false unless other.is_a? ImageRawDisk
  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



41
42
43
44
45
46
47
# File 'lib/google/compute/property/image_raw_disk.rb', line 41

def to_json(_arg = nil)
  {
    'containerType' => container_type,
    'sha1Checksum' => sha1_checksum,
    'source' => source
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



49
50
51
52
53
54
55
# File 'lib/google/compute/property/image_raw_disk.rb', line 49

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