Class: IbmCloudPower::SharedProcessorPool

Inherits:
ApiModelBase show all
Defined in:
lib/ibm_cloud_power/models/shared_processor_pool.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 = {}) ⇒ SharedProcessorPool

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 118

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#allocated_coresObject

The amount of allocated processor cores for the Shared Processor Pool



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

def allocated_cores
  @allocated_cores
end

#available_coresObject

The amount of available processor cores for the Shared Processor Pool



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

def available_cores
  @available_cores
end

#creation_dateObject

The creation time of the Shared Processor Pool



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

def creation_date
  @creation_date
end

#crnObject

The CRN for this resource



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

def crn
  @crn
end

#dedicated_host_idObject

ID of the dedicated host where the Shared Processor Pool resides, if applicable



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

def dedicated_host_id
  @dedicated_host_id
end

#host_groupObject

The host group the host belongs to



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

def host_group
  @host_group
end

#host_idObject

The ID of the host where the Shared Processor Pool resides



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

def host_id
  @host_id
end

#idObject

The id of the Shared Processor Pool



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

def id
  @id
end

#nameObject

The name of the Shared Processor Pool



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

def name
  @name
end

#reserved_coresObject

The amount of reserved processor cores for the Shared Processor Pool



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

def reserved_cores
  @reserved_cores
end

#shared_processor_pool_placement_groupsObject

list of Shared Processor Pool Placement Groups



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

def shared_processor_pool_placement_groups
  @shared_processor_pool_placement_groups
end

#statusObject

The status of the Shared Processor Pool



52
53
54
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 52

def status
  @status
end

#status_detailObject

The status details of the Shared Processor Pool



55
56
57
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 55

def status_detail
  @status_detail
end

#user_tagsObject

List of user tags



58
59
60
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 58

def user_tags
  @user_tags
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



81
82
83
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 81

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



86
87
88
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 86

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 61

def self.attribute_map
  {
    :'allocated_cores' => :'allocatedCores',
    :'available_cores' => :'availableCores',
    :'creation_date' => :'creationDate',
    :'crn' => :'crn',
    :'dedicated_host_id' => :'dedicatedHostID',
    :'host_group' => :'hostGroup',
    :'host_id' => :'hostID',
    :'id' => :'id',
    :'name' => :'name',
    :'reserved_cores' => :'reservedCores',
    :'shared_processor_pool_placement_groups' => :'sharedProcessorPoolPlacementGroups',
    :'status' => :'status',
    :'status_detail' => :'statusDetail',
    :'user_tags' => :'userTags'
  }
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



348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 348

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



111
112
113
114
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 111

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

.openapi_typesObject

Attribute type mapping.



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

def self.openapi_types
  {
    :'allocated_cores' => :'Float',
    :'available_cores' => :'Float',
    :'creation_date' => :'Time',
    :'crn' => :'String',
    :'dedicated_host_id' => :'String',
    :'host_group' => :'String',
    :'host_id' => :'Integer',
    :'id' => :'String',
    :'name' => :'String',
    :'reserved_cores' => :'Integer',
    :'shared_processor_pool_placement_groups' => :'Array<SharedProcessorPoolPlacementGroup>',
    :'status' => :'String',
    :'status_detail' => :'String',
    :'user_tags' => :'Array<String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 314

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      allocated_cores == o.allocated_cores &&
      available_cores == o.available_cores &&
      creation_date == o.creation_date &&
      crn == o.crn &&
      dedicated_host_id == o.dedicated_host_id &&
      host_group == o.host_group &&
      host_id == o.host_id &&
      id == o.id &&
      name == o.name &&
      reserved_cores == o.reserved_cores &&
      shared_processor_pool_placement_groups == o.shared_processor_pool_placement_groups &&
      status == o.status &&
      status_detail == o.status_detail &&
      user_tags == o.user_tags
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


335
336
337
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 335

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



341
342
343
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 341

def hash
  [allocated_cores, available_cores, creation_date, crn, dedicated_host_id, host_group, host_id, id, name, reserved_cores, shared_processor_pool_placement_groups, status, status_detail, user_tags].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 205

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

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

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

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

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

  if !@user_tags.nil? && @user_tags.length > 100
    invalid_properties.push('invalid value for "user_tags", number of items must be less than or equal to 100.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 370

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



237
238
239
240
241
242
243
244
245
246
# File 'lib/ibm_cloud_power/models/shared_processor_pool.rb', line 237

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @allocated_cores.nil?
  return false if @available_cores.nil?
  return false if @id.nil?
  return false if @name.nil?
  return false if @reserved_cores.nil?
  return false if !@user_tags.nil? && @user_tags.length > 100
  true
end