Class: OCI::Onesubscription::Models::ComputedUsageAggregation

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

Overview

Computed Usage Aggregation 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 = {}) ⇒ ComputedUsageAggregation

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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

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

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

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

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

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

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

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

Instance Attribute Details

#cost ⇒ String

Sum of Computed Line Amount rounded

Returns:

  • (String)


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

def cost
  @cost
end

#cost_unrounded ⇒ String

Sum of Computed Line Amount unrounded

Returns:

  • (String)


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

def cost_unrounded
  @cost_unrounded
end

#data_center ⇒ String

Data Center Attribute as sent by MQS to SPM.

Returns:

  • (String)


43
44
45
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 43

def data_center
  @data_center
end

#net_unit_price ⇒ String

Net Unit Price for the product in consideration.

Returns:

  • (String)


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

def net_unit_price
  @net_unit_price
end

#product ⇒ OCI::Onesubscription::Models::ComputedUsageProduct



38
39
40
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 38

def product
  @product
end

#quantity ⇒ String

Total Quantity that was used for computation

Returns:

  • (String)


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

def quantity
  @quantity
end

#time_metered_on ⇒ DateTime

Metered Service date , expressed in RFC 3339 timestamp format.

Returns:

  • (DateTime)


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

def time_metered_on
  @time_metered_on
end

#type ⇒ String

Usage compute type in SPM.

Returns:

  • (String)


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

def type
  @type
end

Class Method Details

.attribute_map ⇒ Object

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 71

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'quantity': :'quantity',
    'product': :'product',
    'data_center': :'dataCenter',
    'time_metered_on': :'timeMeteredOn',
    'net_unit_price': :'netUnitPrice',
    'cost_unrounded': :'costUnrounded',
    'cost': :'cost',
    'type': :'type'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_types ⇒ Object

Attribute type mapping.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 87

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'quantity': :'String',
    'product': :'OCI::Onesubscription::Models::ComputedUsageProduct',
    'data_center': :'String',
    'time_metered_on': :'DateTime',
    'net_unit_price': :'String',
    'cost_unrounded': :'String',
    'cost': :'String',
    'type': :'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



175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 175

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

  self.class == other.class &&
    quantity == other.quantity &&
    product == other.product &&
    data_center == other.data_center &&
    time_metered_on == other.time_metered_on &&
    net_unit_price == other.net_unit_price &&
    cost_unrounded == other.cost_unrounded &&
    cost == other.cost &&
    type == other.type
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



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 212

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


192
193
194
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 192

def eql?(other)
  self == other
end

#hash ⇒ Fixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum) —

    Hash code



201
202
203
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 201

def hash
  [quantity, product, data_center, time_metered_on, net_unit_price, cost_unrounded, cost, type].hash
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



245
246
247
248
249
250
251
252
253
254
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 245

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_s ⇒ String

Returns the string representation of the object

Returns:

  • (String) —

    String presentation of the object



239
240
241
# File 'lib/oci/onesubscription/models/computed_usage_aggregation.rb', line 239

def to_s
  to_hash.to_s
end