Class: IbmCloudPower::VPMemVolumeReference

Inherits:
ApiModelBase show all
Defined in:
lib/ibm_cloud_power/models/vp_mem_volume_reference.rb

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



103
104
105
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 103

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#creation_dateObject

The date and time when the volume was created



19
20
21
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 19

def creation_date
  @creation_date
end

#crnObject

The CRN for this resource



22
23
24
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 22

def crn
  @crn
end

#error_codeObject

Error code for the vPMEM volume



25
26
27
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 25

def error_code
  @error_code
end

#hrefObject

Link to vPMEM volume resource



28
29
30
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 28

def href
  @href
end

#nameObject

Volume Name



31
32
33
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 31

def name
  @name
end

#pvm_instance_idObject

PVM Instance ID which the volume is attached to



34
35
36
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 34

def pvm_instance_id
  @pvm_instance_id
end

#reasonObject

Reason for error



37
38
39
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 37

def reason
  @reason
end

#sizeObject

Volume Size (GiB)



40
41
42
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 40

def size
  @size
end

#statusObject

Status of the volume



43
44
45
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 43

def status
  @status
end

#updated_dateObject

The date and time when the volume was updated



46
47
48
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 46

def updated_date
  @updated_date
end

#uuidObject

Volume ID



49
50
51
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 49

def uuid
  @uuid
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



69
70
71
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 69

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



74
75
76
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 74

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 52

def self.attribute_map
  {
    :'creation_date' => :'creationDate',
    :'crn' => :'crn',
    :'error_code' => :'errorCode',
    :'href' => :'href',
    :'name' => :'name',
    :'pvm_instance_id' => :'pvmInstanceID',
    :'reason' => :'reason',
    :'size' => :'size',
    :'status' => :'status',
    :'updated_date' => :'updatedDate',
    :'uuid' => :'uuid'
  }
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



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 329

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



96
97
98
99
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 96

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

.openapi_typesObject

Attribute type mapping.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 79

def self.openapi_types
  {
    :'creation_date' => :'Time',
    :'crn' => :'String',
    :'error_code' => :'String',
    :'href' => :'String',
    :'name' => :'String',
    :'pvm_instance_id' => :'String',
    :'reason' => :'String',
    :'size' => :'Float',
    :'status' => :'String',
    :'updated_date' => :'Time',
    :'uuid' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 298

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      creation_date == o.creation_date &&
      crn == o.crn &&
      error_code == o.error_code &&
      href == o.href &&
      name == o.name &&
      pvm_instance_id == o.pvm_instance_id &&
      reason == o.reason &&
      size == o.size &&
      status == o.status &&
      updated_date == o.updated_date &&
      uuid == o.uuid
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


316
317
318
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 316

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



322
323
324
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 322

def hash
  [creation_date, crn, error_code, href, name, pvm_instance_id, reason, size, status, updated_date, uuid].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
203
204
205
206
207
208
209
210
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 178

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

  if @href.nil?
    invalid_properties.push('invalid value for "href", href cannot be nil.')
  end

  if @name.nil?
    invalid_properties.push('invalid value for "name", name cannot be nil.')
  end

  if @pvm_instance_id.nil?
    invalid_properties.push('invalid value for "pvm_instance_id", pvm_instance_id cannot be nil.')
  end

  if @size.nil?
    invalid_properties.push('invalid value for "size", size cannot be nil.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  if @uuid.nil?
    invalid_properties.push('invalid value for "uuid", uuid 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



351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 351

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



214
215
216
217
218
219
220
221
222
223
224
# File 'lib/ibm_cloud_power/models/vp_mem_volume_reference.rb', line 214

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @creation_date.nil?
  return false if @href.nil?
  return false if @name.nil?
  return false if @pvm_instance_id.nil?
  return false if @size.nil?
  return false if @status.nil?
  return false if @uuid.nil?
  true
end