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

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

Overview

Details about the LimitItem object.

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):



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
120
# File 'lib/oci/cims/models/limit_item.rb', line 87

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

The current service limit for the resource.

Returns:

  • (Integer)


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

def current_limit
  @current_limit
end

#current_usageInteger

The current resource usage.

Returns:

  • (Integer)


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

def current_usage
  @current_usage
end

#limit_statusString

The status of the request.

Returns:

  • (String)


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

def limit_status
  @limit_status
end

#requested_limitInteger

The new service limit being requested for the resource.

Returns:

  • (Integer)


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

def requested_limit
  @requested_limit
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


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

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



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

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



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

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



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

def to_s
  to_hash.to_s
end