oci 2.3.0 → 2.3.1

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/oci/core/blockstorage_client.rb +412 -13
  4. data/lib/oci/core/blockstorage_client_composite_operations.rb +158 -0
  5. data/lib/oci/core/compute_client.rb +6 -7
  6. data/lib/oci/core/core.rb +13 -0
  7. data/lib/oci/core/models/boot_volume.rb +68 -1
  8. data/lib/oci/core/models/boot_volume_backup.rb +435 -0
  9. data/lib/oci/core/models/boot_volume_source_details.rb +163 -0
  10. data/lib/oci/core/models/boot_volume_source_from_boot_volume_backup_details.rb +154 -0
  11. data/lib/oci/core/models/boot_volume_source_from_boot_volume_details.rb +154 -0
  12. data/lib/oci/core/models/create_boot_volume_backup_details.rb +227 -0
  13. data/lib/oci/core/models/create_boot_volume_details.rb +250 -0
  14. data/lib/oci/core/models/create_service_gateway_details.rb +228 -0
  15. data/lib/oci/core/models/egress_security_rule.rb +44 -3
  16. data/lib/oci/core/models/ingress_security_rule.rb +47 -3
  17. data/lib/oci/core/models/instance_source_via_image_details.rb +0 -1
  18. data/lib/oci/core/models/route_rule.rb +59 -2
  19. data/lib/oci/core/models/service.rb +185 -0
  20. data/lib/oci/core/models/service_gateway.rb +325 -0
  21. data/lib/oci/core/models/service_id_request_details.rb +151 -0
  22. data/lib/oci/core/models/service_id_response_details.rb +165 -0
  23. data/lib/oci/core/models/update_boot_volume_backup_details.rb +189 -0
  24. data/lib/oci/core/models/update_boot_volume_details.rb +41 -4
  25. data/lib/oci/core/models/update_service_gateway_details.rb +225 -0
  26. data/lib/oci/core/models/volume_group.rb +21 -7
  27. data/lib/oci/core/models/volume_group_backup.rb +39 -7
  28. data/lib/oci/core/models/volume_group_source_from_volumes_details.rb +1 -1
  29. data/lib/oci/core/virtual_network_client.rb +582 -1
  30. data/lib/oci/core/virtual_network_client_composite_operations.rb +119 -0
  31. data/lib/oci/version.rb +1 -1
  32. metadata +15 -2
@@ -24,6 +24,84 @@ module OCI
24
24
  # rubocop:disable Layout/EmptyLines
25
25
 
26
26
 
27
+ # Calls {OCI::Core::BlockstorageClient#create_boot_volume} and then waits for the {OCI::Core::Models::BootVolume} acted upon
28
+ # to enter the given state(s).
29
+ #
30
+ # @param [OCI::Core::Models::CreateBootVolumeDetails] create_boot_volume_details Request to create a new boot volume.
31
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Core::Models::BootVolume#lifecycle_state}
32
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Core::BlockstorageClient#create_boot_volume}
33
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
34
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
35
+ # * max_wait_seconds The maximum time to wait, in seconds
36
+ #
37
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Core::Models::BootVolume}
38
+ def create_boot_volume_and_wait_for_state(create_boot_volume_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
39
+ operation_result = @service_client.create_boot_volume(create_boot_volume_details, base_operation_opts)
40
+
41
+ return operation_result if wait_for_states.empty?
42
+
43
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
44
+ wait_for_resource_id = operation_result.data.id
45
+
46
+ begin
47
+ waiter_result = @service_client.get_boot_volume(wait_for_resource_id).wait_until(
48
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
49
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
50
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
51
+ )
52
+ result_to_return = waiter_result
53
+
54
+ return result_to_return
55
+ rescue StandardError
56
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
57
+ end
58
+ end
59
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
60
+ # rubocop:enable Layout/EmptyLines
61
+
62
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
63
+ # rubocop:disable Layout/EmptyLines
64
+
65
+
66
+ # Calls {OCI::Core::BlockstorageClient#create_boot_volume_backup} and then waits for the {OCI::Core::Models::BootVolumeBackup} acted upon
67
+ # to enter the given state(s).
68
+ #
69
+ # @param [OCI::Core::Models::CreateBootVolumeBackupDetails] create_boot_volume_backup_details Request to create a new backup of given boot volume.
70
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Core::Models::BootVolumeBackup#lifecycle_state}
71
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Core::BlockstorageClient#create_boot_volume_backup}
72
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
73
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
74
+ # * max_wait_seconds The maximum time to wait, in seconds
75
+ #
76
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Core::Models::BootVolumeBackup}
77
+ def create_boot_volume_backup_and_wait_for_state(create_boot_volume_backup_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
78
+ operation_result = @service_client.create_boot_volume_backup(create_boot_volume_backup_details, base_operation_opts)
79
+
80
+ return operation_result if wait_for_states.empty?
81
+
82
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
83
+ wait_for_resource_id = operation_result.data.id
84
+
85
+ begin
86
+ waiter_result = @service_client.get_boot_volume_backup(wait_for_resource_id).wait_until(
87
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
88
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
89
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
90
+ )
91
+ result_to_return = waiter_result
92
+
93
+ return result_to_return
94
+ rescue StandardError
95
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
96
+ end
97
+ end
98
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
99
+ # rubocop:enable Layout/EmptyLines
100
+
101
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
102
+ # rubocop:disable Layout/EmptyLines
103
+
104
+
27
105
  # Calls {OCI::Core::BlockstorageClient#create_volume} and then waits for the {OCI::Core::Models::Volume} acted upon
28
106
  # to enter the given state(s).
29
107
  #
@@ -220,6 +298,46 @@ module OCI
220
298
  # rubocop:disable Layout/EmptyLines
221
299
 
222
300
 
301
+ # Calls {OCI::Core::BlockstorageClient#delete_boot_volume_backup} and then waits for the {OCI::Core::Models::BootVolumeBackup} acted upon
302
+ # to enter the given state(s).
303
+ #
304
+ # @param [String] boot_volume_backup_id The OCID of the boot volume backup.
305
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Core::Models::BootVolumeBackup#lifecycle_state}
306
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Core::BlockstorageClient#delete_boot_volume_backup}
307
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
308
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
309
+ # * max_wait_seconds The maximum time to wait, in seconds
310
+ #
311
+ # @return [OCI::Response] A {OCI::Response} object with data of type nil
312
+ def delete_boot_volume_backup_and_wait_for_state(boot_volume_backup_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
313
+ initial_get_result = @service_client.get_boot_volume_backup(boot_volume_backup_id)
314
+ operation_result = @service_client.delete_boot_volume_backup(boot_volume_backup_id, base_operation_opts)
315
+
316
+ return operation_result if wait_for_states.empty?
317
+
318
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
319
+
320
+ begin
321
+ waiter_result = initial_get_result.wait_until(
322
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
323
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
324
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
325
+ succeed_on_not_found: true
326
+ )
327
+ result_to_return = waiter_result
328
+
329
+ return result_to_return
330
+ rescue StandardError
331
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
332
+ end
333
+ end
334
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
335
+ # rubocop:enable Layout/EmptyLines
336
+
337
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
338
+ # rubocop:disable Layout/EmptyLines
339
+
340
+
223
341
  # Calls {OCI::Core::BlockstorageClient#delete_volume} and then waits for the {OCI::Core::Models::Volume} acted upon
224
342
  # to enter the given state(s).
225
343
  #
@@ -420,6 +538,46 @@ module OCI
420
538
  # rubocop:disable Layout/EmptyLines
421
539
 
422
540
 
541
+ # Calls {OCI::Core::BlockstorageClient#update_boot_volume_backup} and then waits for the {OCI::Core::Models::BootVolumeBackup} acted upon
542
+ # to enter the given state(s).
543
+ #
544
+ # @param [String] boot_volume_backup_id The OCID of the boot volume backup.
545
+ # @param [OCI::Core::Models::UpdateBootVolumeBackupDetails] update_boot_volume_backup_details Update boot volume backup fields
546
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Core::Models::BootVolumeBackup#lifecycle_state}
547
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Core::BlockstorageClient#update_boot_volume_backup}
548
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
549
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
550
+ # * max_wait_seconds The maximum time to wait, in seconds
551
+ #
552
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Core::Models::BootVolumeBackup}
553
+ def update_boot_volume_backup_and_wait_for_state(boot_volume_backup_id, update_boot_volume_backup_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
554
+ operation_result = @service_client.update_boot_volume_backup(boot_volume_backup_id, update_boot_volume_backup_details, base_operation_opts)
555
+
556
+ return operation_result if wait_for_states.empty?
557
+
558
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
559
+ wait_for_resource_id = operation_result.data.id
560
+
561
+ begin
562
+ waiter_result = @service_client.get_boot_volume_backup(wait_for_resource_id).wait_until(
563
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
564
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
565
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
566
+ )
567
+ result_to_return = waiter_result
568
+
569
+ return result_to_return
570
+ rescue StandardError
571
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
572
+ end
573
+ end
574
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
575
+ # rubocop:enable Layout/EmptyLines
576
+
577
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
578
+ # rubocop:disable Layout/EmptyLines
579
+
580
+
423
581
  # Calls {OCI::Core::BlockstorageClient#update_volume} and then waits for the {OCI::Core::Models::Volume} acted upon
424
582
  # to enter the given state(s).
425
583
  #
@@ -1409,18 +1409,17 @@ module OCI
1409
1409
  # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
1410
1410
 
1411
1411
 
1412
- # Performs one of the power actions (start, stop, softreset, softstop, or reset)
1413
- # on the specified instance.
1412
+ # Performs one of the following power actions on the specified instance:
1414
1413
  #
1415
- # **start** - power on
1414
+ # - **START** - Powers on the instance.
1416
1415
  #
1417
- # **stop** - power off
1416
+ # - **STOP** - Powers off the instance.
1418
1417
  #
1419
- # **softreset** - ACPI shutdown and power on
1418
+ # - **SOFTRESET** - Gracefully reboots instance by sending a shutdown command to the operating system and then powers the instance back on.
1420
1419
  #
1421
- # **softstop** - signal the instance operating system to shutdown gracefully
1420
+ # - **SOFTSTOP** - Gracefully shuts down instance by sending a shutdown command to the operating system.
1422
1421
  #
1423
- # **reset** - power off and power on
1422
+ # - **RESET** - Powers off the instance and then powers it back on.
1424
1423
  #
1425
1424
  # For more information see [Stopping and Starting an Instance](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/restartinginstance.htm).
1426
1425
  #
@@ -17,6 +17,10 @@ require 'oci/core/models/attach_vnic_details'
17
17
  require 'oci/core/models/attach_volume_details'
18
18
  require 'oci/core/models/boot_volume'
19
19
  require 'oci/core/models/boot_volume_attachment'
20
+ require 'oci/core/models/boot_volume_backup'
21
+ require 'oci/core/models/boot_volume_source_details'
22
+ require 'oci/core/models/boot_volume_source_from_boot_volume_backup_details'
23
+ require 'oci/core/models/boot_volume_source_from_boot_volume_details'
20
24
  require 'oci/core/models/bulk_add_virtual_circuit_public_prefixes_details'
21
25
  require 'oci/core/models/bulk_delete_virtual_circuit_public_prefixes_details'
22
26
  require 'oci/core/models/capture_console_history_details'
@@ -24,6 +28,8 @@ require 'oci/core/models/connect_local_peering_gateways_details'
24
28
  require 'oci/core/models/connect_remote_peering_connections_details'
25
29
  require 'oci/core/models/console_history'
26
30
  require 'oci/core/models/cpe'
31
+ require 'oci/core/models/create_boot_volume_backup_details'
32
+ require 'oci/core/models/create_boot_volume_details'
27
33
  require 'oci/core/models/create_cpe_details'
28
34
  require 'oci/core/models/create_cross_connect_details'
29
35
  require 'oci/core/models/create_cross_connect_group_details'
@@ -40,6 +46,7 @@ require 'oci/core/models/create_public_ip_details'
40
46
  require 'oci/core/models/create_remote_peering_connection_details'
41
47
  require 'oci/core/models/create_route_table_details'
42
48
  require 'oci/core/models/create_security_list_details'
49
+ require 'oci/core/models/create_service_gateway_details'
43
50
  require 'oci/core/models/create_subnet_details'
44
51
  require 'oci/core/models/create_vcn_details'
45
52
  require 'oci/core/models/create_virtual_circuit_details'
@@ -100,12 +107,17 @@ require 'oci/core/models/remote_peering_connection'
100
107
  require 'oci/core/models/route_rule'
101
108
  require 'oci/core/models/route_table'
102
109
  require 'oci/core/models/security_list'
110
+ require 'oci/core/models/service'
111
+ require 'oci/core/models/service_gateway'
112
+ require 'oci/core/models/service_id_request_details'
113
+ require 'oci/core/models/service_id_response_details'
103
114
  require 'oci/core/models/shape'
104
115
  require 'oci/core/models/subnet'
105
116
  require 'oci/core/models/tcp_options'
106
117
  require 'oci/core/models/tunnel_config'
107
118
  require 'oci/core/models/tunnel_status'
108
119
  require 'oci/core/models/udp_options'
120
+ require 'oci/core/models/update_boot_volume_backup_details'
109
121
  require 'oci/core/models/update_boot_volume_details'
110
122
  require 'oci/core/models/update_console_history_details'
111
123
  require 'oci/core/models/update_cpe_details'
@@ -124,6 +136,7 @@ require 'oci/core/models/update_public_ip_details'
124
136
  require 'oci/core/models/update_remote_peering_connection_details'
125
137
  require 'oci/core/models/update_route_table_details'
126
138
  require 'oci/core/models/update_security_list_details'
139
+ require 'oci/core/models/update_service_gateway_details'
127
140
  require 'oci/core/models/update_subnet_details'
128
141
  require 'oci/core/models/update_vcn_details'
129
142
  require 'oci/core/models/update_virtual_circuit_details'
@@ -34,12 +34,29 @@ module OCI
34
34
  # @return [String]
35
35
  attr_accessor :compartment_id
36
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
+
37
45
  # A user-friendly name. Does not have to be unique, and it's changeable.
38
46
  # Avoid entering confidential information.
39
47
  #
40
48
  # @return [String]
41
49
  attr_accessor :display_name
42
50
 
51
+ # Free-form tags for this resource. Each tag is a simple key-value pair with no
52
+ # predefined name, type, or namespace. For more information, see
53
+ # [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
54
+ #
55
+ # Example: `{\"Department\": \"Finance\"}`
56
+ #
57
+ # @return [Hash<String, String>]
58
+ attr_accessor :freeform_tags
59
+
43
60
  # **[Required]** The boot volume's Oracle ID (OCID).
44
61
  # @return [String]
45
62
  attr_accessor :id
@@ -48,6 +65,10 @@ module OCI
48
65
  # @return [String]
49
66
  attr_accessor :image_id
50
67
 
68
+ # Specifies whether the boot volume's data has finished copying from the source boot volume or boot volume backup.
69
+ # @return [BOOLEAN]
70
+ attr_accessor :is_hydrated
71
+
51
72
  # **[Required]** The current state of a boot volume.
52
73
  # @return [String]
53
74
  attr_reader :lifecycle_state
@@ -62,6 +83,12 @@ module OCI
62
83
  # @return [Integer]
63
84
  attr_accessor :size_in_mbs
64
85
 
86
+ # The boot volume source, either an existing boot volume in the same Availability Domain or a boot volume backup.
87
+ # If null, this means that the boot volume was created from an image.
88
+ #
89
+ # @return [OCI::Core::Models::BootVolumeSourceDetails]
90
+ attr_accessor :source_details
91
+
65
92
  # **[Required]** The date and time the boot volume was created. Format defined by RFC3339.
66
93
  # @return [DateTime]
67
94
  attr_accessor :time_created
@@ -76,12 +103,16 @@ module OCI
76
103
  # rubocop:disable Style/SymbolLiteral
77
104
  'availability_domain': :'availabilityDomain',
78
105
  'compartment_id': :'compartmentId',
106
+ 'defined_tags': :'definedTags',
79
107
  'display_name': :'displayName',
108
+ 'freeform_tags': :'freeformTags',
80
109
  'id': :'id',
81
110
  'image_id': :'imageId',
111
+ 'is_hydrated': :'isHydrated',
82
112
  'lifecycle_state': :'lifecycleState',
83
113
  'size_in_gbs': :'sizeInGBs',
84
114
  'size_in_mbs': :'sizeInMBs',
115
+ 'source_details': :'sourceDetails',
85
116
  'time_created': :'timeCreated',
86
117
  'volume_group_id': :'volumeGroupId'
87
118
  # rubocop:enable Style/SymbolLiteral
@@ -94,12 +125,16 @@ module OCI
94
125
  # rubocop:disable Style/SymbolLiteral
95
126
  'availability_domain': :'String',
96
127
  'compartment_id': :'String',
128
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
97
129
  'display_name': :'String',
130
+ 'freeform_tags': :'Hash<String, String>',
98
131
  'id': :'String',
99
132
  'image_id': :'String',
133
+ 'is_hydrated': :'BOOLEAN',
100
134
  'lifecycle_state': :'String',
101
135
  'size_in_gbs': :'Integer',
102
136
  'size_in_mbs': :'Integer',
137
+ 'source_details': :'OCI::Core::Models::BootVolumeSourceDetails',
103
138
  'time_created': :'DateTime',
104
139
  'volume_group_id': :'String'
105
140
  # rubocop:enable Style/SymbolLiteral
@@ -114,12 +149,16 @@ module OCI
114
149
  # @param [Hash] attributes Model attributes in the form of hash
115
150
  # @option attributes [String] :availability_domain The value to assign to the {#availability_domain} property
116
151
  # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
152
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
117
153
  # @option attributes [String] :display_name The value to assign to the {#display_name} property
154
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
118
155
  # @option attributes [String] :id The value to assign to the {#id} property
119
156
  # @option attributes [String] :image_id The value to assign to the {#image_id} property
157
+ # @option attributes [BOOLEAN] :is_hydrated The value to assign to the {#is_hydrated} property
120
158
  # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
121
159
  # @option attributes [Integer] :size_in_gbs The value to assign to the {#size_in_gbs} property
122
160
  # @option attributes [Integer] :size_in_mbs The value to assign to the {#size_in_mbs} property
161
+ # @option attributes [OCI::Core::Models::BootVolumeSourceDetails] :source_details The value to assign to the {#source_details} property
123
162
  # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
124
163
  # @option attributes [String] :volume_group_id The value to assign to the {#volume_group_id} property
125
164
  def initialize(attributes = {})
@@ -140,12 +179,24 @@ module OCI
140
179
 
141
180
  self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
142
181
 
182
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
183
+
184
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
185
+
186
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
187
+
143
188
  self.display_name = attributes[:'displayName'] if attributes[:'displayName']
144
189
 
145
190
  raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
146
191
 
147
192
  self.display_name = attributes[:'display_name'] if attributes[:'display_name']
148
193
 
194
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
195
+
196
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
197
+
198
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
199
+
149
200
  self.id = attributes[:'id'] if attributes[:'id']
150
201
 
151
202
  self.image_id = attributes[:'imageId'] if attributes[:'imageId']
@@ -154,6 +205,12 @@ module OCI
154
205
 
155
206
  self.image_id = attributes[:'image_id'] if attributes[:'image_id']
156
207
 
208
+ self.is_hydrated = attributes[:'isHydrated'] unless attributes[:'isHydrated'].nil?
209
+
210
+ raise 'You cannot provide both :isHydrated and :is_hydrated' if attributes.key?(:'isHydrated') && attributes.key?(:'is_hydrated')
211
+
212
+ self.is_hydrated = attributes[:'is_hydrated'] unless attributes[:'is_hydrated'].nil?
213
+
157
214
  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
158
215
 
159
216
  raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
@@ -172,6 +229,12 @@ module OCI
172
229
 
173
230
  self.size_in_mbs = attributes[:'size_in_mbs'] if attributes[:'size_in_mbs']
174
231
 
232
+ self.source_details = attributes[:'sourceDetails'] if attributes[:'sourceDetails']
233
+
234
+ raise 'You cannot provide both :sourceDetails and :source_details' if attributes.key?(:'sourceDetails') && attributes.key?(:'source_details')
235
+
236
+ self.source_details = attributes[:'source_details'] if attributes[:'source_details']
237
+
175
238
  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
176
239
 
177
240
  raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
@@ -212,12 +275,16 @@ module OCI
212
275
  self.class == other.class &&
213
276
  availability_domain == other.availability_domain &&
214
277
  compartment_id == other.compartment_id &&
278
+ defined_tags == other.defined_tags &&
215
279
  display_name == other.display_name &&
280
+ freeform_tags == other.freeform_tags &&
216
281
  id == other.id &&
217
282
  image_id == other.image_id &&
283
+ is_hydrated == other.is_hydrated &&
218
284
  lifecycle_state == other.lifecycle_state &&
219
285
  size_in_gbs == other.size_in_gbs &&
220
286
  size_in_mbs == other.size_in_mbs &&
287
+ source_details == other.source_details &&
221
288
  time_created == other.time_created &&
222
289
  volume_group_id == other.volume_group_id
223
290
  end
@@ -235,7 +302,7 @@ module OCI
235
302
  # Calculates hash code according to all attributes.
236
303
  # @return [Fixnum] Hash code
237
304
  def hash
238
- [availability_domain, compartment_id, display_name, id, image_id, lifecycle_state, size_in_gbs, size_in_mbs, time_created, volume_group_id].hash
305
+ [availability_domain, compartment_id, defined_tags, display_name, freeform_tags, id, image_id, is_hydrated, lifecycle_state, size_in_gbs, size_in_mbs, source_details, time_created, volume_group_id].hash
239
306
  end
240
307
  # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
241
308
 
@@ -0,0 +1,435 @@
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 boot volume that can then be used to create
9
+ # a new boot volume or recover a boot volume. For more information, see [Overview
10
+ # of Boot Volume Backups](https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Concepts/bootvolumebackups.htm)
11
+ # To use any of the API operations, you must be authorized in an IAM policy.
12
+ # If you're not authorized, talk to an administrator. If you're an administrator
13
+ # who needs to write policies to give users access, see [Getting Started with
14
+ # Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
15
+ #
16
+ class Core::Models::BootVolumeBackup # rubocop:disable Metrics/LineLength
17
+ LIFECYCLE_STATE_ENUM = [
18
+ LIFECYCLE_STATE_CREATING = 'CREATING'.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
+ SOURCE_TYPE_ENUM = [
28
+ SOURCE_TYPE_MANUAL = 'MANUAL'.freeze,
29
+ SOURCE_TYPE_SCHEDULED = 'SCHEDULED'.freeze,
30
+ SOURCE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
31
+ ].freeze
32
+
33
+ TYPE_ENUM = [
34
+ TYPE_FULL = 'FULL'.freeze,
35
+ TYPE_INCREMENTAL = 'INCREMENTAL'.freeze,
36
+ TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
37
+ ].freeze
38
+
39
+ # The OCID of the boot volume.
40
+ # @return [String]
41
+ attr_accessor :boot_volume_id
42
+
43
+ # **[Required]** The OCID of the compartment that contains the boot volume backup.
44
+ # @return [String]
45
+ attr_accessor :compartment_id
46
+
47
+ # Defined tags for this resource. Each key is predefined and scoped to a namespace.
48
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
49
+ #
50
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
51
+ #
52
+ # @return [Hash<String, Hash<String, Object>>]
53
+ attr_accessor :defined_tags
54
+
55
+ # **[Required]** A user-friendly name for the boot volume backup. Does not have to be unique and it's changeable.
56
+ # Avoid entering confidential information.
57
+ #
58
+ # @return [String]
59
+ attr_accessor :display_name
60
+
61
+ # The date and time the volume backup will expire and be automatically deleted.
62
+ # Format defined by RFC3339. This parameter will always be present for backups that
63
+ # were created automatically by a scheduled-backup policy. For manually created backups,
64
+ # it will be absent, signifying that there is no expiration time and the backup will
65
+ # last forever until manually deleted.
66
+ #
67
+ # @return [DateTime]
68
+ attr_accessor :expiration_time
69
+
70
+ # Free-form tags for this resource. Each tag is a simple key-value pair with no
71
+ # predefined name, type, or namespace. For more information, see
72
+ # [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
73
+ #
74
+ # Example: `{\"Department\": \"Finance\"}`
75
+ #
76
+ # @return [Hash<String, String>]
77
+ attr_accessor :freeform_tags
78
+
79
+ # **[Required]** The OCID of the boot volume backup.
80
+ # @return [String]
81
+ attr_accessor :id
82
+
83
+ # The image OCID used to create the boot volume the backup is taken from.
84
+ # @return [String]
85
+ attr_accessor :image_id
86
+
87
+ # **[Required]** The current state of a boot volume backup.
88
+ # @return [String]
89
+ attr_reader :lifecycle_state
90
+
91
+ # The size of the boot volume, in GBs.
92
+ #
93
+ # @return [Integer]
94
+ attr_accessor :size_in_gbs
95
+
96
+ # Specifies whether the backup was created manually, or via scheduled backup policy.
97
+ # @return [String]
98
+ attr_reader :source_type
99
+
100
+ # **[Required]** The date and time the boot volume backup was created. This is the time the actual point-in-time image
101
+ # of the volume data was taken. Format defined by RFC3339.
102
+ #
103
+ # @return [DateTime]
104
+ attr_accessor :time_created
105
+
106
+ # The date and time the request to create the boot volume backup was received. Format defined by RFC3339.
107
+ #
108
+ # @return [DateTime]
109
+ attr_accessor :time_request_received
110
+
111
+ # The type of a volume backup.
112
+ # @return [String]
113
+ attr_reader :type
114
+
115
+ # The size used by the backup, in GBs. It is typically smaller than sizeInGBs, depending on the space
116
+ # consumed on the boot volume and whether the backup is full or incremental.
117
+ #
118
+ # @return [Integer]
119
+ attr_accessor :unique_size_in_gbs
120
+
121
+ # Attribute mapping from ruby-style variable name to JSON key.
122
+ def self.attribute_map
123
+ {
124
+ # rubocop:disable Style/SymbolLiteral
125
+ 'boot_volume_id': :'bootVolumeId',
126
+ 'compartment_id': :'compartmentId',
127
+ 'defined_tags': :'definedTags',
128
+ 'display_name': :'displayName',
129
+ 'expiration_time': :'expirationTime',
130
+ 'freeform_tags': :'freeformTags',
131
+ 'id': :'id',
132
+ 'image_id': :'imageId',
133
+ 'lifecycle_state': :'lifecycleState',
134
+ 'size_in_gbs': :'sizeInGBs',
135
+ 'source_type': :'sourceType',
136
+ 'time_created': :'timeCreated',
137
+ 'time_request_received': :'timeRequestReceived',
138
+ 'type': :'type',
139
+ 'unique_size_in_gbs': :'uniqueSizeInGBs'
140
+ # rubocop:enable Style/SymbolLiteral
141
+ }
142
+ end
143
+
144
+ # Attribute type mapping.
145
+ def self.swagger_types
146
+ {
147
+ # rubocop:disable Style/SymbolLiteral
148
+ 'boot_volume_id': :'String',
149
+ 'compartment_id': :'String',
150
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
151
+ 'display_name': :'String',
152
+ 'expiration_time': :'DateTime',
153
+ 'freeform_tags': :'Hash<String, String>',
154
+ 'id': :'String',
155
+ 'image_id': :'String',
156
+ 'lifecycle_state': :'String',
157
+ 'size_in_gbs': :'Integer',
158
+ 'source_type': :'String',
159
+ 'time_created': :'DateTime',
160
+ 'time_request_received': :'DateTime',
161
+ 'type': :'String',
162
+ 'unique_size_in_gbs': :'Integer'
163
+ # rubocop:enable Style/SymbolLiteral
164
+ }
165
+ end
166
+
167
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
168
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
169
+
170
+
171
+ # Initializes the object
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @option attributes [String] :boot_volume_id The value to assign to the {#boot_volume_id} property
174
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
175
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
176
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
177
+ # @option attributes [DateTime] :expiration_time The value to assign to the {#expiration_time} property
178
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
179
+ # @option attributes [String] :id The value to assign to the {#id} property
180
+ # @option attributes [String] :image_id The value to assign to the {#image_id} property
181
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
182
+ # @option attributes [Integer] :size_in_gbs The value to assign to the {#size_in_gbs} property
183
+ # @option attributes [String] :source_type The value to assign to the {#source_type} property
184
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
185
+ # @option attributes [DateTime] :time_request_received The value to assign to the {#time_request_received} property
186
+ # @option attributes [String] :type The value to assign to the {#type} property
187
+ # @option attributes [Integer] :unique_size_in_gbs The value to assign to the {#unique_size_in_gbs} property
188
+ def initialize(attributes = {})
189
+ return unless attributes.is_a?(Hash)
190
+
191
+ # convert string to symbol for hash key
192
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
193
+
194
+ self.boot_volume_id = attributes[:'bootVolumeId'] if attributes[:'bootVolumeId']
195
+
196
+ raise 'You cannot provide both :bootVolumeId and :boot_volume_id' if attributes.key?(:'bootVolumeId') && attributes.key?(:'boot_volume_id')
197
+
198
+ self.boot_volume_id = attributes[:'boot_volume_id'] if attributes[:'boot_volume_id']
199
+
200
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
201
+
202
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
203
+
204
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
205
+
206
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
207
+
208
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
209
+
210
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
211
+
212
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
213
+
214
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
215
+
216
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
217
+
218
+ self.expiration_time = attributes[:'expirationTime'] if attributes[:'expirationTime']
219
+
220
+ raise 'You cannot provide both :expirationTime and :expiration_time' if attributes.key?(:'expirationTime') && attributes.key?(:'expiration_time')
221
+
222
+ self.expiration_time = attributes[:'expiration_time'] if attributes[:'expiration_time']
223
+
224
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
225
+
226
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
227
+
228
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
229
+
230
+ self.id = attributes[:'id'] if attributes[:'id']
231
+
232
+ self.image_id = attributes[:'imageId'] if attributes[:'imageId']
233
+
234
+ raise 'You cannot provide both :imageId and :image_id' if attributes.key?(:'imageId') && attributes.key?(:'image_id')
235
+
236
+ self.image_id = attributes[:'image_id'] if attributes[:'image_id']
237
+
238
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
239
+
240
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
241
+
242
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
243
+
244
+ self.size_in_gbs = attributes[:'sizeInGBs'] if attributes[:'sizeInGBs']
245
+
246
+ raise 'You cannot provide both :sizeInGBs and :size_in_gbs' if attributes.key?(:'sizeInGBs') && attributes.key?(:'size_in_gbs')
247
+
248
+ self.size_in_gbs = attributes[:'size_in_gbs'] if attributes[:'size_in_gbs']
249
+
250
+ self.source_type = attributes[:'sourceType'] if attributes[:'sourceType']
251
+
252
+ raise 'You cannot provide both :sourceType and :source_type' if attributes.key?(:'sourceType') && attributes.key?(:'source_type')
253
+
254
+ self.source_type = attributes[:'source_type'] if attributes[:'source_type']
255
+
256
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
257
+
258
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
259
+
260
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
261
+
262
+ self.time_request_received = attributes[:'timeRequestReceived'] if attributes[:'timeRequestReceived']
263
+
264
+ raise 'You cannot provide both :timeRequestReceived and :time_request_received' if attributes.key?(:'timeRequestReceived') && attributes.key?(:'time_request_received')
265
+
266
+ self.time_request_received = attributes[:'time_request_received'] if attributes[:'time_request_received']
267
+
268
+ self.type = attributes[:'type'] if attributes[:'type']
269
+
270
+ self.unique_size_in_gbs = attributes[:'uniqueSizeInGBs'] if attributes[:'uniqueSizeInGBs']
271
+
272
+ raise 'You cannot provide both :uniqueSizeInGBs and :unique_size_in_gbs' if attributes.key?(:'uniqueSizeInGBs') && attributes.key?(:'unique_size_in_gbs')
273
+
274
+ self.unique_size_in_gbs = attributes[:'unique_size_in_gbs'] if attributes[:'unique_size_in_gbs']
275
+ end
276
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
277
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
278
+
279
+ # Custom attribute writer method checking allowed values (enum).
280
+ # @param [Object] lifecycle_state Object to be assigned
281
+ def lifecycle_state=(lifecycle_state)
282
+ # rubocop:disable Style/ConditionalAssignment
283
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
284
+ # rubocop: disable Metrics/LineLength
285
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
286
+ # rubocop: enable Metrics/LineLength
287
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
288
+ else
289
+ @lifecycle_state = lifecycle_state
290
+ end
291
+ # rubocop:enable Style/ConditionalAssignment
292
+ end
293
+
294
+ # Custom attribute writer method checking allowed values (enum).
295
+ # @param [Object] source_type Object to be assigned
296
+ def source_type=(source_type)
297
+ # rubocop:disable Style/ConditionalAssignment
298
+ if source_type && !SOURCE_TYPE_ENUM.include?(source_type)
299
+ # rubocop: disable Metrics/LineLength
300
+ OCI.logger.debug("Unknown value for 'source_type' [" + source_type + "]. Mapping to 'SOURCE_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
301
+ # rubocop: enable Metrics/LineLength
302
+ @source_type = SOURCE_TYPE_UNKNOWN_ENUM_VALUE
303
+ else
304
+ @source_type = source_type
305
+ end
306
+ # rubocop:enable Style/ConditionalAssignment
307
+ end
308
+
309
+ # Custom attribute writer method checking allowed values (enum).
310
+ # @param [Object] type Object to be assigned
311
+ def type=(type)
312
+ # rubocop:disable Style/ConditionalAssignment
313
+ if type && !TYPE_ENUM.include?(type)
314
+ # rubocop: disable Metrics/LineLength
315
+ OCI.logger.debug("Unknown value for 'type' [" + type + "]. Mapping to 'TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
316
+ # rubocop: enable Metrics/LineLength
317
+ @type = TYPE_UNKNOWN_ENUM_VALUE
318
+ else
319
+ @type = type
320
+ end
321
+ # rubocop:enable Style/ConditionalAssignment
322
+ end
323
+
324
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
325
+
326
+
327
+ # Checks equality by comparing each attribute.
328
+ # @param [Object] other the other object to be compared
329
+ def ==(other)
330
+ return true if equal?(other)
331
+ self.class == other.class &&
332
+ boot_volume_id == other.boot_volume_id &&
333
+ compartment_id == other.compartment_id &&
334
+ defined_tags == other.defined_tags &&
335
+ display_name == other.display_name &&
336
+ expiration_time == other.expiration_time &&
337
+ freeform_tags == other.freeform_tags &&
338
+ id == other.id &&
339
+ image_id == other.image_id &&
340
+ lifecycle_state == other.lifecycle_state &&
341
+ size_in_gbs == other.size_in_gbs &&
342
+ source_type == other.source_type &&
343
+ time_created == other.time_created &&
344
+ time_request_received == other.time_request_received &&
345
+ type == other.type &&
346
+ unique_size_in_gbs == other.unique_size_in_gbs
347
+ end
348
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
349
+
350
+ # @see the `==` method
351
+ # @param [Object] other the other object to be compared
352
+ def eql?(other)
353
+ self == other
354
+ end
355
+
356
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
357
+
358
+
359
+ # Calculates hash code according to all attributes.
360
+ # @return [Fixnum] Hash code
361
+ def hash
362
+ [boot_volume_id, compartment_id, defined_tags, display_name, expiration_time, freeform_tags, id, image_id, lifecycle_state, size_in_gbs, source_type, time_created, time_request_received, type, unique_size_in_gbs].hash
363
+ end
364
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
365
+
366
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
367
+
368
+
369
+ # Builds the object from hash
370
+ # @param [Hash] attributes Model attributes in the form of hash
371
+ # @return [Object] Returns the model itself
372
+ def build_from_hash(attributes)
373
+ return nil unless attributes.is_a?(Hash)
374
+ self.class.swagger_types.each_pair do |key, type|
375
+ if type =~ /^Array<(.*)>/i
376
+ # check to ensure the input is an array given that the the attribute
377
+ # is documented as an array but the input is not
378
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
379
+ public_method("#{key}=").call(
380
+ attributes[self.class.attribute_map[key]]
381
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
382
+ )
383
+ end
384
+ elsif !attributes[self.class.attribute_map[key]].nil?
385
+ public_method("#{key}=").call(
386
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
387
+ )
388
+ end
389
+ # or else data not found in attributes(hash), not an issue as the data can be optional
390
+ end
391
+
392
+ self
393
+ end
394
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
395
+
396
+ # Returns the string representation of the object
397
+ # @return [String] String presentation of the object
398
+ def to_s
399
+ to_hash.to_s
400
+ end
401
+
402
+ # Returns the object in the form of hash
403
+ # @return [Hash] Returns the object in the form of hash
404
+ def to_hash
405
+ hash = {}
406
+ self.class.attribute_map.each_pair do |attr, param|
407
+ value = public_method(attr).call
408
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
409
+ hash[param] = _to_hash(value)
410
+ end
411
+ hash
412
+ end
413
+
414
+ private
415
+
416
+ # Outputs non-array value in the form of hash
417
+ # For object, use to_hash. Otherwise, just return the value
418
+ # @param [Object] value Any valid value
419
+ # @return [Hash] Returns the value in the form of hash
420
+ def _to_hash(value)
421
+ if value.is_a?(Array)
422
+ value.compact.map { |v| _to_hash(v) }
423
+ elsif value.is_a?(Hash)
424
+ {}.tap do |hash|
425
+ value.each { |k, v| hash[k] = _to_hash(v) }
426
+ end
427
+ elsif value.respond_to? :to_hash
428
+ value.to_hash
429
+ else
430
+ value
431
+ end
432
+ end
433
+ end
434
+ end
435
+ # rubocop:enable Lint/UnneededCopDisableDirective