Class: OCI::Onesubscription::Models::ComputedUsage

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/onesubscription/models/computed_usage.rb

Overview

Computed Usage Summary object

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_PROMOTION = 'PROMOTION'.freeze,
  TYPE_DO_NOT_BILL = 'DO_NOT_BILL'.freeze,
  TYPE_USAGE = 'USAGE'.freeze,
  TYPE_COMMIT = 'COMMIT'.freeze,
  TYPE_OVERAGE = 'OVERAGE'.freeze,
  TYPE_PAY_AS_YOU_GO = 'PAY_AS_YOU_GO'.freeze,
  TYPE_MONTHLY_MINIMUM = 'MONTHLY_MINIMUM'.freeze,
  TYPE_DELAYED_USAGE_INVOICE_TIMING = 'DELAYED_USAGE_INVOICE_TIMING'.freeze,
  TYPE_DELAYED_USAGE_COMMITMENT_EXP = 'DELAYED_USAGE_COMMITMENT_EXP'.freeze,
  TYPE_ON_ACCOUNT_CREDIT = 'ON_ACCOUNT_CREDIT'.freeze,
  TYPE_SERVICE_CREDIT = 'SERVICE_CREDIT'.freeze,
  TYPE_COMMITMENT_EXPIRATION = 'COMMITMENT_EXPIRATION'.freeze,
  TYPE_FUNDED_ALLOCATION = 'FUNDED_ALLOCATION'.freeze,
  TYPE_DONOT_BILL_USAGE_POST_TERMINATION = 'DONOT_BILL_USAGE_POST_TERMINATION'.freeze,
  TYPE_DELAYED_USAGE_POST_TERMINATION = 'DELAYED_USAGE_POST_TERMINATION'.freeze,
  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 = {}) ⇒ ComputedUsage

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 250

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.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

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

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

  self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']

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

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

  self.parent_subscribed_service_id = attributes[:'parentSubscribedServiceId'] if attributes[:'parentSubscribedServiceId']

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

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

  self.parent_product = attributes[:'parentProduct'] if attributes[:'parentProduct']

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

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

  self.plan_number = attributes[:'planNumber'] if attributes[:'planNumber']

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

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

  self.currency_code = attributes[:'currencyCode'] if attributes[:'currencyCode']

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

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

  self.rate_card_tierd_id = attributes[:'rateCardTierdId'] if attributes[:'rateCardTierdId']

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

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

  self.rate_card_id = attributes[:'rateCardId'] if attributes[:'rateCardId']

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

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

  self.compute_source = attributes[:'computeSource'] if attributes[:'computeSource']

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

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

  self.data_center = attributes[:'dataCenter'] if attributes[:'dataCenter']

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

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

  self.mqs_message_id = attributes[:'mqsMessageId'] if attributes[:'mqsMessageId']

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

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

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

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

  self.usage_number = attributes[:'usageNumber'] if attributes[:'usageNumber']

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

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

  self.original_usage_number = attributes[:'originalUsageNumber'] if attributes[:'originalUsageNumber']

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

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

  self.commitment_service_id = attributes[:'commitmentServiceId'] if attributes[:'commitmentServiceId']

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

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

  self.is_invoiced = attributes[:'isInvoiced'] unless attributes[:'isInvoiced'].nil?

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

  self.is_invoiced = attributes[:'is_invoiced'] unless attributes[:'is_invoiced'].nil?

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

  self.time_of_arrival = attributes[:'timeOfArrival'] if attributes[:'timeOfArrival']

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

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

  self.time_metered_on = attributes[:'timeMeteredOn'] if attributes[:'timeMeteredOn']

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

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

  self.net_unit_price = attributes[:'netUnitPrice'] if attributes[:'netUnitPrice']

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

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

  self.cost_rounded = attributes[:'costRounded'] if attributes[:'costRounded']

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

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

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

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

  self.unit_of_measure = attributes[:'unitOfMeasure'] if attributes[:'unitOfMeasure']

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

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

Instance Attribute Details

#commitment_service_idString

Subscribed service commitmentId.

Returns:

  • (String)


108
109
110
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 108

def commitment_service_id
  @commitment_service_id
end

#compute_sourceString

SPM Internal compute records source .

Returns:

  • (String)


73
74
75
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 73

def compute_source
  @compute_source
end

#costString

Computed Line Amount not rounded

Returns:

  • (String)


143
144
145
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 143

def cost
  @cost
end

#cost_roundedString

Computed Line Amount rounded.

Returns:

  • (String)


138
139
140
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 138

def cost_rounded
  @cost_rounded
end

#currency_codeString

Currency code

Returns:

  • (String)


58
59
60
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 58

def currency_code
  @currency_code
end

#data_centerString

Data Center Attribute as sent by MQS to SPM.

Returns:

  • (String)


78
79
80
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 78

def data_center
  @data_center
end

#idString

[Required] SPM Internal computed usage Id , 32 character string

Returns:

  • (String)


88
89
90
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 88

def id
  @id
end

#is_invoicedBOOLEAN

Invoicing status for the aggregated compute usage

Returns:

  • (BOOLEAN)


113
114
115
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 113

def is_invoiced
  @is_invoiced
end

#mqs_message_idString

MQS Identfier send to SPM , SPM does not transform this attribute and is received as is.

Returns:

  • (String)


83
84
85
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 83

def mqs_message_id
  @mqs_message_id
end

#net_unit_priceString

Net Unit Price for the product in consideration, price actual.

Returns:

  • (String)


133
134
135
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 133

def net_unit_price
  @net_unit_price
end

#original_usage_numberString

SPM Internal Original usage Line number identifier in SPM coming from Metered Services entity.

Returns:

  • (String)


103
104
105
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 103

def original_usage_number
  @original_usage_number
end

#parent_productOCI::Onesubscription::Models::ComputedUsageProduct



48
49
50
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 48

def parent_product
  @parent_product
end

#parent_subscribed_service_idString

Subscribed service line parent id

Returns:

  • (String)


45
46
47
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 45

def parent_subscribed_service_id
  @parent_subscribed_service_id
end

#plan_numberString

Subscription plan number

Returns:

  • (String)


53
54
55
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 53

def plan_number
  @plan_number
end

#productOCI::Onesubscription::Models::ComputedUsageProduct



146
147
148
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 146

def product
  @product
end

#quantityString

Total Quantity that was used for computation

Returns:

  • (String)


93
94
95
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 93

def quantity
  @quantity
end

#rate_card_idString

Ratecard Id at subscribed service level

Returns:

  • (String)


68
69
70
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 68

def rate_card_id
  @rate_card_id
end

#rate_card_tierd_idString

References the tier in the ratecard for that usage (OCI will be using the same reference to cross-reference for correctness on the usage csv report), comes from Entity OBSCNTR_IPT_PRODUCTTIER.

Returns:

  • (String)


63
64
65
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 63

def rate_card_tierd_id
  @rate_card_tierd_id
end

#time_createdDateTime

Computed Usage created time, expressed in RFC 3339 timestamp format.

Returns:

  • (DateTime)


35
36
37
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 35

def time_created
  @time_created
end

#time_metered_onDateTime

Metered Service date, expressed in RFC 3339 timestamp format.

Returns:

  • (DateTime)


128
129
130
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 128

def time_metered_on
  @time_metered_on
end

#time_of_arrivalDateTime

Usae computation date, expressed in RFC 3339 timestamp format.

Returns:

  • (DateTime)


123
124
125
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 123

def time_of_arrival
  @time_of_arrival
end

#time_updatedDateTime

Computed Usage updated time, expressed in RFC 3339 timestamp format.

Returns:

  • (DateTime)


40
41
42
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 40

def time_updated
  @time_updated
end

#typeString

Usage compute type in SPM.

Returns:

  • (String)


118
119
120
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 118

def type
  @type
end

#unit_of_measureString

Unit of Messure

Returns:

  • (String)


151
152
153
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 151

def unit_of_measure
  @unit_of_measure
end

#usage_numberString

SPM Internal usage Line number identifier in SPM coming from Metered Services entity.

Returns:

  • (String)


98
99
100
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 98

def usage_number
  @usage_number
end

Class Method Details

.attribute_mapObject

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



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
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 154

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'parent_subscribed_service_id': :'parentSubscribedServiceId',
    'parent_product': :'parentProduct',
    'plan_number': :'planNumber',
    'currency_code': :'currencyCode',
    'rate_card_tierd_id': :'rateCardTierdId',
    'rate_card_id': :'rateCardId',
    'compute_source': :'computeSource',
    'data_center': :'dataCenter',
    'mqs_message_id': :'mqsMessageId',
    'id': :'id',
    'quantity': :'quantity',
    'usage_number': :'usageNumber',
    'original_usage_number': :'originalUsageNumber',
    'commitment_service_id': :'commitmentServiceId',
    'is_invoiced': :'isInvoiced',
    'type': :'type',
    'time_of_arrival': :'timeOfArrival',
    'time_metered_on': :'timeMeteredOn',
    'net_unit_price': :'netUnitPrice',
    'cost_rounded': :'costRounded',
    'cost': :'cost',
    'product': :'product',
    'unit_of_measure': :'unitOfMeasure'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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/onesubscription/models/computed_usage.rb', line 187

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'parent_subscribed_service_id': :'String',
    'parent_product': :'OCI::Onesubscription::Models::ComputedUsageProduct',
    'plan_number': :'String',
    'currency_code': :'String',
    'rate_card_tierd_id': :'String',
    'rate_card_id': :'String',
    'compute_source': :'String',
    'data_center': :'String',
    'mqs_message_id': :'String',
    'id': :'String',
    'quantity': :'String',
    'usage_number': :'String',
    'original_usage_number': :'String',
    'commitment_service_id': :'String',
    'is_invoiced': :'BOOLEAN',
    'type': :'String',
    'time_of_arrival': :'DateTime',
    'time_metered_on': :'DateTime',
    'net_unit_price': :'String',
    'cost_rounded': :'String',
    'cost': :'String',
    'product': :'OCI::Onesubscription::Models::ComputedUsageProduct',
    'unit_of_measure': :'String'
    # 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



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 407

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

  self.class == other.class &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    parent_subscribed_service_id == other.parent_subscribed_service_id &&
    parent_product == other.parent_product &&
    plan_number == other.plan_number &&
    currency_code == other.currency_code &&
    rate_card_tierd_id == other.rate_card_tierd_id &&
    rate_card_id == other.rate_card_id &&
    compute_source == other.compute_source &&
    data_center == other.data_center &&
    mqs_message_id == other.mqs_message_id &&
    id == other.id &&
    quantity == other.quantity &&
    usage_number == other.usage_number &&
    original_usage_number == other.original_usage_number &&
    commitment_service_id == other.commitment_service_id &&
    is_invoiced == other.is_invoiced &&
    type == other.type &&
    time_of_arrival == other.time_of_arrival &&
    time_metered_on == other.time_metered_on &&
    net_unit_price == other.net_unit_price &&
    cost_rounded == other.cost_rounded &&
    cost == other.cost &&
    product == other.product &&
    unit_of_measure == other.unit_of_measure
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



461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 461

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


441
442
443
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 441

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



450
451
452
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 450

def hash
  [time_created, time_updated, parent_subscribed_service_id, parent_product, plan_number, currency_code, rate_card_tierd_id, rate_card_id, compute_source, data_center, mqs_message_id, id, quantity, usage_number, original_usage_number, commitment_service_id, is_invoiced, type, time_of_arrival, time_metered_on, net_unit_price, cost_rounded, cost, product, unit_of_measure].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



494
495
496
497
498
499
500
501
502
503
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 494

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



488
489
490
# File 'lib/oci/onesubscription/models/computed_usage.rb', line 488

def to_s
  to_hash.to_s
end