Class: OCI::Usage::Models::ResourceQuotumSummary

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

Overview

The resource quota balance details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ResourceQuotumSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :name (String)

    The value to assign to the #name property

  • :is_allowed (BOOLEAN)

    The value to assign to the #is_allowed property

  • :limit (Float)

    The value to assign to the #limit property

  • :balance (Float)

    The value to assign to the #balance property

  • :is_overage (BOOLEAN)

    The value to assign to the #is_overage property

  • :purchased_limit (Float)

    The value to assign to the #purchased_limit property

  • :service (String)

    The value to assign to the #service property

  • :is_dependency (BOOLEAN)

    The value to assign to the #is_dependency property

  • :affected_resource (String)

    The value to assign to the #affected_resource property



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
135
136
137
138
139
140
141
142
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 97

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

  self.is_allowed = attributes[:'isAllowed'] unless attributes[:'isAllowed'].nil?
  self.is_allowed = true if is_allowed.nil? && !attributes.key?(:'isAllowed') # rubocop:disable Style/StringLiterals

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

  self.is_allowed = attributes[:'is_allowed'] unless attributes[:'is_allowed'].nil?
  self.is_allowed = true if is_allowed.nil? && !attributes.key?(:'isAllowed') && !attributes.key?(:'is_allowed') # rubocop:disable Style/StringLiterals

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

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

  self.is_overage = attributes[:'isOverage'] unless attributes[:'isOverage'].nil?

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

  self.is_overage = attributes[:'is_overage'] unless attributes[:'is_overage'].nil?

  self.purchased_limit = attributes[:'purchasedLimit'] if attributes[:'purchasedLimit']

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

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

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

  self.is_dependency = attributes[:'isDependency'] unless attributes[:'isDependency'].nil?

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

  self.is_dependency = attributes[:'is_dependency'] unless attributes[:'is_dependency'].nil?

  self.affected_resource = attributes[:'affectedResource'] if attributes[:'affectedResource']

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

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

Instance Attribute Details

#affected_resourceString

The affected resource name.

Returns:

  • (String)


46
47
48
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 46

def affected_resource
  @affected_resource
end

#balanceFloat

The quota balance.

Returns:

  • (Float)


26
27
28
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 26

def balance
  @balance
end

#is_allowedBOOLEAN

Used to indicate if further quota consumption isAllowed.

Returns:

  • (BOOLEAN)


18
19
20
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 18

def is_allowed
  @is_allowed
end

#is_dependencyBOOLEAN

Used to indicate any resource dependencies.

Returns:

  • (BOOLEAN)


42
43
44
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 42

def is_dependency
  @is_dependency
end

#is_overageBOOLEAN

Used to indicate if overages are incurred.

Returns:

  • (BOOLEAN)


30
31
32
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 30

def is_overage
  @is_overage
end

#limitFloat

The quota limit.

Returns:

  • (Float)


22
23
24
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 22

def limit
  @limit
end

#nameString

The resource name.

Returns:

  • (String)


14
15
16
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 14

def name
  @name
end

#purchased_limitFloat

The purchased quota limit.

Returns:

  • (Float)


34
35
36
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 34

def purchased_limit
  @purchased_limit
end

#serviceString

The service name.

Returns:

  • (String)


38
39
40
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 38

def service
  @service
end

Class Method Details

.attribute_mapObject

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



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 49

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'is_allowed': :'isAllowed',
    'limit': :'limit',
    'balance': :'balance',
    'is_overage': :'isOverage',
    'purchased_limit': :'purchasedLimit',
    'service': :'service',
    'is_dependency': :'isDependency',
    'affected_resource': :'affectedResource'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 66

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'is_allowed': :'BOOLEAN',
    'limit': :'Float',
    'balance': :'Float',
    'is_overage': :'BOOLEAN',
    'purchased_limit': :'Float',
    'service': :'String',
    'is_dependency': :'BOOLEAN',
    'affected_resource': :'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



151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 151

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

  self.class == other.class &&
    name == other.name &&
    is_allowed == other.is_allowed &&
    limit == other.limit &&
    balance == other.balance &&
    is_overage == other.is_overage &&
    purchased_limit == other.purchased_limit &&
    service == other.service &&
    is_dependency == other.is_dependency &&
    affected_resource == other.affected_resource
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



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 189

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


169
170
171
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 169

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



178
179
180
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 178

def hash
  [name, is_allowed, limit, balance, is_overage, purchased_limit, service, is_dependency, affected_resource].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



222
223
224
225
226
227
228
229
230
231
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 222

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



216
217
218
# File 'lib/oci/usage/models/resource_quotum_summary.rb', line 216

def to_s
  to_hash.to_s
end