Class: OCI::Database::Models::EstimateCostSavingSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/database/models/estimate_cost_saving_summary.rb

Overview

Autonomous AI Database cost savings.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ EstimateCostSavingSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



75
76
77
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
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 75

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

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

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

  self.time_ended = attributes[:'timeEnded'] if attributes[:'timeEnded']

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

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

  self.is_cpu_autoscale = attributes[:'isCpuAutoscale'] unless attributes[:'isCpuAutoscale'].nil?

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

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

  self.estimated_usage_without_elastic_pool = attributes[:'estimatedUsageWithoutElasticPool'] if attributes[:'estimatedUsageWithoutElasticPool']

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

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

  self.usage_with_elastic_pool = attributes[:'usageWithElasticPool'] if attributes[:'usageWithElasticPool']

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

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

  self.cost_savings_with_elastic_pool = attributes[:'costSavingsWithElasticPool'] if attributes[:'costSavingsWithElasticPool']

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

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

Instance Attribute Details

#cost_savings_with_elastic_poolFloat

Estimated cost savings in percentage with elastic pool utilization.

Returns:

  • (Float)


33
34
35
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 33

def cost_savings_with_elastic_pool
  @cost_savings_with_elastic_pool
end

#estimated_usage_without_elastic_poolInteger

CPU cost for a given time period under regular billing plan, in ECPU hours.

Returns:

  • (Integer)


25
26
27
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 25

def estimated_usage_without_elastic_pool
  @estimated_usage_without_elastic_pool
end

#is_cpu_autoscaleBOOLEAN

Indicates if CPU autoscaling is applied.

Returns:

  • (BOOLEAN)


21
22
23
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 21

def is_cpu_autoscale
  @is_cpu_autoscale
end

#time_endedDateTime

The epoch time at which cost aggregation ends.

Returns:

  • (DateTime)


17
18
19
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 17

def time_ended
  @time_ended
end

#time_startedDateTime

The epoch time at which cost aggregation starts.

Returns:

  • (DateTime)


13
14
15
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 13

def time_started
  @time_started
end

#usage_with_elastic_poolInteger

CPU cost for a given time period under elastic pool billing plan, in ECPU hours.

Returns:

  • (Integer)


29
30
31
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 29

def usage_with_elastic_pool
  @usage_with_elastic_pool
end

Class Method Details

.attribute_mapObject

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



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 36

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'time_started': :'timeStarted',
    'time_ended': :'timeEnded',
    'is_cpu_autoscale': :'isCpuAutoscale',
    'estimated_usage_without_elastic_pool': :'estimatedUsageWithoutElasticPool',
    'usage_with_elastic_pool': :'usageWithElasticPool',
    'cost_savings_with_elastic_pool': :'costSavingsWithElasticPool'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 50

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'time_started': :'DateTime',
    'time_ended': :'DateTime',
    'is_cpu_autoscale': :'BOOLEAN',
    'estimated_usage_without_elastic_pool': :'Integer',
    'usage_with_elastic_pool': :'Integer',
    'cost_savings_with_elastic_pool': :'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



125
126
127
128
129
130
131
132
133
134
135
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 125

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

  self.class == other.class &&
    time_started == other.time_started &&
    time_ended == other.time_ended &&
    is_cpu_autoscale == other.is_cpu_autoscale &&
    estimated_usage_without_elastic_pool == other.estimated_usage_without_elastic_pool &&
    usage_with_elastic_pool == other.usage_with_elastic_pool &&
    cost_savings_with_elastic_pool == other.cost_savings_with_elastic_pool
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



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 160

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


140
141
142
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 140

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



149
150
151
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 149

def hash
  [time_started, time_ended, is_cpu_autoscale, estimated_usage_without_elastic_pool, usage_with_elastic_pool, cost_savings_with_elastic_pool].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



193
194
195
196
197
198
199
200
201
202
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 193

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



187
188
189
# File 'lib/oci/database/models/estimate_cost_saving_summary.rb', line 187

def to_s
  to_hash.to_s
end