Class: Google::Compute::Data::InstancTemplatPropert

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

Overview

A class to manage data for properties for instance_template.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#can_ip_forwardObject (readonly)

Returns the value of attribute can_ip_forward.



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

def can_ip_forward
  @can_ip_forward
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#disksObject (readonly)

Returns the value of attribute disks.



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

def disks
  @disks
end

#guest_acceleratorsObject (readonly)

Returns the value of attribute guest_accelerators.



42
43
44
# File 'lib/google/compute/property/instancetemplate_properties.rb', line 42

def guest_accelerators
  @guest_accelerators
end

#machine_typeObject (readonly)

Returns the value of attribute machine_type.



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

def machine_type
  @machine_type
end

#metadataObject (readonly)

Returns the value of attribute metadata.



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

def 
  @metadata
end

#network_interfacesObject (readonly)

Returns the value of attribute network_interfaces.



43
44
45
# File 'lib/google/compute/property/instancetemplate_properties.rb', line 43

def network_interfaces
  @network_interfaces
end

#schedulingObject (readonly)

Returns the value of attribute scheduling.



44
45
46
# File 'lib/google/compute/property/instancetemplate_properties.rb', line 44

def scheduling
  @scheduling
end

#service_accountsObject (readonly)

Returns the value of attribute service_accounts.



45
46
47
# File 'lib/google/compute/property/instancetemplate_properties.rb', line 45

def service_accounts
  @service_accounts
end

#tagsObject (readonly)

Returns the value of attribute tags.



46
47
48
# File 'lib/google/compute/property/instancetemplate_properties.rb', line 46

def tags
  @tags
end

Instance Method Details

#<=>(other) ⇒ Object



97
98
99
100
101
102
103
104
105
# File 'lib/google/compute/property/instancetemplate_properties.rb', line 97

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

rubocop:enable Metrics/MethodLength



88
89
90
91
92
93
94
95
# File 'lib/google/compute/property/instancetemplate_properties.rb', line 88

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



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/google/compute/property/instancetemplate_properties.rb', line 48

def to_json(_arg = nil)
  {
    'canIpForward' => can_ip_forward,
    'description' => description,
    'disks' => disks,
    'machineType' => machine_type,
    'metadata' => ,
    'guestAccelerators' => guest_accelerators,
    'networkInterfaces' => network_interfaces,
    'scheduling' => scheduling,
    'serviceAccounts' => service_accounts,
    'tags' => tags
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject

rubocop:disable Metrics/MethodLength



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/google/compute/property/instancetemplate_properties.rb', line 64

def to_s
  {
    can_ip_forward: can_ip_forward,
    description: description,
    disks: ['[',
            disks.map(&:to_json).join(', '),
            ']'].join(' '),
    machine_type: machine_type,
    metadata: ,
    guest_accelerators: ['[',
                         guest_accelerators.map(&:to_json).join(', '),
                         ']'].join(' '),
    network_interfaces: ['[',
                         network_interfaces.map(&:to_json).join(', '),
                         ']'].join(' '),
    scheduling: scheduling,
    service_accounts: ['[',
                       service_accounts.map(&:to_json).join(', '),
                       ']'].join(' '),
    tags: tags
  }.reject { |_k, v| v.nil? }.map { |k, v| "#{k}: #{v}" }.join(', ')
end