Class: OCI::Usage::Models::UsageLimitSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/usage/models/usage_limit_summary.rb

Overview

Encapsulates a collection of Hard and Soft Limits for a resource within a subscription.

Constant Summary collapse

ACTION_ENUM =
[
  ACTION_QUOTA_BREACH = 'QUOTA_BREACH'.freeze,
  ACTION_QUOTA_ALERT = 'QUOTA_ALERT'.freeze,
  ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LIMIT_TYPE_ENUM =
[
  LIMIT_TYPE_HARD = 'HARD'.freeze,
  LIMIT_TYPE_SOFT = 'SOFT'.freeze,
  LIMIT_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
VALUE_TYPE_ENUM =
[
  VALUE_TYPE_ABSOLUTE = 'ABSOLUTE'.freeze,
  VALUE_TYPE_PERCENTAGE = 'PERCENTAGE'.freeze,
  VALUE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ UsageLimitSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :time_created (DateTime)

    The value to assign to the #time_created property

  • :entitlement_id (String)

    The value to assign to the #entitlement_id property

  • :id (String)

    The value to assign to the #id property

  • :time_modified (DateTime)

    The value to assign to the #time_modified property

  • :resource_name (String)

    The value to assign to the #resource_name property

  • :service_name (String)

    The value to assign to the #service_name property

  • :limit (String)

    The value to assign to the #limit property

  • :created_by (String)

    The value to assign to the #created_by property

  • :modified_by (String)

    The value to assign to the #modified_by property

  • :action (String)

    The value to assign to the #action property

  • :alert_level (Float)

    The value to assign to the #alert_level property

  • :limit_type (String)

    The value to assign to the #limit_type property

  • :value_type (String)

    The value to assign to the #value_type property

  • :lifecycle_state (String)

    The value to assign to the #lifecycle_state property

  • :max_hard_limit (String)

    The value to assign to the #max_hard_limit property

  • :sku_part_id (String)

    The value to assign to the #sku_part_id property



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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 169

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

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

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

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

  self.time_modified = attributes[:'timeModified'] if attributes[:'timeModified']

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

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

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

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

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

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

  self.created_by = attributes[:'createdBy'] if attributes[:'createdBy']

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

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

  self.modified_by = attributes[:'modifiedBy'] if attributes[:'modifiedBy']

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

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

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

  self.alert_level = attributes[:'alertLevel'] if attributes[:'alertLevel']

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

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

  self.limit_type = attributes[:'limitType'] if attributes[:'limitType']

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

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

  self.value_type = attributes[:'valueType'] if attributes[:'valueType']

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

  self.max_hard_limit = attributes[:'maxHardLimit'] if attributes[:'maxHardLimit']

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

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

  self.sku_part_id = attributes[:'skuPartId'] if attributes[:'skuPartId']

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

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

Instance Attribute Details

#actionString

[Required] The action when usage limit is hit

Returns:

  • (String)


73
74
75
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 73

def action
  @action
end

#alert_levelFloat

[Required] The alert level of the usage limit

Returns:

  • (Float)


77
78
79
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 77

def alert_level
  @alert_level
end

#created_byString

[Required] The user who created the limit

Returns:

  • (String)


65
66
67
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 65

def created_by
  @created_by
end

#entitlement_idString

[Required] Entitlement ID of the usage limit

Returns:

  • (String)


41
42
43
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 41

def entitlement_id
  @entitlement_id
end

#idString

[Required] The usage limit ID

Returns:

  • (String)


45
46
47
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 45

def id
  @id
end

#lifecycle_stateString

[Required] The usage limit lifecycle state.

Returns:

  • (String)


89
90
91
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 89

def lifecycle_state
  @lifecycle_state
end

#limitString

[Required] The limit value

Returns:

  • (String)


61
62
63
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 61

def limit
  @limit
end

#limit_typeString

[Required] The limit type of the usage limit

Returns:

  • (String)


81
82
83
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 81

def limit_type
  @limit_type
end

#max_hard_limitString

The maximum hard limit set for the usage limit

Returns:

  • (String)


93
94
95
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 93

def max_hard_limit
  @max_hard_limit
end

#modified_byString

[Required] The user who modified the limit

Returns:

  • (String)


69
70
71
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 69

def modified_by
  @modified_by
end

#resource_nameString

[Required] The resource for which the limit is defined

Returns:

  • (String)


53
54
55
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 53

def resource_name
  @resource_name
end

#service_nameString

[Required] The service for which the limit is defined

Returns:

  • (String)


57
58
59
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 57

def service_name
  @service_name
end

#sku_part_idString

The SKU for which the usage limit is set

Returns:

  • (String)


97
98
99
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 97

def sku_part_id
  @sku_part_id
end

#time_createdDateTime

[Required] Time when the usage limit was created

Returns:

  • (DateTime)


37
38
39
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 37

def time_created
  @time_created
end

#time_modifiedDateTime

[Required] Time when the usage limit was modified

Returns:

  • (DateTime)


49
50
51
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 49

def time_modified
  @time_modified
end

#value_typeString

[Required] The value type of the usage limit

Returns:

  • (String)


85
86
87
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 85

def value_type
  @value_type
end

Class Method Details

.attribute_mapObject

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



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 100

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'time_created': :'timeCreated',
    'entitlement_id': :'entitlementId',
    'id': :'id',
    'time_modified': :'timeModified',
    'resource_name': :'resourceName',
    'service_name': :'serviceName',
    'limit': :'limit',
    'created_by': :'createdBy',
    'modified_by': :'modifiedBy',
    'action': :'action',
    'alert_level': :'alertLevel',
    'limit_type': :'limitType',
    'value_type': :'valueType',
    'lifecycle_state': :'lifecycleState',
    'max_hard_limit': :'maxHardLimit',
    'sku_part_id': :'skuPartId'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 124

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'time_created': :'DateTime',
    'entitlement_id': :'String',
    'id': :'String',
    'time_modified': :'DateTime',
    'resource_name': :'String',
    'service_name': :'String',
    'limit': :'String',
    'created_by': :'String',
    'modified_by': :'String',
    'action': :'String',
    'alert_level': :'Float',
    'limit_type': :'String',
    'value_type': :'String',
    'lifecycle_state': :'String',
    'max_hard_limit': :'String',
    'sku_part_id': :'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



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 319

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

  self.class == other.class &&
    time_created == other.time_created &&
    entitlement_id == other.entitlement_id &&
    id == other.id &&
    time_modified == other.time_modified &&
    resource_name == other.resource_name &&
    service_name == other.service_name &&
    limit == other.limit &&
    created_by == other.created_by &&
    modified_by == other.modified_by &&
    action == other.action &&
    alert_level == other.alert_level &&
    limit_type == other.limit_type &&
    value_type == other.value_type &&
    lifecycle_state == other.lifecycle_state &&
    max_hard_limit == other.max_hard_limit &&
    sku_part_id == other.sku_part_id
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



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 364

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


344
345
346
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 344

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



353
354
355
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 353

def hash
  [time_created, entitlement_id, id, time_modified, resource_name, service_name, limit, created_by, modified_by, action, alert_level, limit_type, value_type, lifecycle_state, max_hard_limit, sku_part_id].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



397
398
399
400
401
402
403
404
405
406
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 397

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



391
392
393
# File 'lib/oci/usage/models/usage_limit_summary.rb', line 391

def to_s
  to_hash.to_s
end