Class: Google::Compute::Data::InstaDiskEncryKey

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

Overview

A class to manage data for disk_encryption_key for instance.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#raw_keyObject (readonly)

Returns the value of attribute raw_key.



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

def raw_key
  @raw_key
end

#rsa_encrypted_keyObject (readonly)

Returns the value of attribute rsa_encrypted_key.



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

def rsa_encrypted_key
  @rsa_encrypted_key
end

#sha256Object (readonly)

Returns the value of attribute sha256.



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

def sha256
  @sha256
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

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

def to_json(_arg = nil)
  {
    'rawKey' => raw_key,
    'rsaEncryptedKey' => rsa_encrypted_key,
    'sha256' => sha256
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



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

def to_s
  {
    raw_key: raw_key,
    rsa_encrypted_key: rsa_encrypted_key,
    sha256: sha256
  }.reject { |_k, v| v.nil? }.map { |k, v| "#{k}: #{v}" }.join(', ')
end