Class: Kubevirt::V1PersistentVolumeClaimInfo

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

Overview

PersistentVolumeClaimInfo contains the relavant information virt-handler needs cached about a PVC

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



106
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
# File 'lib/kubevirt/models/v1_persistent_volume_claim_info.rb', line 106

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

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

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

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

  if attributes.key?(:'requests')
    if (value = attributes[:'requests']).is_a?(Hash)
      self.requests = value
    end
  end

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

Instance Attribute Details

#access_modesObject

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



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

def access_modes
  @access_modes
end

#capacityObject

Capacity represents the capacity set on the corresponding PVC status



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

def capacity
  @capacity
end

#claim_nameObject

ClaimName is the name of the PVC



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

def claim_name
  @claim_name
end

#filesystem_overheadObject

Percentage of filesystem's size to be reserved when resizing the PVC



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

def filesystem_overhead
  @filesystem_overhead
end

#preallocatedObject

Preallocated indicates if the PVC's storage is preallocated or not



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

def preallocated
  @preallocated
end

#requestsObject

Requests represents the resources requested by the corresponding PVC spec



35
36
37
# File 'lib/kubevirt/models/v1_persistent_volume_claim_info.rb', line 35

def requests
  @requests
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



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

def volume_mode
  @volume_mode
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'access_modes' => :'accessModes',
    :'capacity' => :'capacity',
    :'claim_name' => :'claimName',
    :'filesystem_overhead' => :'filesystemOverhead',
    :'preallocated' => :'preallocated',
    :'requests' => :'requests',
    :'volume_mode' => :'volumeMode'
  }
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



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

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



99
100
101
102
# File 'lib/kubevirt/models/v1_persistent_volume_claim_info.rb', line 99

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'access_modes' => :'Array<String>',
    :'capacity' => :'Hash<String, Object>',
    :'claim_name' => :'String',
    :'filesystem_overhead' => :'String',
    :'preallocated' => :'Boolean',
    :'requests' => :'Hash<String, Object>',
    :'volume_mode' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      access_modes == o.access_modes &&
      capacity == o.capacity &&
      claim_name == o.claim_name &&
      filesystem_overhead == o.filesystem_overhead &&
      preallocated == o.preallocated &&
      requests == o.requests &&
      volume_mode == o.volume_mode
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


198
199
200
# File 'lib/kubevirt/models/v1_persistent_volume_claim_info.rb', line 198

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



204
205
206
# File 'lib/kubevirt/models/v1_persistent_volume_claim_info.rb', line 204

def hash
  [access_modes, capacity, claim_name, filesystem_overhead, preallocated, requests, volume_mode].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



157
158
159
160
161
# File 'lib/kubevirt/models/v1_persistent_volume_claim_info.rb', line 157

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



233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/kubevirt/models/v1_persistent_volume_claim_info.rb', line 233

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



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

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