Class: Kubevirt::K8sIoApiCoreV1PersistentVolumeClaimSpec

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb

Overview

PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
155
156
157
158
159
160
161
162
163
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 112

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::K8sIoApiCoreV1PersistentVolumeClaimSpec` 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::K8sIoApiCoreV1PersistentVolumeClaimSpec`. 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_attributes_class_name')
    self.volume_attributes_class_name = attributes[:'volume_attributes_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/k8s_io_api_core_v1_persistent_volume_claim_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/k8s_io_api_core_v1_persistent_volume_claim_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/k8s_io_api_core_v1_persistent_volume_claim_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/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 26

def resources
  @resources
end

#selectorObject

Returns the value of attribute selector.



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

def selector
  @selector
end

#storage_class_nameObject

storageClassName is the 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/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 31

def storage_class_name
  @storage_class_name
end

#volume_attributes_class_nameObject

volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. If specified, the CSI driver will create or update the volume with the attributes defined in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass will be applied to the claim but it’s not allowed to reset this field to empty string once it is set. If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass will be set by the persistentvolume controller if it exists. If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: kubernetes.io/docs/concepts/storage/volume-attributes-classes/ (Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default).



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

def volume_attributes_class_name
  @volume_attributes_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



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

def volume_mode
  @volume_mode
end

#volume_nameObject

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



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

def volume_name
  @volume_name
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



80
81
82
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 80

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



85
86
87
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 85

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 65

def self.attribute_map
  {
    :'access_modes' => :'accessModes',
    :'data_source' => :'dataSource',
    :'data_source_ref' => :'dataSourceRef',
    :'resources' => :'resources',
    :'selector' => :'selector',
    :'storage_class_name' => :'storageClassName',
    :'volume_attributes_class_name' => :'volumeAttributesClassName',
    :'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



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 223

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



105
106
107
108
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 105

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

.openapi_typesObject

Attribute type mapping.



90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 90

def self.openapi_types
  {
    :'access_modes' => :'Array<String>',
    :'data_source' => :'K8sIoApiCoreV1TypedLocalObjectReference',
    :'data_source_ref' => :'K8sIoApiCoreV1TypedObjectReference',
    :'resources' => :'K8sIoApiCoreV1VolumeResourceRequirements',
    :'selector' => :'K8sIoApimachineryPkgApisMetaV1LabelSelector',
    :'storage_class_name' => :'String',
    :'volume_attributes_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



194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 194

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_attributes_class_name == o.volume_attributes_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


210
211
212
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 210

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



216
217
218
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 216

def hash
  [access_modes, data_source, data_source_ref, resources, selector, storage_class_name, volume_attributes_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



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

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



245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 245

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



175
176
177
178
179
180
# File 'lib/kubevirt/models/k8s_io_api_core_v1_persistent_volume_claim_spec.rb', line 175

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