Class: OCI::CloudMigrations::Models::ComputeCostEstimation

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/cloud_migrations/models/compute_cost_estimation.rb

Overview

Cost estimation for compute

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ComputeCostEstimation

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 110

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

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

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

  self.ocpu_per_hour_by_subscription = attributes[:'ocpuPerHourBySubscription'] if attributes[:'ocpuPerHourBySubscription']

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

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

  self.memory_gb_per_hour = attributes[:'memoryGbPerHour'] if attributes[:'memoryGbPerHour']

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

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

  self.memory_gb_per_hour_by_subscription = attributes[:'memoryGbPerHourBySubscription'] if attributes[:'memoryGbPerHourBySubscription']

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

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

  self.gpu_per_hour = attributes[:'gpuPerHour'] if attributes[:'gpuPerHour']

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

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

  self.gpu_per_hour_by_subscription = attributes[:'gpuPerHourBySubscription'] if attributes[:'gpuPerHourBySubscription']

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

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

  self.total_per_hour = attributes[:'totalPerHour'] if attributes[:'totalPerHour']

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

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

  self.total_per_hour_by_subscription = attributes[:'totalPerHourBySubscription'] if attributes[:'totalPerHourBySubscription']

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

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

  self.ocpu_count = attributes[:'ocpuCount'] if attributes[:'ocpuCount']

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

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

  self.memory_amount_gb = attributes[:'memoryAmountGb'] if attributes[:'memoryAmountGb']

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

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

  self.gpu_count = attributes[:'gpuCount'] if attributes[:'gpuCount']

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

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

Instance Attribute Details

#gpu_countFloat

Total number of GPU

Returns:

  • (Float)


53
54
55
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 53

def gpu_count
  @gpu_count
end

#gpu_per_hourFloat

[Required] GPU per hour

Returns:

  • (Float)


29
30
31
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 29

def gpu_per_hour
  @gpu_per_hour
end

#gpu_per_hour_by_subscriptionFloat

GPU per hour by subscription

Returns:

  • (Float)


33
34
35
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 33

def gpu_per_hour_by_subscription
  @gpu_per_hour_by_subscription
end

#memory_amount_gbFloat

Total usage of memory

Returns:

  • (Float)


49
50
51
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 49

def memory_amount_gb
  @memory_amount_gb
end

#memory_gb_per_hourFloat

[Required] Gigabyte per hour

Returns:

  • (Float)


21
22
23
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 21

def memory_gb_per_hour
  @memory_gb_per_hour
end

#memory_gb_per_hour_by_subscriptionFloat

Gigabyte per hour by subscription

Returns:

  • (Float)


25
26
27
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 25

def memory_gb_per_hour_by_subscription
  @memory_gb_per_hour_by_subscription
end

#ocpu_countFloat

Total number of OCPUs

Returns:

  • (Float)


45
46
47
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 45

def ocpu_count
  @ocpu_count
end

#ocpu_per_hourFloat

[Required] OCPU per hour

Returns:

  • (Float)


13
14
15
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 13

def ocpu_per_hour
  @ocpu_per_hour
end

#ocpu_per_hour_by_subscriptionFloat

OCPU per hour by subscription

Returns:

  • (Float)


17
18
19
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 17

def ocpu_per_hour_by_subscription
  @ocpu_per_hour_by_subscription
end

#total_per_hourFloat

[Required] Total per hour

Returns:

  • (Float)


37
38
39
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 37

def total_per_hour
  @total_per_hour
end

#total_per_hour_by_subscriptionFloat

Total usage per hour by subscription

Returns:

  • (Float)


41
42
43
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 41

def total_per_hour_by_subscription
  @total_per_hour_by_subscription
end

Class Method Details

.attribute_mapObject

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



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 56

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'ocpu_per_hour': :'ocpuPerHour',
    'ocpu_per_hour_by_subscription': :'ocpuPerHourBySubscription',
    'memory_gb_per_hour': :'memoryGbPerHour',
    'memory_gb_per_hour_by_subscription': :'memoryGbPerHourBySubscription',
    'gpu_per_hour': :'gpuPerHour',
    'gpu_per_hour_by_subscription': :'gpuPerHourBySubscription',
    'total_per_hour': :'totalPerHour',
    'total_per_hour_by_subscription': :'totalPerHourBySubscription',
    'ocpu_count': :'ocpuCount',
    'memory_amount_gb': :'memoryAmountGb',
    'gpu_count': :'gpuCount'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 75

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'ocpu_per_hour': :'Float',
    'ocpu_per_hour_by_subscription': :'Float',
    'memory_gb_per_hour': :'Float',
    'memory_gb_per_hour_by_subscription': :'Float',
    'gpu_per_hour': :'Float',
    'gpu_per_hour_by_subscription': :'Float',
    'total_per_hour': :'Float',
    'total_per_hour_by_subscription': :'Float',
    'ocpu_count': :'Float',
    'memory_amount_gb': :'Float',
    'gpu_count': :'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



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 190

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

  self.class == other.class &&
    ocpu_per_hour == other.ocpu_per_hour &&
    ocpu_per_hour_by_subscription == other.ocpu_per_hour_by_subscription &&
    memory_gb_per_hour == other.memory_gb_per_hour &&
    memory_gb_per_hour_by_subscription == other.memory_gb_per_hour_by_subscription &&
    gpu_per_hour == other.gpu_per_hour &&
    gpu_per_hour_by_subscription == other.gpu_per_hour_by_subscription &&
    total_per_hour == other.total_per_hour &&
    total_per_hour_by_subscription == other.total_per_hour_by_subscription &&
    ocpu_count == other.ocpu_count &&
    memory_amount_gb == other.memory_amount_gb &&
    gpu_count == other.gpu_count
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



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 230

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


210
211
212
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 210

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



219
220
221
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 219

def hash
  [ocpu_per_hour, ocpu_per_hour_by_subscription, memory_gb_per_hour, memory_gb_per_hour_by_subscription, gpu_per_hour, gpu_per_hour_by_subscription, total_per_hour, total_per_hour_by_subscription, ocpu_count, memory_amount_gb, gpu_count].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



263
264
265
266
267
268
269
270
271
272
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 263

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



257
258
259
# File 'lib/oci/cloud_migrations/models/compute_cost_estimation.rb', line 257

def to_s
  to_hash.to_s
end