Class: OCI::Limits::Models::ResourceAvailability

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/limits/models/resource_availability.rb

Overview

The availability of a given resource limit, based on the usage, tenant service limits, and quotas set for the tenancy. Note: We cannot guarantee this data for all the limits. In such cases, these fields will be empty.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ResourceAvailability

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :used (Integer)

    The value to assign to the #used property

  • :available (Integer)

    The value to assign to the #available property

  • :fractional_usage (Float)

    The value to assign to the #fractional_usage property

  • :fractional_availability (Float)

    The value to assign to the #fractional_availability property

  • :effective_quota_value (Float)

    The value to assign to the #effective_quota_value property



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/oci/limits/models/resource_availability.rb', line 78

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

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

  self.fractional_usage = attributes[:'fractionalUsage'] if attributes[:'fractionalUsage']

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

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

  self.fractional_availability = attributes[:'fractionalAvailability'] if attributes[:'fractionalAvailability']

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

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

  self.effective_quota_value = attributes[:'effectiveQuotaValue'] if attributes[:'effectiveQuotaValue']

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

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

Instance Attribute Details

#availableInteger

The count of available resources. To support resources with fractional counts, the field rounds down to the nearest integer.

Returns:

  • (Integer)


23
24
25
# File 'lib/oci/limits/models/resource_availability.rb', line 23

def available
  @available
end

#effective_quota_valueFloat

The effective quota value for the given compartment. This field is only present if there is a current quota policy affecting the current resource in the target region or availability domain.

Returns:

  • (Float)


39
40
41
# File 'lib/oci/limits/models/resource_availability.rb', line 39

def effective_quota_value
  @effective_quota_value
end

#fractional_availabilityFloat

The most accurate count of available resources.

Returns:

  • (Float)


33
34
35
# File 'lib/oci/limits/models/resource_availability.rb', line 33

def fractional_availability
  @fractional_availability
end

#fractional_usageFloat

The current most accurate usage in the given compartment.

Returns:

  • (Float)


28
29
30
# File 'lib/oci/limits/models/resource_availability.rb', line 28

def fractional_usage
  @fractional_usage
end

#usedInteger

The current usage in the given compartment. To support resources with fractional counts, the field rounds up to the nearest integer.

Returns:

  • (Integer)


17
18
19
# File 'lib/oci/limits/models/resource_availability.rb', line 17

def used
  @used
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
# File 'lib/oci/limits/models/resource_availability.rb', line 42

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'used': :'used',
    'available': :'available',
    'fractional_usage': :'fractionalUsage',
    'fractional_availability': :'fractionalAvailability',
    'effective_quota_value': :'effectiveQuotaValue'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/oci/limits/models/resource_availability.rb', line 55

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'used': :'Integer',
    'available': :'Integer',
    'fractional_usage': :'Float',
    'fractional_availability': :'Float',
    'effective_quota_value': :'Float'
    # 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



114
115
116
117
118
119
120
121
122
123
# File 'lib/oci/limits/models/resource_availability.rb', line 114

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

  self.class == other.class &&
    used == other.used &&
    available == other.available &&
    fractional_usage == other.fractional_usage &&
    fractional_availability == other.fractional_availability &&
    effective_quota_value == other.effective_quota_value
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



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/oci/limits/models/resource_availability.rb', line 148

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


128
129
130
# File 'lib/oci/limits/models/resource_availability.rb', line 128

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



137
138
139
# File 'lib/oci/limits/models/resource_availability.rb', line 137

def hash
  [used, available, fractional_usage, fractional_availability, effective_quota_value].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



181
182
183
184
185
186
187
188
189
190
# File 'lib/oci/limits/models/resource_availability.rb', line 181

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



175
176
177
# File 'lib/oci/limits/models/resource_availability.rb', line 175

def to_s
  to_hash.to_s
end