Class: OCI::CapacityManagement::Models::OccCapacityRequestBaseDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/capacity_management/models/occ_capacity_request_base_details.rb

Overview

The details of the create capacity request. This model serves as a base for different namespaces. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Direct Known Subclasses

OccCapacityRequestComputeDetails

Constant Summary collapse

RESOURCE_TYPE_ENUM =
[
  RESOURCE_TYPE_SERVER_HW = 'SERVER_HW'.freeze,
  RESOURCE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ OccCapacityRequestBaseDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.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.resource_type = attributes[:'resourceType'] if attributes[:'resourceType']

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

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

  self.workload_type = attributes[:'workloadType'] if attributes[:'workloadType']

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

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

  self.expected_handover_quantity = attributes[:'expectedHandoverQuantity'] if attributes[:'expectedHandoverQuantity']

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

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

  self.date_expected_handover = attributes[:'dateExpectedHandover'] if attributes[:'dateExpectedHandover']

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

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

  self.actual_handover_quantity = attributes[:'actualHandoverQuantity'] if attributes[:'actualHandoverQuantity']

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

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

  self.date_actual_handover = attributes[:'dateActualHandover'] if attributes[:'dateActualHandover']

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

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

Instance Attribute Details

#actual_handover_quantityInteger

The actual handed over quantity of resources at the time of request resolution.

Returns:

  • (Integer)


36
37
38
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 36

def actual_handover_quantity
  @actual_handover_quantity
end

#date_actual_handoverDateTime

The date on which the actual handover quantity of resources is delivered.

Returns:

  • (DateTime)


40
41
42
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 40

def date_actual_handover
  @date_actual_handover
end

#date_expected_handoverDateTime

The date on which the latest increment to supplied quantity of resources was delivered.

Returns:

  • (DateTime)


32
33
34
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 32

def date_expected_handover
  @date_expected_handover
end

#expected_handover_quantityInteger

The incremental quantity of resources supplied as the provisioning is underway.

Returns:

  • (Integer)


28
29
30
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 28

def expected_handover_quantity
  @expected_handover_quantity
end

#resource_typeString

[Required] The type of the resource against which the user wants to place a capacity request.

Returns:

  • (String)


20
21
22
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 20

def resource_type
  @resource_type
end

#workload_typeString

[Required] The type of the workload (Generic/ROW).

Returns:

  • (String)


24
25
26
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 24

def workload_type
  @workload_type
end

Class Method Details

.attribute_mapObject

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



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 43

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_type': :'resourceType',
    'workload_type': :'workloadType',
    'expected_handover_quantity': :'expectedHandoverQuantity',
    'date_expected_handover': :'dateExpectedHandover',
    'actual_handover_quantity': :'actualHandoverQuantity',
    'date_actual_handover': :'dateActualHandover'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



75
76
77
78
79
80
81
82
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 75

def self.get_subtype(object_hash)
  type = object_hash[:'resourceType'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::CapacityManagement::Models::OccCapacityRequestComputeDetails' if type == 'SERVER_HW'

  # TODO: Log a warning when the subtype is not found.
  'OCI::CapacityManagement::Models::OccCapacityRequestBaseDetails'
end

.swagger_typesObject

Attribute type mapping.



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 57

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'resource_type': :'String',
    'workload_type': :'String',
    'expected_handover_quantity': :'Integer',
    'date_expected_handover': :'DateTime',
    'actual_handover_quantity': :'Integer',
    'date_actual_handover': :'DateTime'
    # 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



160
161
162
163
164
165
166
167
168
169
170
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 160

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

  self.class == other.class &&
    resource_type == other.resource_type &&
    workload_type == other.workload_type &&
    expected_handover_quantity == other.expected_handover_quantity &&
    date_expected_handover == other.date_expected_handover &&
    actual_handover_quantity == other.actual_handover_quantity &&
    date_actual_handover == other.date_actual_handover
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



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 195

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


175
176
177
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 175

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



184
185
186
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 184

def hash
  [resource_type, workload_type, expected_handover_quantity, date_expected_handover, actual_handover_quantity, date_actual_handover].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



228
229
230
231
232
233
234
235
236
237
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 228

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



222
223
224
# File 'lib/oci/capacity_management/models/occ_capacity_request_base_details.rb', line 222

def to_s
  to_hash.to_s
end