oci 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -13
  3. data/lib/oci/core/blockstorage_client.rb +690 -61
  4. data/lib/oci/core/blockstorage_client_composite_operations.rb +238 -0
  5. data/lib/oci/core/compute_client.rb +1 -5
  6. data/lib/oci/core/core.rb +10 -0
  7. data/lib/oci/core/models/boot_volume.rb +18 -4
  8. data/lib/oci/core/models/cpe.rb +38 -1
  9. data/lib/oci/core/models/create_cpe_details.rb +38 -1
  10. data/lib/oci/core/models/create_drg_details.rb +41 -4
  11. data/lib/oci/core/models/create_internet_gateway_details.rb +38 -1
  12. data/lib/oci/core/models/create_ip_sec_connection_details.rb +38 -1
  13. data/lib/oci/core/models/create_local_peering_gateway_details.rb +38 -1
  14. data/lib/oci/core/models/create_public_ip_details.rb +38 -1
  15. data/lib/oci/core/models/create_vnic_details.rb +38 -1
  16. data/lib/oci/core/models/create_volume_group_backup_details.rb +239 -0
  17. data/lib/oci/core/models/create_volume_group_details.rb +231 -0
  18. data/lib/oci/core/models/drg.rb +38 -1
  19. data/lib/oci/core/models/internet_gateway.rb +38 -1
  20. data/lib/oci/core/models/ip_sec_connection.rb +38 -1
  21. data/lib/oci/core/models/launch_options.rb +4 -0
  22. data/lib/oci/core/models/local_peering_gateway.rb +38 -1
  23. data/lib/oci/core/models/public_ip.rb +38 -1
  24. data/lib/oci/core/models/update_cpe_details.rb +41 -4
  25. data/lib/oci/core/models/update_drg_details.rb +41 -4
  26. data/lib/oci/core/models/update_internet_gateway_details.rb +38 -1
  27. data/lib/oci/core/models/update_ip_sec_connection_details.rb +41 -4
  28. data/lib/oci/core/models/update_local_peering_gateway_details.rb +41 -4
  29. data/lib/oci/core/models/update_public_ip_details.rb +38 -1
  30. data/lib/oci/core/models/update_vnic_details.rb +38 -1
  31. data/lib/oci/core/models/update_volume_group_backup_details.rb +187 -0
  32. data/lib/oci/core/models/update_volume_group_details.rb +201 -0
  33. data/lib/oci/core/models/vnic.rb +38 -1
  34. data/lib/oci/core/models/volume.rb +18 -4
  35. data/lib/oci/core/models/volume_group.rb +322 -0
  36. data/lib/oci/core/models/volume_group_backup.rb +380 -0
  37. data/lib/oci/core/models/volume_group_source_details.rb +164 -0
  38. data/lib/oci/core/models/volume_group_source_from_volume_group_backup_details.rb +158 -0
  39. data/lib/oci/core/models/volume_group_source_from_volume_group_details.rb +158 -0
  40. data/lib/oci/core/models/volume_group_source_from_volumes_details.rb +158 -0
  41. data/lib/oci/core/virtual_network_client.rb +6 -6
  42. data/lib/oci/database/database.rb +3 -0
  43. data/lib/oci/database/database_client.rb +1 -1
  44. data/lib/oci/database/database_client_composite_operations.rb +1 -1
  45. data/lib/oci/database/models/backup.rb +31 -1
  46. data/lib/oci/database/models/backup_summary.rb +31 -1
  47. data/lib/oci/database/models/create_db_home_from_backup_details.rb +160 -0
  48. data/lib/oci/database/models/launch_db_system_base.rb +438 -0
  49. data/lib/oci/database/models/launch_db_system_details.rb +41 -227
  50. data/lib/oci/database/models/launch_db_system_from_backup_details.rb +314 -0
  51. data/lib/oci/file_storage/file_storage_client.rb +9 -8
  52. data/lib/oci/file_storage/models/export.rb +6 -5
  53. data/lib/oci/file_storage/models/file_system_summary.rb +1 -2
  54. data/lib/oci/version.rb +1 -1
  55. metadata +15 -2
@@ -0,0 +1,380 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require 'logger'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective
7
+ module OCI
8
+ # A point-in-time copy of a volume group that can then be used to create a new block volume group
9
+ # or recover a block volume group.
10
+ #
11
+ # To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized,
12
+ # talk to an administrator. If you're an administrator who needs to write policies to give users access, see
13
+ # [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
14
+ #
15
+ class Core::Models::VolumeGroupBackup # rubocop:disable Metrics/LineLength
16
+ LIFECYCLE_STATE_ENUM = [
17
+ LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
18
+ LIFECYCLE_STATE_COMMITTED = 'COMMITTED'.freeze,
19
+ LIFECYCLE_STATE_AVAILABLE = 'AVAILABLE'.freeze,
20
+ LIFECYCLE_STATE_TERMINATING = 'TERMINATING'.freeze,
21
+ LIFECYCLE_STATE_TERMINATED = 'TERMINATED'.freeze,
22
+ LIFECYCLE_STATE_FAULTY = 'FAULTY'.freeze,
23
+ LIFECYCLE_STATE_REQUEST_RECEIVED = 'REQUEST_RECEIVED'.freeze,
24
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
25
+ ].freeze
26
+
27
+ TYPE_ENUM = [
28
+ TYPE_FULL = 'FULL'.freeze,
29
+ TYPE_INCREMENTAL = 'INCREMENTAL'.freeze,
30
+ TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
31
+ ].freeze
32
+
33
+ # **[Required]** The OCID of the compartment that contains the volume group backup.
34
+ # @return [String]
35
+ attr_accessor :compartment_id
36
+
37
+ # Defined tags for this resource. Each key is predefined and scoped to a namespace.
38
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
39
+ #
40
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
41
+ #
42
+ # @return [Hash<String, Hash<String, Object>>]
43
+ attr_accessor :defined_tags
44
+
45
+ # **[Required]** A user-friendly name for the volume group backup. Does not have to be unique and it's changeable.
46
+ # @return [String]
47
+ attr_accessor :display_name
48
+
49
+ # Free-form tags for this resource. Each tag is a simple key-value pair with no
50
+ # predefined name, type, or namespace. For more information, see
51
+ # [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
52
+ #
53
+ # Example: `{\"Department\": \"Finance\"}`
54
+ #
55
+ # @return [Hash<String, String>]
56
+ attr_accessor :freeform_tags
57
+
58
+ # **[Required]** The OCID of the volume group backup (unique).
59
+ # @return [String]
60
+ attr_accessor :id
61
+
62
+ # **[Required]** The current state of a volume group backup.
63
+ # @return [String]
64
+ attr_reader :lifecycle_state
65
+
66
+ # The aggregate size of the volume group backup, in MBs.
67
+ #
68
+ # @return [Integer]
69
+ attr_accessor :size_in_mbs
70
+
71
+ # **[Required]** The date and time the volume group backup was created. This is the time the actual point-in-time image
72
+ # of the volume group data was taken. Format defined by RFC3339.
73
+ #
74
+ # @return [DateTime]
75
+ attr_accessor :time_created
76
+
77
+ # The date and time the request to create the volume group backup was received. Format defined by RFC3339.
78
+ #
79
+ # @return [DateTime]
80
+ attr_accessor :time_request_received
81
+
82
+ # **[Required]** The type of backup.
83
+ # @return [String]
84
+ attr_reader :type
85
+
86
+ # The aggregate size used by the volume group backup, in MBs.
87
+ # It is typically smaller than sizeInMBs, depending on the space
88
+ # consumed on the volume group and whether the backup is full or incremental.
89
+ #
90
+ # @return [Integer]
91
+ attr_accessor :unique_size_in_mbs
92
+
93
+ # **[Required]** OCIDs for the backups in this volume group backup.
94
+ # @return [Array<String>]
95
+ attr_accessor :volume_backup_ids
96
+
97
+ # The OCID of the source volume group.
98
+ # @return [String]
99
+ attr_accessor :volume_group_id
100
+
101
+ # Attribute mapping from ruby-style variable name to JSON key.
102
+ def self.attribute_map
103
+ {
104
+ # rubocop:disable Style/SymbolLiteral
105
+ 'compartment_id': :'compartmentId',
106
+ 'defined_tags': :'definedTags',
107
+ 'display_name': :'displayName',
108
+ 'freeform_tags': :'freeformTags',
109
+ 'id': :'id',
110
+ 'lifecycle_state': :'lifecycleState',
111
+ 'size_in_mbs': :'sizeInMBs',
112
+ 'time_created': :'timeCreated',
113
+ 'time_request_received': :'timeRequestReceived',
114
+ 'type': :'type',
115
+ 'unique_size_in_mbs': :'uniqueSizeInMbs',
116
+ 'volume_backup_ids': :'volumeBackupIds',
117
+ 'volume_group_id': :'volumeGroupId'
118
+ # rubocop:enable Style/SymbolLiteral
119
+ }
120
+ end
121
+
122
+ # Attribute type mapping.
123
+ def self.swagger_types
124
+ {
125
+ # rubocop:disable Style/SymbolLiteral
126
+ 'compartment_id': :'String',
127
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
128
+ 'display_name': :'String',
129
+ 'freeform_tags': :'Hash<String, String>',
130
+ 'id': :'String',
131
+ 'lifecycle_state': :'String',
132
+ 'size_in_mbs': :'Integer',
133
+ 'time_created': :'DateTime',
134
+ 'time_request_received': :'DateTime',
135
+ 'type': :'String',
136
+ 'unique_size_in_mbs': :'Integer',
137
+ 'volume_backup_ids': :'Array<String>',
138
+ 'volume_group_id': :'String'
139
+ # rubocop:enable Style/SymbolLiteral
140
+ }
141
+ end
142
+
143
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
144
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
145
+
146
+
147
+ # Initializes the object
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
150
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
151
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
152
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
153
+ # @option attributes [String] :id The value to assign to the {#id} property
154
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
155
+ # @option attributes [Integer] :size_in_mbs The value to assign to the {#size_in_mbs} property
156
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
157
+ # @option attributes [DateTime] :time_request_received The value to assign to the {#time_request_received} property
158
+ # @option attributes [String] :type The value to assign to the {#type} property
159
+ # @option attributes [Integer] :unique_size_in_mbs The value to assign to the {#unique_size_in_mbs} property
160
+ # @option attributes [Array<String>] :volume_backup_ids The value to assign to the {#volume_backup_ids} property
161
+ # @option attributes [String] :volume_group_id The value to assign to the {#volume_group_id} property
162
+ def initialize(attributes = {})
163
+ return unless attributes.is_a?(Hash)
164
+
165
+ # convert string to symbol for hash key
166
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
167
+
168
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
169
+
170
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
171
+
172
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
173
+
174
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
175
+
176
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
177
+
178
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
179
+
180
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
181
+
182
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
183
+
184
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
185
+
186
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
187
+
188
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
189
+
190
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
191
+
192
+ self.id = attributes[:'id'] if attributes[:'id']
193
+
194
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
195
+
196
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
197
+
198
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
199
+
200
+ self.size_in_mbs = attributes[:'sizeInMBs'] if attributes[:'sizeInMBs']
201
+
202
+ raise 'You cannot provide both :sizeInMBs and :size_in_mbs' if attributes.key?(:'sizeInMBs') && attributes.key?(:'size_in_mbs')
203
+
204
+ self.size_in_mbs = attributes[:'size_in_mbs'] if attributes[:'size_in_mbs']
205
+
206
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
207
+
208
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
209
+
210
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
211
+
212
+ self.time_request_received = attributes[:'timeRequestReceived'] if attributes[:'timeRequestReceived']
213
+
214
+ raise 'You cannot provide both :timeRequestReceived and :time_request_received' if attributes.key?(:'timeRequestReceived') && attributes.key?(:'time_request_received')
215
+
216
+ self.time_request_received = attributes[:'time_request_received'] if attributes[:'time_request_received']
217
+
218
+ self.type = attributes[:'type'] if attributes[:'type']
219
+
220
+ self.unique_size_in_mbs = attributes[:'uniqueSizeInMbs'] if attributes[:'uniqueSizeInMbs']
221
+
222
+ raise 'You cannot provide both :uniqueSizeInMbs and :unique_size_in_mbs' if attributes.key?(:'uniqueSizeInMbs') && attributes.key?(:'unique_size_in_mbs')
223
+
224
+ self.unique_size_in_mbs = attributes[:'unique_size_in_mbs'] if attributes[:'unique_size_in_mbs']
225
+
226
+ self.volume_backup_ids = attributes[:'volumeBackupIds'] if attributes[:'volumeBackupIds']
227
+
228
+ raise 'You cannot provide both :volumeBackupIds and :volume_backup_ids' if attributes.key?(:'volumeBackupIds') && attributes.key?(:'volume_backup_ids')
229
+
230
+ self.volume_backup_ids = attributes[:'volume_backup_ids'] if attributes[:'volume_backup_ids']
231
+
232
+ self.volume_group_id = attributes[:'volumeGroupId'] if attributes[:'volumeGroupId']
233
+
234
+ raise 'You cannot provide both :volumeGroupId and :volume_group_id' if attributes.key?(:'volumeGroupId') && attributes.key?(:'volume_group_id')
235
+
236
+ self.volume_group_id = attributes[:'volume_group_id'] if attributes[:'volume_group_id']
237
+ end
238
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
239
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
240
+
241
+ # Custom attribute writer method checking allowed values (enum).
242
+ # @param [Object] lifecycle_state Object to be assigned
243
+ def lifecycle_state=(lifecycle_state)
244
+ # rubocop:disable Style/ConditionalAssignment
245
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
246
+ # rubocop: disable Metrics/LineLength
247
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
248
+ # rubocop: enable Metrics/LineLength
249
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
250
+ else
251
+ @lifecycle_state = lifecycle_state
252
+ end
253
+ # rubocop:enable Style/ConditionalAssignment
254
+ end
255
+
256
+ # Custom attribute writer method checking allowed values (enum).
257
+ # @param [Object] type Object to be assigned
258
+ def type=(type)
259
+ # rubocop:disable Style/ConditionalAssignment
260
+ if type && !TYPE_ENUM.include?(type)
261
+ # rubocop: disable Metrics/LineLength
262
+ OCI.logger.debug("Unknown value for 'type' [" + type + "]. Mapping to 'TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
263
+ # rubocop: enable Metrics/LineLength
264
+ @type = TYPE_UNKNOWN_ENUM_VALUE
265
+ else
266
+ @type = type
267
+ end
268
+ # rubocop:enable Style/ConditionalAssignment
269
+ end
270
+
271
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
272
+
273
+
274
+ # Checks equality by comparing each attribute.
275
+ # @param [Object] other the other object to be compared
276
+ def ==(other)
277
+ return true if equal?(other)
278
+ self.class == other.class &&
279
+ compartment_id == other.compartment_id &&
280
+ defined_tags == other.defined_tags &&
281
+ display_name == other.display_name &&
282
+ freeform_tags == other.freeform_tags &&
283
+ id == other.id &&
284
+ lifecycle_state == other.lifecycle_state &&
285
+ size_in_mbs == other.size_in_mbs &&
286
+ time_created == other.time_created &&
287
+ time_request_received == other.time_request_received &&
288
+ type == other.type &&
289
+ unique_size_in_mbs == other.unique_size_in_mbs &&
290
+ volume_backup_ids == other.volume_backup_ids &&
291
+ volume_group_id == other.volume_group_id
292
+ end
293
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
294
+
295
+ # @see the `==` method
296
+ # @param [Object] other the other object to be compared
297
+ def eql?(other)
298
+ self == other
299
+ end
300
+
301
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
302
+
303
+
304
+ # Calculates hash code according to all attributes.
305
+ # @return [Fixnum] Hash code
306
+ def hash
307
+ [compartment_id, defined_tags, display_name, freeform_tags, id, lifecycle_state, size_in_mbs, time_created, time_request_received, type, unique_size_in_mbs, volume_backup_ids, volume_group_id].hash
308
+ end
309
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
310
+
311
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
312
+
313
+
314
+ # Builds the object from hash
315
+ # @param [Hash] attributes Model attributes in the form of hash
316
+ # @return [Object] Returns the model itself
317
+ def build_from_hash(attributes)
318
+ return nil unless attributes.is_a?(Hash)
319
+ self.class.swagger_types.each_pair do |key, type|
320
+ if type =~ /^Array<(.*)>/i
321
+ # check to ensure the input is an array given that the the attribute
322
+ # is documented as an array but the input is not
323
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
324
+ public_method("#{key}=").call(
325
+ attributes[self.class.attribute_map[key]]
326
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
327
+ )
328
+ end
329
+ elsif !attributes[self.class.attribute_map[key]].nil?
330
+ public_method("#{key}=").call(
331
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
332
+ )
333
+ end
334
+ # or else data not found in attributes(hash), not an issue as the data can be optional
335
+ end
336
+
337
+ self
338
+ end
339
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
340
+
341
+ # Returns the string representation of the object
342
+ # @return [String] String presentation of the object
343
+ def to_s
344
+ to_hash.to_s
345
+ end
346
+
347
+ # Returns the object in the form of hash
348
+ # @return [Hash] Returns the object in the form of hash
349
+ def to_hash
350
+ hash = {}
351
+ self.class.attribute_map.each_pair do |attr, param|
352
+ value = public_method(attr).call
353
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
354
+ hash[param] = _to_hash(value)
355
+ end
356
+ hash
357
+ end
358
+
359
+ private
360
+
361
+ # Outputs non-array value in the form of hash
362
+ # For object, use to_hash. Otherwise, just return the value
363
+ # @param [Object] value Any valid value
364
+ # @return [Hash] Returns the value in the form of hash
365
+ def _to_hash(value)
366
+ if value.is_a?(Array)
367
+ value.compact.map { |v| _to_hash(v) }
368
+ elsif value.is_a?(Hash)
369
+ {}.tap do |hash|
370
+ value.each { |k, v| hash[k] = _to_hash(v) }
371
+ end
372
+ elsif value.respond_to? :to_hash
373
+ value.to_hash
374
+ else
375
+ value
376
+ end
377
+ end
378
+ end
379
+ end
380
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,164 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # Specifies the source for a volume group.
8
+ # 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
9
+ class Core::Models::VolumeGroupSourceDetails # rubocop:disable Metrics/LineLength
10
+ # This attribute is required.
11
+ # @return [String]
12
+ attr_accessor :type
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ # rubocop:disable Style/SymbolLiteral
18
+ 'type': :'type'
19
+ # rubocop:enable Style/SymbolLiteral
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.swagger_types
25
+ {
26
+ # rubocop:disable Style/SymbolLiteral
27
+ 'type': :'String'
28
+ # rubocop:enable Style/SymbolLiteral
29
+ }
30
+ end
31
+
32
+ # rubocop:disable Metrics/CyclomaticComplexity, Layout/EmptyLines
33
+
34
+
35
+ # Given the hash representation of a subtype of this class,
36
+ # use the info in the hash to return the class of the subtype.
37
+ def self.get_subtype(object_hash)
38
+ type = object_hash[:'type'] # rubocop:disable Style/SymbolLiteral
39
+
40
+ return 'OCI::Core::Models::VolumeGroupSourceFromVolumeGroupDetails' if type == 'volumeGroupId'
41
+ return 'OCI::Core::Models::VolumeGroupSourceFromVolumesDetails' if type == 'volumeIds'
42
+ return 'OCI::Core::Models::VolumeGroupSourceFromVolumeGroupBackupDetails' if type == 'volumeGroupBackupId'
43
+
44
+ # TODO: Log a warning when the subtype is not found.
45
+ 'OCI::Core::Models::VolumeGroupSourceDetails'
46
+ end
47
+ # rubocop:enable Metrics/CyclomaticComplexity, Layout/EmptyLines
48
+
49
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
50
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
51
+
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ # @option attributes [String] :type The value to assign to the {#type} property
56
+ def initialize(attributes = {})
57
+ return unless attributes.is_a?(Hash)
58
+
59
+ # convert string to symbol for hash key
60
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
61
+
62
+ self.type = attributes[:'type'] if attributes[:'type']
63
+ end
64
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
65
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
66
+
67
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
68
+
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] other the other object to be compared
72
+ def ==(other)
73
+ return true if equal?(other)
74
+ self.class == other.class &&
75
+ type == other.type
76
+ end
77
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
78
+
79
+ # @see the `==` method
80
+ # @param [Object] other the other object to be compared
81
+ def eql?(other)
82
+ self == other
83
+ end
84
+
85
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
86
+
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Fixnum] Hash code
90
+ def hash
91
+ [type].hash
92
+ end
93
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
94
+
95
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
96
+
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def build_from_hash(attributes)
102
+ return nil unless attributes.is_a?(Hash)
103
+ self.class.swagger_types.each_pair do |key, type|
104
+ if type =~ /^Array<(.*)>/i
105
+ # check to ensure the input is an array given that the the attribute
106
+ # is documented as an array but the input is not
107
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
108
+ public_method("#{key}=").call(
109
+ attributes[self.class.attribute_map[key]]
110
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
111
+ )
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ public_method("#{key}=").call(
115
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
116
+ )
117
+ end
118
+ # or else data not found in attributes(hash), not an issue as the data can be optional
119
+ end
120
+
121
+ self
122
+ end
123
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
124
+
125
+ # Returns the string representation of the object
126
+ # @return [String] String presentation of the object
127
+ def to_s
128
+ to_hash.to_s
129
+ end
130
+
131
+ # Returns the object in the form of hash
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_hash
134
+ hash = {}
135
+ self.class.attribute_map.each_pair do |attr, param|
136
+ value = public_method(attr).call
137
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
138
+ hash[param] = _to_hash(value)
139
+ end
140
+ hash
141
+ end
142
+
143
+ private
144
+
145
+ # Outputs non-array value in the form of hash
146
+ # For object, use to_hash. Otherwise, just return the value
147
+ # @param [Object] value Any valid value
148
+ # @return [Hash] Returns the value in the form of hash
149
+ def _to_hash(value)
150
+ if value.is_a?(Array)
151
+ value.compact.map { |v| _to_hash(v) }
152
+ elsif value.is_a?(Hash)
153
+ {}.tap do |hash|
154
+ value.each { |k, v| hash[k] = _to_hash(v) }
155
+ end
156
+ elsif value.respond_to? :to_hash
157
+ value.to_hash
158
+ else
159
+ value
160
+ end
161
+ end
162
+ end
163
+ end
164
+ # rubocop:enable Lint/UnneededCopDisableDirective