Class: Google::Compute::Data::InstanceScheduling

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

Overview

A class to manage data for scheduling for instance.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#automatic_restartObject (readonly)

Returns the value of attribute automatic_restart.



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

def automatic_restart
  @automatic_restart
end

#on_host_maintenanceObject (readonly)

Returns the value of attribute on_host_maintenance.



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

def on_host_maintenance
  @on_host_maintenance
end

#preemptibleObject (readonly)

Returns the value of attribute preemptible.



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

def preemptible
  @preemptible
end

Instance Method Details

#<=>(other) ⇒ Object



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

def <=>(other)
  return false unless other.is_a? InstanceScheduling
  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/instance_scheduling.rb', line 57

def ==(other)
  return false unless other.is_a? InstanceScheduling
  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/instance_scheduling.rb', line 41

def to_json(_arg = nil)
  {
    'automaticRestart' => automatic_restart,
    'onHostMaintenance' => on_host_maintenance,
    'preemptible' => preemptible
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



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

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