Class: Google::Compute::Data::InstaTemplNetwoInter

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

Overview

A class to manage data for network_interfaces for instance_template.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_configsObject (readonly)

Returns the value of attribute access_configs.



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

def access_configs
  @access_configs
end

#alias_ip_rangesObject (readonly)

Returns the value of attribute alias_ip_ranges.



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

def alias_ip_ranges
  @alias_ip_ranges
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#networkObject (readonly)

Returns the value of attribute network.



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

def network
  @network
end

#network_ipObject (readonly)

Returns the value of attribute network_ip.



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

def network_ip
  @network_ip
end

#subnetworkObject (readonly)

Returns the value of attribute subnetwork.



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

def subnetwork
  @subnetwork
end

Instance Method Details

#<=>(other) ⇒ Object



80
81
82
83
84
85
86
87
88
# File 'lib/google/compute/property/instancetemplate_network_interfaces.rb', line 80

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



71
72
73
74
75
76
77
78
# File 'lib/google/compute/property/instancetemplate_network_interfaces.rb', line 71

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



45
46
47
48
49
50
51
52
53
54
# File 'lib/google/compute/property/instancetemplate_network_interfaces.rb', line 45

def to_json(_arg = nil)
  {
    'accessConfigs' => access_configs,
    'aliasIpRanges' => alias_ip_ranges,
    'name' => name,
    'network' => network,
    'networkIP' => network_ip,
    'subnetwork' => subnetwork
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/google/compute/property/instancetemplate_network_interfaces.rb', line 56

def to_s
  {
    access_configs: ['[',
                     access_configs.map(&:to_json).join(', '),
                     ']'].join(' '),
    alias_ip_ranges: ['[',
                      alias_ip_ranges.map(&:to_json).join(', '),
                      ']'].join(' '),
    name: name,
    network: network,
    network_ip: network_ip,
    subnetwork: subnetwork
  }.reject { |_k, v| v.nil? }.map { |k, v| "#{k}: #{v}" }.join(', ')
end