Class: OCI::UsageApi::Models::UsageSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/usage_api/models/usage_summary.rb

Overview

The usage store result.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UsageSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :tenant_id (String)

    The value to assign to the #tenant_id property

  • :tenant_name (String)

    The value to assign to the #tenant_name property

  • :compartment_id (String)

    The value to assign to the #compartment_id property

  • :compartment_path (String)

    The value to assign to the #compartment_path property

  • :compartment_name (String)

    The value to assign to the #compartment_name property

  • :service (String)

    The value to assign to the #service property

  • :resource_name (String)

    The value to assign to the #resource_name property

  • :resource_id (String)

    The value to assign to the #resource_id property

  • :region (String)

    The value to assign to the #region property

  • :ad (String)

    The value to assign to the #ad property

  • :weight (Float)

    The value to assign to the #weight property

  • :shape (String)

    The value to assign to the #shape property

  • :sku_part_number (String)

    The value to assign to the #sku_part_number property

  • :sku_name (String)

    The value to assign to the #sku_name property

  • :unit (String)

    The value to assign to the #unit property

  • :discount (Float)

    The value to assign to the #discount property

  • :list_rate (Float)

    The value to assign to the #list_rate property

  • :platform (String)

    The value to assign to the #platform property

  • :time_usage_started (DateTime)

    The value to assign to the #time_usage_started property

  • :time_usage_ended (DateTime)

    The value to assign to the #time_usage_ended property

  • :computed_amount (Float)

    The value to assign to the #computed_amount property

  • :computed_quantity (Float)

    The value to assign to the #computed_quantity property

  • :overages_flag (String)

    The value to assign to the #overages_flag property

  • :unit_price (Float)

    The value to assign to the #unit_price property

  • :currency (String)

    The value to assign to the #currency property

  • :subscription_id (String)

    The value to assign to the #subscription_id property

  • :overage (String)

    The value to assign to the #overage property

  • :is_forecast (BOOLEAN)

    The value to assign to the #is_forecast property

  • :tags (Array<OCI::UsageApi::Models::Tag>)

    The value to assign to the #tags property



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
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
# File 'lib/oci/usage_api/models/usage_summary.rb', line 235

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

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

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

  self.tenant_name = attributes[:'tenantName'] if attributes[:'tenantName']

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

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

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

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

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

  self.compartment_path = attributes[:'compartmentPath'] if attributes[:'compartmentPath']

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

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

  self.compartment_name = attributes[:'compartmentName'] if attributes[:'compartmentName']

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

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

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

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

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

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

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

  self.sku_part_number = attributes[:'skuPartNumber'] if attributes[:'skuPartNumber']

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

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

  self.sku_name = attributes[:'skuName'] if attributes[:'skuName']

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

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

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

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

  self.list_rate = attributes[:'listRate'] if attributes[:'listRate']

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

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

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

  self.time_usage_started = attributes[:'timeUsageStarted'] if attributes[:'timeUsageStarted']

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

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

  self.time_usage_ended = attributes[:'timeUsageEnded'] if attributes[:'timeUsageEnded']

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

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

  self.computed_amount = attributes[:'computedAmount'] if attributes[:'computedAmount']

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

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

  self.computed_quantity = attributes[:'computedQuantity'] if attributes[:'computedQuantity']

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

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

  self.overages_flag = attributes[:'overagesFlag'] if attributes[:'overagesFlag']

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

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

  self.unit_price = attributes[:'unitPrice'] if attributes[:'unitPrice']

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

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

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

  self.subscription_id = attributes[:'subscriptionId'] if attributes[:'subscriptionId']

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

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

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

  self.is_forecast = attributes[:'isForecast'] unless attributes[:'isForecast'].nil?

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

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

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

Instance Attribute Details

#adString

The availability domain of the usage.

Returns:

  • (String)


48
49
50
# File 'lib/oci/usage_api/models/usage_summary.rb', line 48

def ad
  @ad
end

#compartment_idString

The compartment OCID.

Returns:

  • (String)


20
21
22
# File 'lib/oci/usage_api/models/usage_summary.rb', line 20

def compartment_id
  @compartment_id
end

#compartment_nameString

The compartment name.

Returns:

  • (String)


28
29
30
# File 'lib/oci/usage_api/models/usage_summary.rb', line 28

def compartment_name
  @compartment_name
end

#compartment_pathString

The compartment path, starting from root.

Returns:

  • (String)


24
25
26
# File 'lib/oci/usage_api/models/usage_summary.rb', line 24

def compartment_path
  @compartment_path
end

#computed_amountFloat

The computed cost.

Returns:

  • (Float)


92
93
94
# File 'lib/oci/usage_api/models/usage_summary.rb', line 92

def computed_amount
  @computed_amount
end

#computed_quantityFloat

The usage number.

Returns:

  • (Float)


96
97
98
# File 'lib/oci/usage_api/models/usage_summary.rb', line 96

def computed_quantity
  @computed_quantity
end

#currencyString

The price currency.

Returns:

  • (String)


108
109
110
# File 'lib/oci/usage_api/models/usage_summary.rb', line 108

def currency
  @currency
end

#discountFloat

The discretionary discount applied to the SKU.

Returns:

  • (Float)


72
73
74
# File 'lib/oci/usage_api/models/usage_summary.rb', line 72

def discount
  @discount
end

#is_forecastBOOLEAN

The forecasted data.

Returns:

  • (BOOLEAN)


120
121
122
# File 'lib/oci/usage_api/models/usage_summary.rb', line 120

def is_forecast
  @is_forecast
end

#list_rateFloat

The SKU list rate (not discount).

Returns:

  • (Float)


76
77
78
# File 'lib/oci/usage_api/models/usage_summary.rb', line 76

def list_rate
  @list_rate
end

#overageString

The overage usage.

Returns:

  • (String)


116
117
118
# File 'lib/oci/usage_api/models/usage_summary.rb', line 116

def overage
  @overage
end

#overages_flagString

The SPM OverageFlag.

Returns:

  • (String)


100
101
102
# File 'lib/oci/usage_api/models/usage_summary.rb', line 100

def overages_flag
  @overages_flag
end

#platformString

Platform for the cost.

Returns:

  • (String)


80
81
82
# File 'lib/oci/usage_api/models/usage_summary.rb', line 80

def platform
  @platform
end

#regionString

The region of the usage.

Returns:

  • (String)


44
45
46
# File 'lib/oci/usage_api/models/usage_summary.rb', line 44

def region
  @region
end

#resource_idString

The resource OCID that is incurring the cost.

Returns:

  • (String)


40
41
42
# File 'lib/oci/usage_api/models/usage_summary.rb', line 40

def resource_id
  @resource_id
end

#resource_nameString

The resource name that is incurring the cost.

Returns:

  • (String)


36
37
38
# File 'lib/oci/usage_api/models/usage_summary.rb', line 36

def resource_name
  @resource_name
end

#serviceString

The service name that is incurring the cost.

Returns:

  • (String)


32
33
34
# File 'lib/oci/usage_api/models/usage_summary.rb', line 32

def service
  @service
end

#shapeString

The resource shape.

Returns:

  • (String)


56
57
58
# File 'lib/oci/usage_api/models/usage_summary.rb', line 56

def shape
  @shape
end

#sku_nameString

The SKU friendly name.

Returns:

  • (String)


64
65
66
# File 'lib/oci/usage_api/models/usage_summary.rb', line 64

def sku_name
  @sku_name
end

#sku_part_numberString

The SKU part number.

Returns:

  • (String)


60
61
62
# File 'lib/oci/usage_api/models/usage_summary.rb', line 60

def sku_part_number
  @sku_part_number
end

#subscription_idString

The subscription ID.

Returns:

  • (String)


112
113
114
# File 'lib/oci/usage_api/models/usage_summary.rb', line 112

def subscription_id
  @subscription_id
end

#tagsArray<OCI::UsageApi::Models::Tag>

For grouping, a tag definition. For filtering, a definition and key.

Returns:



124
125
126
# File 'lib/oci/usage_api/models/usage_summary.rb', line 124

def tags
  @tags
end

#tenant_idString

The tenancy OCID.

Returns:

  • (String)


12
13
14
# File 'lib/oci/usage_api/models/usage_summary.rb', line 12

def tenant_id
  @tenant_id
end

#tenant_nameString

The tenancy name.

Returns:

  • (String)


16
17
18
# File 'lib/oci/usage_api/models/usage_summary.rb', line 16

def tenant_name
  @tenant_name
end

#time_usage_endedDateTime

**[Required]** The usage end time.

Returns:

  • (DateTime)


88
89
90
# File 'lib/oci/usage_api/models/usage_summary.rb', line 88

def time_usage_ended
  @time_usage_ended
end

#time_usage_startedDateTime

**[Required]** The usage start time.

Returns:

  • (DateTime)


84
85
86
# File 'lib/oci/usage_api/models/usage_summary.rb', line 84

def time_usage_started
  @time_usage_started
end

#unitString

The usage unit.

Returns:

  • (String)


68
69
70
# File 'lib/oci/usage_api/models/usage_summary.rb', line 68

def unit
  @unit
end

#unit_priceFloat

The price per unit.

Returns:

  • (Float)


104
105
106
# File 'lib/oci/usage_api/models/usage_summary.rb', line 104

def unit_price
  @unit_price
end

#weightFloat

The resource size being metered.

Returns:

  • (Float)


52
53
54
# File 'lib/oci/usage_api/models/usage_summary.rb', line 52

def weight
  @weight
end

Class Method Details

.attribute_mapObject

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



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
# File 'lib/oci/usage_api/models/usage_summary.rb', line 127

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'tenant_id': :'tenantId',
    'tenant_name': :'tenantName',
    'compartment_id': :'compartmentId',
    'compartment_path': :'compartmentPath',
    'compartment_name': :'compartmentName',
    'service': :'service',
    'resource_name': :'resourceName',
    'resource_id': :'resourceId',
    'region': :'region',
    'ad': :'ad',
    'weight': :'weight',
    'shape': :'shape',
    'sku_part_number': :'skuPartNumber',
    'sku_name': :'skuName',
    'unit': :'unit',
    'discount': :'discount',
    'list_rate': :'listRate',
    'platform': :'platform',
    'time_usage_started': :'timeUsageStarted',
    'time_usage_ended': :'timeUsageEnded',
    'computed_amount': :'computedAmount',
    'computed_quantity': :'computedQuantity',
    'overages_flag': :'overagesFlag',
    'unit_price': :'unitPrice',
    'currency': :'currency',
    'subscription_id': :'subscriptionId',
    'overage': :'overage',
    'is_forecast': :'isForecast',
    'tags': :'tags'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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
# File 'lib/oci/usage_api/models/usage_summary.rb', line 164

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'tenant_id': :'String',
    'tenant_name': :'String',
    'compartment_id': :'String',
    'compartment_path': :'String',
    'compartment_name': :'String',
    'service': :'String',
    'resource_name': :'String',
    'resource_id': :'String',
    'region': :'String',
    'ad': :'String',
    'weight': :'Float',
    'shape': :'String',
    'sku_part_number': :'String',
    'sku_name': :'String',
    'unit': :'String',
    'discount': :'Float',
    'list_rate': :'Float',
    'platform': :'String',
    'time_usage_started': :'DateTime',
    'time_usage_ended': :'DateTime',
    'computed_amount': :'Float',
    'computed_quantity': :'Float',
    'overages_flag': :'String',
    'unit_price': :'Float',
    'currency': :'String',
    'subscription_id': :'String',
    'overage': :'String',
    'is_forecast': :'BOOLEAN',
    'tags': :'Array<OCI::UsageApi::Models::Tag>'
    # 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



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
# File 'lib/oci/usage_api/models/usage_summary.rb', line 379

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

  self.class == other.class &&
    tenant_id == other.tenant_id &&
    tenant_name == other.tenant_name &&
    compartment_id == other.compartment_id &&
    compartment_path == other.compartment_path &&
    compartment_name == other.compartment_name &&
    service == other.service &&
    resource_name == other.resource_name &&
    resource_id == other.resource_id &&
    region == other.region &&
    ad == other.ad &&
    weight == other.weight &&
    shape == other.shape &&
    sku_part_number == other.sku_part_number &&
    sku_name == other.sku_name &&
    unit == other.unit &&
    discount == other.discount &&
    list_rate == other.list_rate &&
    platform == other.platform &&
    time_usage_started == other.time_usage_started &&
    time_usage_ended == other.time_usage_ended &&
    computed_amount == other.computed_amount &&
    computed_quantity == other.computed_quantity &&
    overages_flag == other.overages_flag &&
    unit_price == other.unit_price &&
    currency == other.currency &&
    subscription_id == other.subscription_id &&
    overage == other.overage &&
    is_forecast == other.is_forecast &&
    tags == other.tags
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



437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
# File 'lib/oci/usage_api/models/usage_summary.rb', line 437

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


417
418
419
# File 'lib/oci/usage_api/models/usage_summary.rb', line 417

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



426
427
428
# File 'lib/oci/usage_api/models/usage_summary.rb', line 426

def hash
  [tenant_id, tenant_name, compartment_id, compartment_path, compartment_name, service, resource_name, resource_id, region, ad, weight, shape, sku_part_number, sku_name, unit, discount, list_rate, platform, time_usage_started, time_usage_ended, computed_amount, computed_quantity, overages_flag, unit_price, currency, subscription_id, overage, is_forecast, tags].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



470
471
472
473
474
475
476
477
478
479
# File 'lib/oci/usage_api/models/usage_summary.rb', line 470

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



464
465
466
# File 'lib/oci/usage_api/models/usage_summary.rb', line 464

def to_s
  to_hash.to_s
end