Class: OCI::Cims::Models::LimitItem

Inherits:
Item
  • Object
show all
Defined in:
lib/oci/cims/models/limit_item.rb

Overview

Details of Limit Item

Constant Summary collapse

LIMIT_STATUS_ENUM =
[
  LIMIT_STATUS_APPROVED = 'APPROVED'.freeze,
  LIMIT_STATUS_PARTIALLY_APPROVED = 'PARTIALLY_APPROVED'.freeze,
  LIMIT_STATUS_NOT_APPROVED = 'NOT_APPROVED'.freeze,
  LIMIT_STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Attributes inherited from Item

#category, #issue_type, #item_key, #name, #sub_category, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Item

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ LimitItem

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/oci/cims/models/limit_item.rb', line 86

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

  attributes['type'] = 'limit'

  super(attributes)

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

  self.current_limit = attributes[:'currentLimit'] if attributes[:'currentLimit']

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

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

  self.current_usage = attributes[:'currentUsage'] if attributes[:'currentUsage']

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

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

  self.requested_limit = attributes[:'requestedLimit'] if attributes[:'requestedLimit']

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

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

  self.limit_status = attributes[:'limitStatus'] if attributes[:'limitStatus']

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

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

Instance Attribute Details

#current_limitInteger

Current available limit of the resource

Returns:

  • (Integer)


21
22
23
# File 'lib/oci/cims/models/limit_item.rb', line 21

def current_limit
  @current_limit
end

#current_usageInteger

Current used limit of the resource

Returns:

  • (Integer)


25
26
27
# File 'lib/oci/cims/models/limit_item.rb', line 25

def current_usage
  @current_usage
end

#limit_statusString

Status of the Limit

Returns:

  • (String)


33
34
35
# File 'lib/oci/cims/models/limit_item.rb', line 33

def limit_status
  @limit_status
end

#requested_limitInteger

Requested limit for the resource

Returns:

  • (Integer)


29
30
31
# File 'lib/oci/cims/models/limit_item.rb', line 29

def requested_limit
  @requested_limit
end

Class Method Details

.attribute_mapObject

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



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/oci/cims/models/limit_item.rb', line 36

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'item_key': :'itemKey',
    'name': :'name',
    'type': :'type',
    'category': :'category',
    'sub_category': :'subCategory',
    'issue_type': :'issueType',
    'current_limit': :'currentLimit',
    'current_usage': :'currentUsage',
    'requested_limit': :'requestedLimit',
    'limit_status': :'limitStatus'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/oci/cims/models/limit_item.rb', line 54

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'item_key': :'String',
    'name': :'String',
    'type': :'String',
    'category': :'OCI::Cims::Models::Category',
    'sub_category': :'OCI::Cims::Models::SubCategory',
    'issue_type': :'OCI::Cims::Models::IssueType',
    'current_limit': :'Integer',
    'current_usage': :'Integer',
    'requested_limit': :'Integer',
    'limit_status': :'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



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/oci/cims/models/limit_item.rb', line 141

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

  self.class == other.class &&
    item_key == other.item_key &&
    name == other.name &&
    type == other.type &&
    category == other.category &&
    sub_category == other.sub_category &&
    issue_type == other.issue_type &&
    current_limit == other.current_limit &&
    current_usage == other.current_usage &&
    requested_limit == other.requested_limit &&
    limit_status == other.limit_status
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



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/oci/cims/models/limit_item.rb', line 180

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


160
161
162
# File 'lib/oci/cims/models/limit_item.rb', line 160

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



169
170
171
# File 'lib/oci/cims/models/limit_item.rb', line 169

def hash
  [item_key, name, type, category, sub_category, issue_type, current_limit, current_usage, requested_limit, limit_status].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



213
214
215
216
217
218
219
220
221
222
# File 'lib/oci/cims/models/limit_item.rb', line 213

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



207
208
209
# File 'lib/oci/cims/models/limit_item.rb', line 207

def to_s
  to_hash.to_s
end