Class: Kubevirt::V1Volume

Inherits:
ApiModelBase show all
Defined in:
lib/kubevirt/models/v1_volume.rb

Overview

Volume represents a named volume in a vmi.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ V1Volume

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/kubevirt/models/v1_volume.rb', line 115

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::V1Volume` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Kubevirt::V1Volume`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'cloud_init_config_drive')
    self.cloud_init_config_drive = attributes[:'cloud_init_config_drive']
  end

  if attributes.key?(:'cloud_init_no_cloud')
    self.cloud_init_no_cloud = attributes[:'cloud_init_no_cloud']
  end

  if attributes.key?(:'config_map')
    self.config_map = attributes[:'config_map']
  end

  if attributes.key?(:'container_disk')
    self.container_disk = attributes[:'container_disk']
  end

  if attributes.key?(:'data_volume')
    self.data_volume = attributes[:'data_volume']
  end

  if attributes.key?(:'downward_api')
    self.downward_api = attributes[:'downward_api']
  end

  if attributes.key?(:'downward_metrics')
    self.downward_metrics = attributes[:'downward_metrics']
  end

  if attributes.key?(:'empty_disk')
    self.empty_disk = attributes[:'empty_disk']
  end

  if attributes.key?(:'ephemeral')
    self.ephemeral = attributes[:'ephemeral']
  end

  if attributes.key?(:'host_disk')
    self.host_disk = attributes[:'host_disk']
  end

  if attributes.key?(:'memory_dump')
    self.memory_dump = attributes[:'memory_dump']
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = ''
  end

  if attributes.key?(:'persistent_volume_claim')
    self.persistent_volume_claim = attributes[:'persistent_volume_claim']
  end

  if attributes.key?(:'secret')
    self.secret = attributes[:'secret']
  end

  if attributes.key?(:'service_account')
    self. = attributes[:'service_account']
  end

  if attributes.key?(:'sysprep')
    self.sysprep = attributes[:'sysprep']
  end
end

Instance Attribute Details

#cloud_init_config_driveObject

Returns the value of attribute cloud_init_config_drive.



19
20
21
# File 'lib/kubevirt/models/v1_volume.rb', line 19

def cloud_init_config_drive
  @cloud_init_config_drive
end

#cloud_init_no_cloudObject

Returns the value of attribute cloud_init_no_cloud.



21
22
23
# File 'lib/kubevirt/models/v1_volume.rb', line 21

def cloud_init_no_cloud
  @cloud_init_no_cloud
end

#config_mapObject

Returns the value of attribute config_map.



23
24
25
# File 'lib/kubevirt/models/v1_volume.rb', line 23

def config_map
  @config_map
end

#container_diskObject

Returns the value of attribute container_disk.



25
26
27
# File 'lib/kubevirt/models/v1_volume.rb', line 25

def container_disk
  @container_disk
end

#data_volumeObject

Returns the value of attribute data_volume.



27
28
29
# File 'lib/kubevirt/models/v1_volume.rb', line 27

def data_volume
  @data_volume
end

#downward_apiObject

Returns the value of attribute downward_api.



29
30
31
# File 'lib/kubevirt/models/v1_volume.rb', line 29

def downward_api
  @downward_api
end

#downward_metricsObject

DownwardMetricsVolumeSource adds a very small disk to VMIs which contains a limited view of host and guest metrics. The disk content is compatible with vhostmd (github.com/vhostmd/vhostmd) and vm-dump-metrics.



32
33
34
# File 'lib/kubevirt/models/v1_volume.rb', line 32

def downward_metrics
  @downward_metrics
end

#empty_diskObject

Returns the value of attribute empty_disk.



34
35
36
# File 'lib/kubevirt/models/v1_volume.rb', line 34

def empty_disk
  @empty_disk
end

#ephemeralObject

Returns the value of attribute ephemeral.



36
37
38
# File 'lib/kubevirt/models/v1_volume.rb', line 36

def ephemeral
  @ephemeral
end

#host_diskObject

Returns the value of attribute host_disk.



38
39
40
# File 'lib/kubevirt/models/v1_volume.rb', line 38

def host_disk
  @host_disk
end

#memory_dumpObject

Returns the value of attribute memory_dump.



40
41
42
# File 'lib/kubevirt/models/v1_volume.rb', line 40

def memory_dump
  @memory_dump
end

#nameObject

Volume’s name. Must be a DNS_LABEL and unique within the vmi. More info: kubernetes.io/docs/concepts/overview/working-with-objects/names/#names



43
44
45
# File 'lib/kubevirt/models/v1_volume.rb', line 43

def name
  @name
end

#persistent_volume_claimObject

Returns the value of attribute persistent_volume_claim.



45
46
47
# File 'lib/kubevirt/models/v1_volume.rb', line 45

def persistent_volume_claim
  @persistent_volume_claim
end

#secretObject

Returns the value of attribute secret.



47
48
49
# File 'lib/kubevirt/models/v1_volume.rb', line 47

def secret
  @secret
end

#service_accountObject

Returns the value of attribute service_account.



49
50
51
# File 'lib/kubevirt/models/v1_volume.rb', line 49

def 
  @service_account
end

#sysprepObject

Returns the value of attribute sysprep.



51
52
53
# File 'lib/kubevirt/models/v1_volume.rb', line 51

def sysprep
  @sysprep
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



76
77
78
# File 'lib/kubevirt/models/v1_volume.rb', line 76

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



81
82
83
# File 'lib/kubevirt/models/v1_volume.rb', line 81

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/kubevirt/models/v1_volume.rb', line 54

def self.attribute_map
  {
    :'cloud_init_config_drive' => :'cloudInitConfigDrive',
    :'cloud_init_no_cloud' => :'cloudInitNoCloud',
    :'config_map' => :'configMap',
    :'container_disk' => :'containerDisk',
    :'data_volume' => :'dataVolume',
    :'downward_api' => :'downwardAPI',
    :'downward_metrics' => :'downwardMetrics',
    :'empty_disk' => :'emptyDisk',
    :'ephemeral' => :'ephemeral',
    :'host_disk' => :'hostDisk',
    :'memory_dump' => :'memoryDump',
    :'name' => :'name',
    :'persistent_volume_claim' => :'persistentVolumeClaim',
    :'secret' => :'secret',
    :'service_account' => :'serviceAccount',
    :'sysprep' => :'sysprep'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/kubevirt/models/v1_volume.rb', line 264

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



108
109
110
111
# File 'lib/kubevirt/models/v1_volume.rb', line 108

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/kubevirt/models/v1_volume.rb', line 86

def self.openapi_types
  {
    :'cloud_init_config_drive' => :'V1CloudInitConfigDriveSource',
    :'cloud_init_no_cloud' => :'V1CloudInitNoCloudSource',
    :'config_map' => :'V1ConfigMapVolumeSource',
    :'container_disk' => :'V1ContainerDiskSource',
    :'data_volume' => :'V1DataVolumeSource',
    :'downward_api' => :'V1DownwardAPIVolumeSource',
    :'downward_metrics' => :'Object',
    :'empty_disk' => :'V1EmptyDiskSource',
    :'ephemeral' => :'V1EphemeralVolumeSource',
    :'host_disk' => :'V1HostDisk',
    :'memory_dump' => :'V1MemoryDumpVolumeSource',
    :'name' => :'String',
    :'persistent_volume_claim' => :'V1PersistentVolumeClaimVolumeSource',
    :'secret' => :'V1SecretVolumeSource',
    :'service_account' => :'V1ServiceAccountVolumeSource',
    :'sysprep' => :'V1SysprepSource'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/kubevirt/models/v1_volume.rb', line 228

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      cloud_init_config_drive == o.cloud_init_config_drive &&
      cloud_init_no_cloud == o.cloud_init_no_cloud &&
      config_map == o.config_map &&
      container_disk == o.container_disk &&
      data_volume == o.data_volume &&
      downward_api == o.downward_api &&
      downward_metrics == o.downward_metrics &&
      empty_disk == o.empty_disk &&
      ephemeral == o.ephemeral &&
      host_disk == o.host_disk &&
      memory_dump == o.memory_dump &&
      name == o.name &&
      persistent_volume_claim == o.persistent_volume_claim &&
      secret == o.secret &&
       == o. &&
      sysprep == o.sysprep
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


251
252
253
# File 'lib/kubevirt/models/v1_volume.rb', line 251

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



257
258
259
# File 'lib/kubevirt/models/v1_volume.rb', line 257

def hash
  [cloud_init_config_drive, cloud_init_no_cloud, config_map, container_disk, data_volume, downward_api, downward_metrics, empty_disk, ephemeral, host_disk, memory_dump, name, persistent_volume_claim, secret, , sysprep].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



198
199
200
201
202
203
204
205
206
# File 'lib/kubevirt/models/v1_volume.rb', line 198

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/kubevirt/models/v1_volume.rb', line 286

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



210
211
212
213
214
# File 'lib/kubevirt/models/v1_volume.rb', line 210

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @name.nil?
  true
end