Class: OCI::LicenseManager::Models::ProductLicenseConsumerSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/license_manager/models/product_license_consumer_summary.rb

Overview

Details of a resource that is consuming a particular product license.

Constant Summary collapse

RESOURCE_UNIT_TYPE_ENUM =
[
  RESOURCE_UNIT_TYPE_OCPU = 'OCPU'.freeze,
  RESOURCE_UNIT_TYPE_ECPU = 'ECPU'.freeze,
  RESOURCE_UNIT_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LICENSE_UNIT_TYPE_ENUM =
[
  LICENSE_UNIT_TYPE_OCPU = 'OCPU'.freeze,
  LICENSE_UNIT_TYPE_NAMED_USER_PLUS = 'NAMED_USER_PLUS'.freeze,
  LICENSE_UNIT_TYPE_PROCESSORS = 'PROCESSORS'.freeze,
  LICENSE_UNIT_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ProductLicenseConsumerSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 132

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.resource_id = attributes[:'resourceId'] if attributes[:'resourceId']

  raise 'You cannot provide both :resourceId and :resource_id' if attributes.key?(:'resourceId') && attributes.key?(:'resource_id')

  self.resource_id = attributes[:'resource_id'] if attributes[:'resource_id']

  self.resource_name = attributes[:'resourceName'] if attributes[:'resourceName']

  raise 'You cannot provide both :resourceName and :resource_name' if attributes.key?(:'resourceName') && attributes.key?(:'resource_name')

  self.resource_name = attributes[:'resource_name'] if attributes[:'resource_name']

  self.product_name = attributes[:'productName'] if attributes[:'productName']

  raise 'You cannot provide both :productName and :product_name' if attributes.key?(:'productName') && attributes.key?(:'product_name')

  self.product_name = attributes[:'product_name'] if attributes[:'product_name']

  self.resource_compartment_id = attributes[:'resourceCompartmentId'] if attributes[:'resourceCompartmentId']

  raise 'You cannot provide both :resourceCompartmentId and :resource_compartment_id' if attributes.key?(:'resourceCompartmentId') && attributes.key?(:'resource_compartment_id')

  self.resource_compartment_id = attributes[:'resource_compartment_id'] if attributes[:'resource_compartment_id']

  self.resource_compartment_name = attributes[:'resourceCompartmentName'] if attributes[:'resourceCompartmentName']

  raise 'You cannot provide both :resourceCompartmentName and :resource_compartment_name' if attributes.key?(:'resourceCompartmentName') && attributes.key?(:'resource_compartment_name')

  self.resource_compartment_name = attributes[:'resource_compartment_name'] if attributes[:'resource_compartment_name']

  self.resource_unit_type = attributes[:'resourceUnitType'] if attributes[:'resourceUnitType']

  raise 'You cannot provide both :resourceUnitType and :resource_unit_type' if attributes.key?(:'resourceUnitType') && attributes.key?(:'resource_unit_type')

  self.resource_unit_type = attributes[:'resource_unit_type'] if attributes[:'resource_unit_type']

  self.resource_unit_count = attributes[:'resourceUnitCount'] if attributes[:'resourceUnitCount']
  self.resource_unit_count = 0.0 if resource_unit_count.nil? && !attributes.key?(:'resourceUnitCount') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :resourceUnitCount and :resource_unit_count' if attributes.key?(:'resourceUnitCount') && attributes.key?(:'resource_unit_count')

  self.resource_unit_count = attributes[:'resource_unit_count'] if attributes[:'resource_unit_count']
  self.resource_unit_count = 0.0 if resource_unit_count.nil? && !attributes.key?(:'resourceUnitCount') && !attributes.key?(:'resource_unit_count') # rubocop:disable Style/StringLiterals

  self.license_unit_type = attributes[:'licenseUnitType'] if attributes[:'licenseUnitType']

  raise 'You cannot provide both :licenseUnitType and :license_unit_type' if attributes.key?(:'licenseUnitType') && attributes.key?(:'license_unit_type')

  self.license_unit_type = attributes[:'license_unit_type'] if attributes[:'license_unit_type']

  self.license_units_consumed = attributes[:'licenseUnitsConsumed'] if attributes[:'licenseUnitsConsumed']
  self.license_units_consumed = 0.0 if license_units_consumed.nil? && !attributes.key?(:'licenseUnitsConsumed') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :licenseUnitsConsumed and :license_units_consumed' if attributes.key?(:'licenseUnitsConsumed') && attributes.key?(:'license_units_consumed')

  self.license_units_consumed = attributes[:'license_units_consumed'] if attributes[:'license_units_consumed']
  self.license_units_consumed = 0.0 if license_units_consumed.nil? && !attributes.key?(:'licenseUnitsConsumed') && !attributes.key?(:'license_units_consumed') # rubocop:disable Style/StringLiterals

  self.is_base_license_available = attributes[:'isBaseLicenseAvailable'] unless attributes[:'isBaseLicenseAvailable'].nil?
  self.is_base_license_available = false if is_base_license_available.nil? && !attributes.key?(:'isBaseLicenseAvailable') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :isBaseLicenseAvailable and :is_base_license_available' if attributes.key?(:'isBaseLicenseAvailable') && attributes.key?(:'is_base_license_available')

  self.is_base_license_available = attributes[:'is_base_license_available'] unless attributes[:'is_base_license_available'].nil?
  self.is_base_license_available = false if is_base_license_available.nil? && !attributes.key?(:'isBaseLicenseAvailable') && !attributes.key?(:'is_base_license_available') # rubocop:disable Style/StringLiterals

  self.are_all_options_available = attributes[:'areAllOptionsAvailable'] unless attributes[:'areAllOptionsAvailable'].nil?
  self.are_all_options_available = false if are_all_options_available.nil? && !attributes.key?(:'areAllOptionsAvailable') # rubocop:disable Style/StringLiterals

  raise 'You cannot provide both :areAllOptionsAvailable and :are_all_options_available' if attributes.key?(:'areAllOptionsAvailable') && attributes.key?(:'are_all_options_available')

  self.are_all_options_available = attributes[:'are_all_options_available'] unless attributes[:'are_all_options_available'].nil?
  self.are_all_options_available = false if are_all_options_available.nil? && !attributes.key?(:'areAllOptionsAvailable') && !attributes.key?(:'are_all_options_available') # rubocop:disable Style/StringLiterals

  self.missing_products = attributes[:'missingProducts'] if attributes[:'missingProducts']

  raise 'You cannot provide both :missingProducts and :missing_products' if attributes.key?(:'missingProducts') && attributes.key?(:'missing_products')

  self.missing_products = attributes[:'missing_products'] if attributes[:'missing_products']
end

Instance Attribute Details

#are_all_options_availableBOOLEAN

[Required] Specifies if all options are available.

Returns:

  • (BOOLEAN)


68
69
70
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 68

def are_all_options_available
  @are_all_options_available
end

#is_base_license_availableBOOLEAN

[Required] Specifies if the base license is available.

Returns:

  • (BOOLEAN)


64
65
66
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 64

def is_base_license_available
  @is_base_license_available
end

#license_unit_typeString

[Required] The product license unit.

Returns:

  • (String)


56
57
58
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 56

def license_unit_type
  @license_unit_type
end

#license_units_consumedFloat

[Required] Number of license units consumed by the resource.

Returns:

  • (Float)


60
61
62
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 60

def license_units_consumed
  @license_units_consumed
end

#missing_productsArray<OCI::LicenseManager::Models::Product>

[Required] Collection of missing product licenses.



72
73
74
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 72

def missing_products
  @missing_products
end

#product_nameString

[Required] The resource product name.

Returns:

  • (String)


36
37
38
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 36

def product_name
  @product_name
end

#resource_compartment_idString

[Required] The OCID of the compartment that contains the resource.

Returns:

  • (String)


40
41
42
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 40

def resource_compartment_id
  @resource_compartment_id
end

#resource_compartment_nameString

[Required] The display name of the compartment that contains the resource.

Returns:

  • (String)


44
45
46
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 44

def resource_compartment_name
  @resource_compartment_name
end

#resource_idString

[Required] The OCID of the resource.

Returns:

  • (String)


28
29
30
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 28

def resource_id
  @resource_id
end

#resource_nameString

[Required] The display name of the resource.

Returns:

  • (String)


32
33
34
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 32

def resource_name
  @resource_name
end

#resource_unit_countFloat

[Required] Number of units of the resource

Returns:

  • (Float)


52
53
54
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 52

def resource_unit_count
  @resource_unit_count
end

#resource_unit_typeString

[Required] The unit type for the resource.

Returns:

  • (String)


48
49
50
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 48

def resource_unit_type
  @resource_unit_type
end

Class Method Details

.attribute_mapObject

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



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 75

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_id': :'resourceId',
    'resource_name': :'resourceName',
    'product_name': :'productName',
    'resource_compartment_id': :'resourceCompartmentId',
    'resource_compartment_name': :'resourceCompartmentName',
    'resource_unit_type': :'resourceUnitType',
    'resource_unit_count': :'resourceUnitCount',
    'license_unit_type': :'licenseUnitType',
    'license_units_consumed': :'licenseUnitsConsumed',
    'is_base_license_available': :'isBaseLicenseAvailable',
    'are_all_options_available': :'areAllOptionsAvailable',
    'missing_products': :'missingProducts'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 95

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_id': :'String',
    'resource_name': :'String',
    'product_name': :'String',
    'resource_compartment_id': :'String',
    'resource_compartment_name': :'String',
    'resource_unit_type': :'String',
    'resource_unit_count': :'Float',
    'license_unit_type': :'String',
    'license_units_consumed': :'Float',
    'is_base_license_available': :'BOOLEAN',
    'are_all_options_available': :'BOOLEAN',
    'missing_products': :'Array<OCI::LicenseManager::Models::Product>'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 252

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    resource_id == other.resource_id &&
    resource_name == other.resource_name &&
    product_name == other.product_name &&
    resource_compartment_id == other.resource_compartment_id &&
    resource_compartment_name == other.resource_compartment_name &&
    resource_unit_type == other.resource_unit_type &&
    resource_unit_count == other.resource_unit_count &&
    license_unit_type == other.license_unit_type &&
    license_units_consumed == other.license_units_consumed &&
    is_base_license_available == other.is_base_license_available &&
    are_all_options_available == other.are_all_options_available &&
    missing_products == other.missing_products
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



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 293

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


273
274
275
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 273

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



282
283
284
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 282

def hash
  [resource_id, resource_name, product_name, resource_compartment_id, resource_compartment_name, resource_unit_type, resource_unit_count, license_unit_type, license_units_consumed, is_base_license_available, are_all_options_available, missing_products].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



326
327
328
329
330
331
332
333
334
335
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 326

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



320
321
322
# File 'lib/oci/license_manager/models/product_license_consumer_summary.rb', line 320

def to_s
  to_hash.to_s
end