Class: Google::Compute::Data::InstaTemplInitiParam

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

Overview

A class to manage data for initialize_params for instance_template.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#disk_nameObject (readonly)

Returns the value of attribute disk_name.



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

def disk_name
  @disk_name
end

#disk_size_gbObject (readonly)

Returns the value of attribute disk_size_gb.



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

def disk_size_gb
  @disk_size_gb
end

#disk_typeObject (readonly)

Returns the value of attribute disk_type.



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

def disk_type
  @disk_type
end

#source_imageObject (readonly)

Returns the value of attribute source_image.



40
41
42
# File 'lib/google/compute/property/instancetemplate_initialize_params.rb', line 40

def source_image
  @source_image
end

#source_image_encryption_keyObject (readonly)

Returns the value of attribute source_image_encryption_key.



41
42
43
# File 'lib/google/compute/property/instancetemplate_initialize_params.rb', line 41

def source_image_encryption_key
  @source_image_encryption_key
end

Instance Method Details

#<=>(other) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/google/compute/property/instancetemplate_initialize_params.rb', line 72

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



63
64
65
66
67
68
69
70
# File 'lib/google/compute/property/instancetemplate_initialize_params.rb', line 63

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



43
44
45
46
47
48
49
50
51
# File 'lib/google/compute/property/instancetemplate_initialize_params.rb', line 43

def to_json(_arg = nil)
  {
    'diskName' => disk_name,
    'diskSizeGb' => disk_size_gb,
    'diskType' => disk_type,
    'sourceImage' => source_image,
    'sourceImageEncryptionKey' => source_image_encryption_key
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



53
54
55
56
57
58
59
60
61
# File 'lib/google/compute/property/instancetemplate_initialize_params.rb', line 53

def to_s
  {
    disk_name: disk_name,
    disk_size_gb: disk_size_gb,
    disk_type: disk_type,
    source_image: source_image,
    source_image_encryption_key: source_image_encryption_key
  }.reject { |_k, v| v.nil? }.map { |k, v| "#{k}: #{v}" }.join(', ')
end