Class: Kubevirt::V1beta1StorageSpec

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

Overview

StorageSpec defines the Storage type specification

Defined Under Namespace

Classes: EnumAttributeValidator

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 = {}) ⇒ V1beta1StorageSpec

Initializes the object

Parameters:

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

    Model attributes in the form of hash



107
108
109
110
111
112
113
114
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
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 107

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::V1beta1StorageSpec` 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::V1beta1StorageSpec`. 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?(:'access_modes')
    if (value = attributes[:'access_modes']).is_a?(Array)
      self.access_modes = value
    end
  end

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

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

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

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

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

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

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

Instance Attribute Details

#access_modesObject

AccessModes contains the desired access modes the volume should have. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1



20
21
22
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 20

def access_modes
  @access_modes
end

#data_sourceObject

Returns the value of attribute data_source.



22
23
24
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 22

def data_source
  @data_source
end

#data_source_refObject

Returns the value of attribute data_source_ref.



24
25
26
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 24

def data_source_ref
  @data_source_ref
end

#resourcesObject

Returns the value of attribute resources.



26
27
28
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 26

def resources
  @resources
end

#selectorObject

Returns the value of attribute selector.



28
29
30
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 28

def selector
  @selector
end

#storage_class_nameObject

Name of the StorageClass required by the claim. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#class-1



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

def storage_class_name
  @storage_class_name
end

#volume_modeObject

volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec. Possible enum values: - ‘"Block"` means the volume will not be formatted with a filesystem and will remain a raw block device. - `"Filesystem"` means the volume will be or is formatted with a filesystem. - `"FromStorageProfile"` means the volume mode will be auto selected by CDI according to a matching StorageProfile



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

def volume_mode
  @volume_mode
end

#volume_nameObject

VolumeName is the binding reference to the PersistentVolume backing this claim.



37
38
39
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 37

def volume_name
  @volume_name
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



76
77
78
# File 'lib/kubevirt/models/v1beta1_storage_spec.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/v1beta1_storage_spec.rb', line 81

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 62

def self.attribute_map
  {
    :'access_modes' => :'accessModes',
    :'data_source' => :'dataSource',
    :'data_source_ref' => :'dataSourceRef',
    :'resources' => :'resources',
    :'selector' => :'selector',
    :'storage_class_name' => :'storageClassName',
    :'volume_mode' => :'volumeMode',
    :'volume_name' => :'volumeName'
  }
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



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 213

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



100
101
102
103
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 100

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

.openapi_typesObject

Attribute type mapping.



86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 86

def self.openapi_types
  {
    :'access_modes' => :'Array<String>',
    :'data_source' => :'K8sIoApiCoreV1TypedLocalObjectReference',
    :'data_source_ref' => :'K8sIoApiCoreV1TypedObjectReference',
    :'resources' => :'K8sIoApiCoreV1VolumeResourceRequirements',
    :'selector' => :'K8sIoApimachineryPkgApisMetaV1LabelSelector',
    :'storage_class_name' => :'String',
    :'volume_mode' => :'String',
    :'volume_name' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 185

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      access_modes == o.access_modes &&
      data_source == o.data_source &&
      data_source_ref == o.data_source_ref &&
      resources == o.resources &&
      selector == o.selector &&
      storage_class_name == o.storage_class_name &&
      volume_mode == o.volume_mode &&
      volume_name == o.volume_name
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


200
201
202
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 200

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



206
207
208
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 206

def hash
  [access_modes, data_source, data_source_ref, resources, selector, storage_class_name, volume_mode, volume_name].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



158
159
160
161
162
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 158

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 235

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



166
167
168
169
170
171
# File 'lib/kubevirt/models/v1beta1_storage_spec.rb', line 166

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  volume_mode_validator = EnumAttributeValidator.new('String', ["Block", "Filesystem", "FromStorageProfile"])
  return false unless volume_mode_validator.valid?(@volume_mode)
  true
end