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



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
195
196
197
198
199
200
201
202
# File 'lib/kubevirt/models/v1_volume.rb', line 119

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?(:'container_path')
    self.container_path = attributes[:'container_path']
  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

#container_pathObject

Returns the value of attribute container_path.



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

def container_path
  @container_path
end

#data_volumeObject

Returns the value of attribute data_volume.



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

def data_volume
  @data_volume
end

#downward_apiObject

Returns the value of attribute downward_api.



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

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 (https://github.com/vhostmd/vhostmd) and vm-dump-metrics.



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

def downward_metrics
  @downward_metrics
end

#empty_diskObject

Returns the value of attribute empty_disk.



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

def empty_disk
  @empty_disk
end

#ephemeralObject

Returns the value of attribute ephemeral.



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

def ephemeral
  @ephemeral
end

#host_diskObject

Returns the value of attribute host_disk.



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

def host_disk
  @host_disk
end

#memory_dumpObject

Returns the value of attribute memory_dump.



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

def memory_dump
  @memory_dump
end

#nameObject

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



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

def name
  @name
end

#persistent_volume_claimObject

Returns the value of attribute persistent_volume_claim.



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

def persistent_volume_claim
  @persistent_volume_claim
end

#secretObject

Returns the value of attribute secret.



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

def secret
  @secret
end

#service_accountObject

Returns the value of attribute service_account.



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

def 
  @service_account
end

#sysprepObject

Returns the value of attribute sysprep.



53
54
55
# File 'lib/kubevirt/models/v1_volume.rb', line 53

def sysprep
  @sysprep
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



79
80
81
# File 'lib/kubevirt/models/v1_volume.rb', line 79

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



84
85
86
# File 'lib/kubevirt/models/v1_volume.rb', line 84

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'cloud_init_config_drive' => :'cloudInitConfigDrive',
    :'cloud_init_no_cloud' => :'cloudInitNoCloud',
    :'config_map' => :'configMap',
    :'container_disk' => :'containerDisk',
    :'container_path' => :'containerPath',
    :'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



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/kubevirt/models/v1_volume.rb', line 273

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



112
113
114
115
# File 'lib/kubevirt/models/v1_volume.rb', line 112

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'cloud_init_config_drive' => :'V1CloudInitConfigDriveSource',
    :'cloud_init_no_cloud' => :'V1CloudInitNoCloudSource',
    :'config_map' => :'V1ConfigMapVolumeSource',
    :'container_disk' => :'V1ContainerDiskSource',
    :'container_path' => :'V1ContainerPathVolumeSource',
    :'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



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/kubevirt/models/v1_volume.rb', line 236

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 &&
      container_path == o.container_path &&
      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


260
261
262
# File 'lib/kubevirt/models/v1_volume.rb', line 260

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



266
267
268
# File 'lib/kubevirt/models/v1_volume.rb', line 266

def hash
  [cloud_init_config_drive, cloud_init_no_cloud, config_map, container_disk, container_path, 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



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

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



295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/kubevirt/models/v1_volume.rb', line 295

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



218
219
220
221
222
# File 'lib/kubevirt/models/v1_volume.rb', line 218

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