Class: OCI::Opsi::Models::SummarizeOperationsInsightsWarehouseResourceUsageAggregation

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb

Overview

Details of resource usage by an Operations Insights Warehouse resource.

Constant Summary collapse

LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SummarizeOperationsInsightsWarehouseResourceUsageAggregation

Initializes the object

Options Hash (attributes):

  • :id (String)

    The value to assign to the #id property

  • :cpu_used (Float)

    The value to assign to the #cpu_used property

  • :storage_used_in_gbs (Float)

    The value to assign to the #storage_used_in_gbs property

  • :lifecycle_state (String)

    The value to assign to the #lifecycle_state property



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 73

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

  self.cpu_used = attributes[:'cpuUsed'] if attributes[:'cpuUsed']

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

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

  self.storage_used_in_gbs = attributes[:'storageUsedInGBs'] if attributes[:'storageUsedInGBs']

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

Instance Attribute Details

#cpu_usedFloat

Number of OCPUs used by OPSI Warehouse ADW. Can be fractional.



28
29
30
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 28

def cpu_used
  @cpu_used
end

#idString

[Required] OPSI Warehouse OCID



23
24
25
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 23

def id
  @id
end

#lifecycle_stateString

[Required] Possible lifecycle states



37
38
39
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 37

def lifecycle_state
  @lifecycle_state
end

#storage_used_in_gbsFloat

Storage by OPSI Warehouse ADW in GB.



33
34
35
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 33

def storage_used_in_gbs
  @storage_used_in_gbs
end

Class Method Details

.attribute_mapObject

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



40
41
42
43
44
45
46
47
48
49
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 40

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'cpu_used': :'cpuUsed',
    'storage_used_in_gbs': :'storageUsedInGBs',
    'lifecycle_state': :'lifecycleState'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 52

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'cpu_used': :'Float',
    'storage_used_in_gbs': :'Float',
    'lifecycle_state': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.



120
121
122
123
124
125
126
127
128
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 120

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

  self.class == other.class &&
    id == other.id &&
    cpu_used == other.cpu_used &&
    storage_used_in_gbs == other.storage_used_in_gbs &&
    lifecycle_state == other.lifecycle_state
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 153

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

See Also:

  • `==` method


133
134
135
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 133

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.



142
143
144
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 142

def hash
  [id, cpu_used, storage_used_in_gbs, lifecycle_state].hash
end

#to_hashHash

Returns the object in the form of hash



186
187
188
189
190
191
192
193
194
195
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 186

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



180
181
182
# File 'lib/oci/opsi/models/summarize_operations_insights_warehouse_resource_usage_aggregation.rb', line 180

def to_s
  to_hash.to_s
end