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_REJECTED = 'REJECTED'.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):



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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/oci/cims/models/limit_item.rb', line 95

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']

  self.customer_message = attributes[:'customerMessage'] if attributes[:'customerMessage']

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

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

Instance Attribute Details

#current_limitInteger

The current service limit for the resource.

Returns:

  • (Integer)


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

def current_limit
  @current_limit
end

#current_usageInteger

The current resource usage.

Returns:

  • (Integer)


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

def current_usage
  @current_usage
end

#customer_messageString

The message to customer for partially approved and rejected limit requests

Returns:

  • (String)


39
40
41
# File 'lib/oci/cims/models/limit_item.rb', line 39

def customer_message
  @customer_message
end

#limit_statusString

The status of the request.

Returns:

  • (String)


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

def limit_status
  @limit_status
end

#requested_limitInteger

The new service limit being requested for the resource.

Returns:

  • (Integer)


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

def requested_limit
  @requested_limit
end

Class Method Details

.attribute_mapObject

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



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/oci/cims/models/limit_item.rb', line 42

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',
    'customer_message': :'customerMessage'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/oci/cims/models/limit_item.rb', line 61

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',
    'customer_message': :'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



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/oci/cims/models/limit_item.rb', line 156

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 &&
    customer_message == other.customer_message
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



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/oci/cims/models/limit_item.rb', line 196

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


176
177
178
# File 'lib/oci/cims/models/limit_item.rb', line 176

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



185
186
187
# File 'lib/oci/cims/models/limit_item.rb', line 185

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

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



229
230
231
232
233
234
235
236
237
238
# File 'lib/oci/cims/models/limit_item.rb', line 229

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



223
224
225
# File 'lib/oci/cims/models/limit_item.rb', line 223

def to_s
  to_hash.to_s
end