oci 2.1.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -5640,7 +5640,7 @@ module OCI
5640
5640
  # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
5641
5641
 
5642
5642
 
5643
- # Updates the specified CPE's display name.
5643
+ # Updates the specified CPE's display name or tags.
5644
5644
  # Avoid entering confidential information.
5645
5645
  #
5646
5646
  # @param [String] cpe_id The OCID of the CPE.
@@ -5872,7 +5872,7 @@ module OCI
5872
5872
  # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
5873
5873
 
5874
5874
 
5875
- # Updates the specified DRG's display name. Avoid entering confidential information.
5875
+ # Updates the specified DRG's display name or tags. Avoid entering confidential information.
5876
5876
  #
5877
5877
  # @param [String] drg_id The OCID of the DRG.
5878
5878
  # @param [OCI::Core::Models::UpdateDrgDetails] update_drg_details Details object for updating a DRG.
@@ -5987,8 +5987,8 @@ module OCI
5987
5987
  # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
5988
5988
 
5989
5989
 
5990
- # Updates the specified Internet Gateway. You can disable/enable it, or change its display name.
5991
- # Avoid entering confidential information.
5990
+ # Updates the specified Internet Gateway. You can disable/enable it, or change its display name
5991
+ # or tags. Avoid entering confidential information.
5992
5992
  #
5993
5993
  # If the gateway is disabled, that means no traffic will flow to/from the internet even if there's
5994
5994
  # a route rule that enables that traffic.
@@ -6048,7 +6048,7 @@ module OCI
6048
6048
  # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
6049
6049
 
6050
6050
 
6051
- # Updates the display name for the specified IPSec connection.
6051
+ # Updates the display name or tags for the specified IPSec connection.
6052
6052
  # Avoid entering confidential information.
6053
6053
  #
6054
6054
  # @param [String] ipsc_id The OCID of the IPSec connection.
@@ -6235,7 +6235,7 @@ module OCI
6235
6235
  # * Move a reserved public IP to a different private IP.
6236
6236
  # * Unassign a reserved public IP from a private IP (which returns it to your pool
6237
6237
  # of reserved public IPs).
6238
- # * Change the display name for a public IP.
6238
+ # * Change the display name or tags for a public IP.
6239
6239
  #
6240
6240
  # Assigning, moving, and unassigning a reserved public IP are asynchronous
6241
6241
  # operations. Poll the public IP's `lifecycleState` to determine if the operation
@@ -18,6 +18,7 @@ require 'oci/database/models/create_data_guard_association_to_existing_db_system
18
18
  require 'oci/database/models/create_database_details'
19
19
  require 'oci/database/models/create_database_from_backup_details'
20
20
  require 'oci/database/models/create_db_home_details'
21
+ require 'oci/database/models/create_db_home_from_backup_details'
21
22
  require 'oci/database/models/create_db_home_with_db_system_id_base'
22
23
  require 'oci/database/models/create_db_home_with_db_system_id_details'
23
24
  require 'oci/database/models/create_db_home_with_db_system_id_from_backup_details'
@@ -35,7 +36,9 @@ require 'oci/database/models/db_system_shape_summary'
35
36
  require 'oci/database/models/db_system_summary'
36
37
  require 'oci/database/models/db_version_summary'
37
38
  require 'oci/database/models/failover_data_guard_association_details'
39
+ require 'oci/database/models/launch_db_system_base'
38
40
  require 'oci/database/models/launch_db_system_details'
41
+ require 'oci/database/models/launch_db_system_from_backup_details'
39
42
  require 'oci/database/models/patch'
40
43
  require 'oci/database/models/patch_details'
41
44
  require 'oci/database/models/patch_history_entry'
@@ -1078,7 +1078,7 @@ module OCI
1078
1078
  # manage existing databases. For more information, see the
1079
1079
  # [Oracle Database CLI Reference](https://docs.us-phoenix-1.oraclecloud.com/Content/Database/References/odacli.htm#Oracle_Database_CLI_Reference).
1080
1080
  #
1081
- # @param [OCI::Database::Models::LaunchDbSystemDetails] launch_db_system_details Request to launch a DB System.
1081
+ # @param [OCI::Database::Models::LaunchDbSystemBase] launch_db_system_details Request to launch a DB System.
1082
1082
  # @param [Hash] opts the optional parameters
1083
1083
  # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
1084
1084
  # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then then operation will not retry
@@ -266,7 +266,7 @@ module OCI
266
266
  # Calls {OCI::Database::DatabaseClient#launch_db_system} and then waits for the {OCI::Database::Models::DbSystem} acted upon
267
267
  # to enter the given state(s).
268
268
  #
269
- # @param [OCI::Database::Models::LaunchDbSystemDetails] launch_db_system_details Request to launch a DB System.
269
+ # @param [OCI::Database::Models::LaunchDbSystemBase] launch_db_system_details Request to launch a DB System.
270
270
  # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Database::Models::DbSystem#lifecycle_state}
271
271
  # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Database::DatabaseClient#launch_db_system}
272
272
  # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
@@ -33,10 +33,20 @@ module OCI
33
33
  # @return [String]
34
34
  attr_accessor :compartment_id
35
35
 
36
+ # The Oracle Database Edition of the DbSystem on which the backup was taken.
37
+ #
38
+ # @return [String]
39
+ attr_accessor :database_edition
40
+
36
41
  # The OCID of the database.
37
42
  # @return [String]
38
43
  attr_accessor :database_id
39
44
 
45
+ # Size of the database in mega-bytes at the time the backup was taken.
46
+ #
47
+ # @return [Integer]
48
+ attr_accessor :db_data_size_in_mbs
49
+
40
50
  # The user-friendly name for the backup. It does not have to be unique.
41
51
  # @return [String]
42
52
  attr_accessor :display_name
@@ -71,7 +81,9 @@ module OCI
71
81
  # rubocop:disable Style/SymbolLiteral
72
82
  'availability_domain': :'availabilityDomain',
73
83
  'compartment_id': :'compartmentId',
84
+ 'database_edition': :'databaseEdition',
74
85
  'database_id': :'databaseId',
86
+ 'db_data_size_in_mbs': :'dbDataSizeInMBs',
75
87
  'display_name': :'displayName',
76
88
  'id': :'id',
77
89
  'lifecycle_details': :'lifecycleDetails',
@@ -89,7 +101,9 @@ module OCI
89
101
  # rubocop:disable Style/SymbolLiteral
90
102
  'availability_domain': :'String',
91
103
  'compartment_id': :'String',
104
+ 'database_edition': :'String',
92
105
  'database_id': :'String',
106
+ 'db_data_size_in_mbs': :'Integer',
93
107
  'display_name': :'String',
94
108
  'id': :'String',
95
109
  'lifecycle_details': :'String',
@@ -109,7 +123,9 @@ module OCI
109
123
  # @param [Hash] attributes Model attributes in the form of hash
110
124
  # @option attributes [String] :availability_domain The value to assign to the {#availability_domain} property
111
125
  # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
126
+ # @option attributes [String] :database_edition The value to assign to the {#database_edition} property
112
127
  # @option attributes [String] :database_id The value to assign to the {#database_id} property
128
+ # @option attributes [Integer] :db_data_size_in_mbs The value to assign to the {#db_data_size_in_mbs} property
113
129
  # @option attributes [String] :display_name The value to assign to the {#display_name} property
114
130
  # @option attributes [String] :id The value to assign to the {#id} property
115
131
  # @option attributes [String] :lifecycle_details The value to assign to the {#lifecycle_details} property
@@ -135,12 +151,24 @@ module OCI
135
151
 
136
152
  self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
137
153
 
154
+ self.database_edition = attributes[:'databaseEdition'] if attributes[:'databaseEdition']
155
+
156
+ raise 'You cannot provide both :databaseEdition and :database_edition' if attributes.key?(:'databaseEdition') && attributes.key?(:'database_edition')
157
+
158
+ self.database_edition = attributes[:'database_edition'] if attributes[:'database_edition']
159
+
138
160
  self.database_id = attributes[:'databaseId'] if attributes[:'databaseId']
139
161
 
140
162
  raise 'You cannot provide both :databaseId and :database_id' if attributes.key?(:'databaseId') && attributes.key?(:'database_id')
141
163
 
142
164
  self.database_id = attributes[:'database_id'] if attributes[:'database_id']
143
165
 
166
+ self.db_data_size_in_mbs = attributes[:'dbDataSizeInMBs'] if attributes[:'dbDataSizeInMBs']
167
+
168
+ raise 'You cannot provide both :dbDataSizeInMBs and :db_data_size_in_mbs' if attributes.key?(:'dbDataSizeInMBs') && attributes.key?(:'db_data_size_in_mbs')
169
+
170
+ self.db_data_size_in_mbs = attributes[:'db_data_size_in_mbs'] if attributes[:'db_data_size_in_mbs']
171
+
144
172
  self.display_name = attributes[:'displayName'] if attributes[:'displayName']
145
173
 
146
174
  raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
@@ -218,7 +246,9 @@ module OCI
218
246
  self.class == other.class &&
219
247
  availability_domain == other.availability_domain &&
220
248
  compartment_id == other.compartment_id &&
249
+ database_edition == other.database_edition &&
221
250
  database_id == other.database_id &&
251
+ db_data_size_in_mbs == other.db_data_size_in_mbs &&
222
252
  display_name == other.display_name &&
223
253
  id == other.id &&
224
254
  lifecycle_details == other.lifecycle_details &&
@@ -241,7 +271,7 @@ module OCI
241
271
  # Calculates hash code according to all attributes.
242
272
  # @return [Fixnum] Hash code
243
273
  def hash
244
- [availability_domain, compartment_id, database_id, display_name, id, lifecycle_details, lifecycle_state, time_ended, time_started, type].hash
274
+ [availability_domain, compartment_id, database_edition, database_id, db_data_size_in_mbs, display_name, id, lifecycle_details, lifecycle_state, time_ended, time_started, type].hash
245
275
  end
246
276
  # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
247
277
 
@@ -33,10 +33,20 @@ module OCI
33
33
  # @return [String]
34
34
  attr_accessor :compartment_id
35
35
 
36
+ # The Oracle Database Edition of the DbSystem on which the backup was taken.
37
+ #
38
+ # @return [String]
39
+ attr_accessor :database_edition
40
+
36
41
  # The OCID of the database.
37
42
  # @return [String]
38
43
  attr_accessor :database_id
39
44
 
45
+ # Size of the database in mega-bytes at the time the backup was taken.
46
+ #
47
+ # @return [Integer]
48
+ attr_accessor :db_data_size_in_mbs
49
+
40
50
  # The user-friendly name for the backup. It does not have to be unique.
41
51
  # @return [String]
42
52
  attr_accessor :display_name
@@ -71,7 +81,9 @@ module OCI
71
81
  # rubocop:disable Style/SymbolLiteral
72
82
  'availability_domain': :'availabilityDomain',
73
83
  'compartment_id': :'compartmentId',
84
+ 'database_edition': :'databaseEdition',
74
85
  'database_id': :'databaseId',
86
+ 'db_data_size_in_mbs': :'dbDataSizeInMBs',
75
87
  'display_name': :'displayName',
76
88
  'id': :'id',
77
89
  'lifecycle_details': :'lifecycleDetails',
@@ -89,7 +101,9 @@ module OCI
89
101
  # rubocop:disable Style/SymbolLiteral
90
102
  'availability_domain': :'String',
91
103
  'compartment_id': :'String',
104
+ 'database_edition': :'String',
92
105
  'database_id': :'String',
106
+ 'db_data_size_in_mbs': :'Integer',
93
107
  'display_name': :'String',
94
108
  'id': :'String',
95
109
  'lifecycle_details': :'String',
@@ -109,7 +123,9 @@ module OCI
109
123
  # @param [Hash] attributes Model attributes in the form of hash
110
124
  # @option attributes [String] :availability_domain The value to assign to the {#availability_domain} property
111
125
  # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
126
+ # @option attributes [String] :database_edition The value to assign to the {#database_edition} property
112
127
  # @option attributes [String] :database_id The value to assign to the {#database_id} property
128
+ # @option attributes [Integer] :db_data_size_in_mbs The value to assign to the {#db_data_size_in_mbs} property
113
129
  # @option attributes [String] :display_name The value to assign to the {#display_name} property
114
130
  # @option attributes [String] :id The value to assign to the {#id} property
115
131
  # @option attributes [String] :lifecycle_details The value to assign to the {#lifecycle_details} property
@@ -135,12 +151,24 @@ module OCI
135
151
 
136
152
  self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
137
153
 
154
+ self.database_edition = attributes[:'databaseEdition'] if attributes[:'databaseEdition']
155
+
156
+ raise 'You cannot provide both :databaseEdition and :database_edition' if attributes.key?(:'databaseEdition') && attributes.key?(:'database_edition')
157
+
158
+ self.database_edition = attributes[:'database_edition'] if attributes[:'database_edition']
159
+
138
160
  self.database_id = attributes[:'databaseId'] if attributes[:'databaseId']
139
161
 
140
162
  raise 'You cannot provide both :databaseId and :database_id' if attributes.key?(:'databaseId') && attributes.key?(:'database_id')
141
163
 
142
164
  self.database_id = attributes[:'database_id'] if attributes[:'database_id']
143
165
 
166
+ self.db_data_size_in_mbs = attributes[:'dbDataSizeInMBs'] if attributes[:'dbDataSizeInMBs']
167
+
168
+ raise 'You cannot provide both :dbDataSizeInMBs and :db_data_size_in_mbs' if attributes.key?(:'dbDataSizeInMBs') && attributes.key?(:'db_data_size_in_mbs')
169
+
170
+ self.db_data_size_in_mbs = attributes[:'db_data_size_in_mbs'] if attributes[:'db_data_size_in_mbs']
171
+
144
172
  self.display_name = attributes[:'displayName'] if attributes[:'displayName']
145
173
 
146
174
  raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
@@ -218,7 +246,9 @@ module OCI
218
246
  self.class == other.class &&
219
247
  availability_domain == other.availability_domain &&
220
248
  compartment_id == other.compartment_id &&
249
+ database_edition == other.database_edition &&
221
250
  database_id == other.database_id &&
251
+ db_data_size_in_mbs == other.db_data_size_in_mbs &&
222
252
  display_name == other.display_name &&
223
253
  id == other.id &&
224
254
  lifecycle_details == other.lifecycle_details &&
@@ -241,7 +271,7 @@ module OCI
241
271
  # Calculates hash code according to all attributes.
242
272
  # @return [Fixnum] Hash code
243
273
  def hash
244
- [availability_domain, compartment_id, database_id, display_name, id, lifecycle_details, lifecycle_state, time_ended, time_started, type].hash
274
+ [availability_domain, compartment_id, database_edition, database_id, db_data_size_in_mbs, display_name, id, lifecycle_details, lifecycle_state, time_ended, time_started, type].hash
245
275
  end
246
276
  # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
247
277
 
@@ -0,0 +1,160 @@
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
+ # CreateDbHomeFromBackupDetails model.
8
+ class Database::Models::CreateDbHomeFromBackupDetails # rubocop:disable Metrics/LineLength
9
+ # This attribute is required.
10
+ # @return [OCI::Database::Models::CreateDatabaseFromBackupDetails]
11
+ attr_accessor :database
12
+
13
+ # The user-provided name of the database home.
14
+ # @return [String]
15
+ attr_accessor :display_name
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ # rubocop:disable Style/SymbolLiteral
21
+ 'database': :'database',
22
+ 'display_name': :'displayName'
23
+ # rubocop:enable Style/SymbolLiteral
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ # rubocop:disable Style/SymbolLiteral
31
+ 'database': :'OCI::Database::Models::CreateDatabaseFromBackupDetails',
32
+ 'display_name': :'String'
33
+ # rubocop:enable Style/SymbolLiteral
34
+ }
35
+ end
36
+
37
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
38
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
39
+
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ # @option attributes [OCI::Database::Models::CreateDatabaseFromBackupDetails] :database The value to assign to the {#database} property
44
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
50
+
51
+ self.database = attributes[:'database'] if attributes[:'database']
52
+
53
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
54
+
55
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
56
+
57
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
58
+ end
59
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
60
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
61
+
62
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
63
+
64
+
65
+ # Checks equality by comparing each attribute.
66
+ # @param [Object] other the other object to be compared
67
+ def ==(other)
68
+ return true if equal?(other)
69
+ self.class == other.class &&
70
+ database == other.database &&
71
+ display_name == other.display_name
72
+ end
73
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
74
+
75
+ # @see the `==` method
76
+ # @param [Object] other the other object to be compared
77
+ def eql?(other)
78
+ self == other
79
+ end
80
+
81
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
82
+
83
+
84
+ # Calculates hash code according to all attributes.
85
+ # @return [Fixnum] Hash code
86
+ def hash
87
+ [database, display_name].hash
88
+ end
89
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
90
+
91
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
92
+
93
+
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def build_from_hash(attributes)
98
+ return nil unless attributes.is_a?(Hash)
99
+ self.class.swagger_types.each_pair do |key, type|
100
+ if type =~ /^Array<(.*)>/i
101
+ # check to ensure the input is an array given that the the attribute
102
+ # is documented as an array but the input is not
103
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
104
+ public_method("#{key}=").call(
105
+ attributes[self.class.attribute_map[key]]
106
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
107
+ )
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ public_method("#{key}=").call(
111
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
112
+ )
113
+ end
114
+ # or else data not found in attributes(hash), not an issue as the data can be optional
115
+ end
116
+
117
+ self
118
+ end
119
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
120
+
121
+ # Returns the string representation of the object
122
+ # @return [String] String presentation of the object
123
+ def to_s
124
+ to_hash.to_s
125
+ end
126
+
127
+ # Returns the object in the form of hash
128
+ # @return [Hash] Returns the object in the form of hash
129
+ def to_hash
130
+ hash = {}
131
+ self.class.attribute_map.each_pair do |attr, param|
132
+ value = public_method(attr).call
133
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
134
+ hash[param] = _to_hash(value)
135
+ end
136
+ hash
137
+ end
138
+
139
+ private
140
+
141
+ # Outputs non-array value in the form of hash
142
+ # For object, use to_hash. Otherwise, just return the value
143
+ # @param [Object] value Any valid value
144
+ # @return [Hash] Returns the value in the form of hash
145
+ def _to_hash(value)
146
+ if value.is_a?(Array)
147
+ value.compact.map { |v| _to_hash(v) }
148
+ elsif value.is_a?(Hash)
149
+ {}.tap do |hash|
150
+ value.each { |k, v| hash[k] = _to_hash(v) }
151
+ end
152
+ elsif value.respond_to? :to_hash
153
+ value.to_hash
154
+ else
155
+ value
156
+ end
157
+ end
158
+ end
159
+ end
160
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,438 @@
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
+ # LaunchDbSystemBase model.
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 Database::Models::LaunchDbSystemBase # rubocop:disable Metrics/LineLength
10
+ SOURCE_ENUM = [
11
+ SOURCE_NONE = 'NONE'.freeze,
12
+ SOURCE_DB_BACKUP = 'DB_BACKUP'.freeze
13
+ ].freeze
14
+
15
+ # **[Required]** The Availability Domain where the DB System is located.
16
+ # @return [String]
17
+ attr_accessor :availability_domain
18
+
19
+ # The OCID of the backup network subnet the DB System is associated with. Applicable only to Exadata.
20
+ #
21
+ # **Subnet Restrictions:** See above subnetId's **Subnet Restriction**.
22
+ #
23
+ # @return [String]
24
+ attr_accessor :backup_subnet_id
25
+
26
+ # Cluster name for Exadata and 2-node RAC DB Systems. The cluster name must begin with an an alphabetic character, and may contain hyphens (-). Underscores (_) are not permitted. The cluster name can be no longer than 11 characters and is not case sensitive.
27
+ #
28
+ # @return [String]
29
+ attr_accessor :cluster_name
30
+
31
+ # **[Required]** The Oracle Cloud ID (OCID) of the compartment the DB System belongs in.
32
+ # @return [String]
33
+ attr_accessor :compartment_id
34
+
35
+ # **[Required]** The number of CPU cores to enable. The valid values depend on the specified shape:
36
+ #
37
+ # - BM.DenseIO1.36 and BM.HighIO1.36 - Specify a multiple of 2, from 2 to 36.
38
+ # - BM.RACLocalStorage1.72 - Specify a multiple of 4, from 4 to 72.
39
+ # - Exadata.Quarter1.84 - Specify a multiple of 2, from 22 to 84.
40
+ # - Exadata.Half1.168 - Specify a multiple of 4, from 44 to 168.
41
+ # - Exadata.Full1.336 - Specify a multiple of 8, from 88 to 336.
42
+ #
43
+ # For VM DB systems, the core count is inferred from the specific VM shape chosen, so this parameter is not used.
44
+ #
45
+ # @return [Integer]
46
+ attr_accessor :cpu_core_count
47
+
48
+ # The percentage assigned to DATA storage (user data and database files).
49
+ # The remaining percentage is assigned to RECO storage (database redo logs, archive logs, and recovery manager backups).
50
+ # Specify 80 or 40. The default is 80 percent assigned to DATA storage. This is not applicable for VM based DB systems.
51
+ #
52
+ # @return [Integer]
53
+ attr_accessor :data_storage_percentage
54
+
55
+ # Defined tags for this resource. Each key is predefined and scoped to a namespace.
56
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
57
+ #
58
+ # Example: `{\"Operations\": {\"CostCenter\": \"42\"}}`
59
+ #
60
+ # @return [Hash<String, Hash<String, Object>>]
61
+ attr_accessor :defined_tags
62
+
63
+ # The user-friendly name for the DB System. It does not have to be unique.
64
+ # @return [String]
65
+ attr_accessor :display_name
66
+
67
+ # A domain name used for the DB System. If the Oracle-provided Internet and VCN
68
+ # Resolver is enabled for the specified subnet, the domain name for the subnet is used
69
+ # (don't provide one). Otherwise, provide a valid DNS domain name. Hyphens (-) are not permitted.
70
+ #
71
+ # @return [String]
72
+ attr_accessor :domain
73
+
74
+ # Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
75
+ # For more information, see [Resource Tags](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
76
+ #
77
+ # Example: `{\"Department\": \"Finance\"}`
78
+ #
79
+ # @return [Hash<String, String>]
80
+ attr_accessor :freeform_tags
81
+
82
+ # **[Required]** The host name for the DB System. The host name must begin with an alphabetic character and
83
+ # can contain a maximum of 30 alphanumeric characters, including hyphens (-).
84
+ #
85
+ # The maximum length of the combined hostname and domain is 63 characters.
86
+ #
87
+ # **Note:** The hostname must be unique within the subnet. If it is not unique,
88
+ # the DB System will fail to provision.
89
+ #
90
+ # @return [String]
91
+ attr_accessor :hostname
92
+
93
+ # Size, in GBs, of the initial data volume that will be created and attached to VM-shape based DB system. This storage can later be scaled up if needed. Note that the total storage size attached will be more than what is requested, to account for REDO/RECO space and software volume.
94
+ #
95
+ # @return [Integer]
96
+ attr_accessor :initial_data_storage_size_in_gb
97
+
98
+ # Number of nodes to launch for a VM-shape based RAC DB system.
99
+ #
100
+ # @return [Integer]
101
+ attr_accessor :node_count
102
+
103
+ # **[Required]** The shape of the DB System. The shape determines resources allocated to the DB System - CPU cores and memory for VM shapes; CPU cores, memory and storage for non-VM (or bare metal) shapes. To get a list of shapes, use the {#list_db_system_shapes list_db_system_shapes} operation.
104
+ # @return [String]
105
+ attr_accessor :shape
106
+
107
+ # Source of database:
108
+ # NONE for creating a new database
109
+ # DB_BACKUP for creating a new database by restoring a backup
110
+ #
111
+ # @return [String]
112
+ attr_reader :source
113
+
114
+ # **[Required]** The public key portion of the key pair to use for SSH access to the DB System. Multiple public keys can be provided. The length of the combined keys cannot exceed 10,000 characters.
115
+ # @return [Array<String>]
116
+ attr_accessor :ssh_public_keys
117
+
118
+ # **[Required]** The OCID of the subnet the DB System is associated with.
119
+ #
120
+ # **Subnet Restrictions:**
121
+ # - For single node and 2-node (RAC) DB Systems, do not use a subnet that overlaps with 192.168.16.16/28
122
+ # - For Exadata and VM-based RAC DB Systems, do not use a subnet that overlaps with 192.168.128.0/20
123
+ #
124
+ # These subnets are used by the Oracle Clusterware private interconnect on the database instance.
125
+ # Specifying an overlapping subnet will cause the private interconnect to malfunction.
126
+ # This restriction applies to both the client subnet and backup subnet.
127
+ #
128
+ # @return [String]
129
+ attr_accessor :subnet_id
130
+
131
+ # Attribute mapping from ruby-style variable name to JSON key.
132
+ def self.attribute_map
133
+ {
134
+ # rubocop:disable Style/SymbolLiteral
135
+ 'availability_domain': :'availabilityDomain',
136
+ 'backup_subnet_id': :'backupSubnetId',
137
+ 'cluster_name': :'clusterName',
138
+ 'compartment_id': :'compartmentId',
139
+ 'cpu_core_count': :'cpuCoreCount',
140
+ 'data_storage_percentage': :'dataStoragePercentage',
141
+ 'defined_tags': :'definedTags',
142
+ 'display_name': :'displayName',
143
+ 'domain': :'domain',
144
+ 'freeform_tags': :'freeformTags',
145
+ 'hostname': :'hostname',
146
+ 'initial_data_storage_size_in_gb': :'initialDataStorageSizeInGB',
147
+ 'node_count': :'nodeCount',
148
+ 'shape': :'shape',
149
+ 'source': :'source',
150
+ 'ssh_public_keys': :'sshPublicKeys',
151
+ 'subnet_id': :'subnetId'
152
+ # rubocop:enable Style/SymbolLiteral
153
+ }
154
+ end
155
+
156
+ # Attribute type mapping.
157
+ def self.swagger_types
158
+ {
159
+ # rubocop:disable Style/SymbolLiteral
160
+ 'availability_domain': :'String',
161
+ 'backup_subnet_id': :'String',
162
+ 'cluster_name': :'String',
163
+ 'compartment_id': :'String',
164
+ 'cpu_core_count': :'Integer',
165
+ 'data_storage_percentage': :'Integer',
166
+ 'defined_tags': :'Hash<String, Hash<String, Object>>',
167
+ 'display_name': :'String',
168
+ 'domain': :'String',
169
+ 'freeform_tags': :'Hash<String, String>',
170
+ 'hostname': :'String',
171
+ 'initial_data_storage_size_in_gb': :'Integer',
172
+ 'node_count': :'Integer',
173
+ 'shape': :'String',
174
+ 'source': :'String',
175
+ 'ssh_public_keys': :'Array<String>',
176
+ 'subnet_id': :'String'
177
+ # rubocop:enable Style/SymbolLiteral
178
+ }
179
+ end
180
+
181
+ # rubocop:disable Metrics/CyclomaticComplexity, Layout/EmptyLines
182
+
183
+
184
+ # Given the hash representation of a subtype of this class,
185
+ # use the info in the hash to return the class of the subtype.
186
+ def self.get_subtype(object_hash)
187
+ type = object_hash[:'source'] # rubocop:disable Style/SymbolLiteral
188
+
189
+ return 'OCI::Database::Models::LaunchDbSystemDetails' if type == 'NONE'
190
+ return 'OCI::Database::Models::LaunchDbSystemFromBackupDetails' if type == 'DB_BACKUP'
191
+
192
+ # TODO: Log a warning when the subtype is not found.
193
+ 'OCI::Database::Models::LaunchDbSystemBase'
194
+ end
195
+ # rubocop:enable Metrics/CyclomaticComplexity, Layout/EmptyLines
196
+
197
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
198
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
199
+
200
+
201
+ # Initializes the object
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @option attributes [String] :availability_domain The value to assign to the {#availability_domain} property
204
+ # @option attributes [String] :backup_subnet_id The value to assign to the {#backup_subnet_id} property
205
+ # @option attributes [String] :cluster_name The value to assign to the {#cluster_name} property
206
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
207
+ # @option attributes [Integer] :cpu_core_count The value to assign to the {#cpu_core_count} property
208
+ # @option attributes [Integer] :data_storage_percentage The value to assign to the {#data_storage_percentage} property
209
+ # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
210
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
211
+ # @option attributes [String] :domain The value to assign to the {#domain} property
212
+ # @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property
213
+ # @option attributes [String] :hostname The value to assign to the {#hostname} property
214
+ # @option attributes [Integer] :initial_data_storage_size_in_gb The value to assign to the {#initial_data_storage_size_in_gb} property
215
+ # @option attributes [Integer] :node_count The value to assign to the {#node_count} property
216
+ # @option attributes [String] :shape The value to assign to the {#shape} property
217
+ # @option attributes [String] :source The value to assign to the {#source} property
218
+ # @option attributes [Array<String>] :ssh_public_keys The value to assign to the {#ssh_public_keys} property
219
+ # @option attributes [String] :subnet_id The value to assign to the {#subnet_id} property
220
+ def initialize(attributes = {})
221
+ return unless attributes.is_a?(Hash)
222
+
223
+ # convert string to symbol for hash key
224
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
225
+
226
+ self.availability_domain = attributes[:'availabilityDomain'] if attributes[:'availabilityDomain']
227
+
228
+ raise 'You cannot provide both :availabilityDomain and :availability_domain' if attributes.key?(:'availabilityDomain') && attributes.key?(:'availability_domain')
229
+
230
+ self.availability_domain = attributes[:'availability_domain'] if attributes[:'availability_domain']
231
+
232
+ self.backup_subnet_id = attributes[:'backupSubnetId'] if attributes[:'backupSubnetId']
233
+
234
+ raise 'You cannot provide both :backupSubnetId and :backup_subnet_id' if attributes.key?(:'backupSubnetId') && attributes.key?(:'backup_subnet_id')
235
+
236
+ self.backup_subnet_id = attributes[:'backup_subnet_id'] if attributes[:'backup_subnet_id']
237
+
238
+ self.cluster_name = attributes[:'clusterName'] if attributes[:'clusterName']
239
+
240
+ raise 'You cannot provide both :clusterName and :cluster_name' if attributes.key?(:'clusterName') && attributes.key?(:'cluster_name')
241
+
242
+ self.cluster_name = attributes[:'cluster_name'] if attributes[:'cluster_name']
243
+
244
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
245
+
246
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
247
+
248
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
249
+
250
+ self.cpu_core_count = attributes[:'cpuCoreCount'] if attributes[:'cpuCoreCount']
251
+
252
+ raise 'You cannot provide both :cpuCoreCount and :cpu_core_count' if attributes.key?(:'cpuCoreCount') && attributes.key?(:'cpu_core_count')
253
+
254
+ self.cpu_core_count = attributes[:'cpu_core_count'] if attributes[:'cpu_core_count']
255
+
256
+ self.data_storage_percentage = attributes[:'dataStoragePercentage'] if attributes[:'dataStoragePercentage']
257
+
258
+ raise 'You cannot provide both :dataStoragePercentage and :data_storage_percentage' if attributes.key?(:'dataStoragePercentage') && attributes.key?(:'data_storage_percentage')
259
+
260
+ self.data_storage_percentage = attributes[:'data_storage_percentage'] if attributes[:'data_storage_percentage']
261
+
262
+ self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags']
263
+
264
+ raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags')
265
+
266
+ self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags']
267
+
268
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
269
+
270
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
271
+
272
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
273
+
274
+ self.domain = attributes[:'domain'] if attributes[:'domain']
275
+
276
+ self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags']
277
+
278
+ raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags')
279
+
280
+ self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags']
281
+
282
+ self.hostname = attributes[:'hostname'] if attributes[:'hostname']
283
+
284
+ self.initial_data_storage_size_in_gb = attributes[:'initialDataStorageSizeInGB'] if attributes[:'initialDataStorageSizeInGB']
285
+
286
+ raise 'You cannot provide both :initialDataStorageSizeInGB and :initial_data_storage_size_in_gb' if attributes.key?(:'initialDataStorageSizeInGB') && attributes.key?(:'initial_data_storage_size_in_gb')
287
+
288
+ self.initial_data_storage_size_in_gb = attributes[:'initial_data_storage_size_in_gb'] if attributes[:'initial_data_storage_size_in_gb']
289
+
290
+ self.node_count = attributes[:'nodeCount'] if attributes[:'nodeCount']
291
+
292
+ raise 'You cannot provide both :nodeCount and :node_count' if attributes.key?(:'nodeCount') && attributes.key?(:'node_count')
293
+
294
+ self.node_count = attributes[:'node_count'] if attributes[:'node_count']
295
+
296
+ self.shape = attributes[:'shape'] if attributes[:'shape']
297
+
298
+ self.source = attributes[:'source'] if attributes[:'source']
299
+ self.source = "NONE" if source.nil? && !attributes.key?(:'source') # rubocop:disable Style/StringLiterals
300
+
301
+ self.ssh_public_keys = attributes[:'sshPublicKeys'] if attributes[:'sshPublicKeys']
302
+
303
+ raise 'You cannot provide both :sshPublicKeys and :ssh_public_keys' if attributes.key?(:'sshPublicKeys') && attributes.key?(:'ssh_public_keys')
304
+
305
+ self.ssh_public_keys = attributes[:'ssh_public_keys'] if attributes[:'ssh_public_keys']
306
+
307
+ self.subnet_id = attributes[:'subnetId'] if attributes[:'subnetId']
308
+
309
+ raise 'You cannot provide both :subnetId and :subnet_id' if attributes.key?(:'subnetId') && attributes.key?(:'subnet_id')
310
+
311
+ self.subnet_id = attributes[:'subnet_id'] if attributes[:'subnet_id']
312
+ end
313
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
314
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
315
+
316
+ # Custom attribute writer method checking allowed values (enum).
317
+ # @param [Object] source Object to be assigned
318
+ def source=(source)
319
+ # rubocop: disable Metrics/LineLength
320
+ raise "Invalid value for 'source': this must be one of the values in SOURCE_ENUM." if source && !SOURCE_ENUM.include?(source)
321
+ # rubocop: enable Metrics/LineLength
322
+ @source = source
323
+ end
324
+
325
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
326
+
327
+
328
+ # Checks equality by comparing each attribute.
329
+ # @param [Object] other the other object to be compared
330
+ def ==(other)
331
+ return true if equal?(other)
332
+ self.class == other.class &&
333
+ availability_domain == other.availability_domain &&
334
+ backup_subnet_id == other.backup_subnet_id &&
335
+ cluster_name == other.cluster_name &&
336
+ compartment_id == other.compartment_id &&
337
+ cpu_core_count == other.cpu_core_count &&
338
+ data_storage_percentage == other.data_storage_percentage &&
339
+ defined_tags == other.defined_tags &&
340
+ display_name == other.display_name &&
341
+ domain == other.domain &&
342
+ freeform_tags == other.freeform_tags &&
343
+ hostname == other.hostname &&
344
+ initial_data_storage_size_in_gb == other.initial_data_storage_size_in_gb &&
345
+ node_count == other.node_count &&
346
+ shape == other.shape &&
347
+ source == other.source &&
348
+ ssh_public_keys == other.ssh_public_keys &&
349
+ subnet_id == other.subnet_id
350
+ end
351
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
352
+
353
+ # @see the `==` method
354
+ # @param [Object] other the other object to be compared
355
+ def eql?(other)
356
+ self == other
357
+ end
358
+
359
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
360
+
361
+
362
+ # Calculates hash code according to all attributes.
363
+ # @return [Fixnum] Hash code
364
+ def hash
365
+ [availability_domain, backup_subnet_id, cluster_name, compartment_id, cpu_core_count, data_storage_percentage, defined_tags, display_name, domain, freeform_tags, hostname, initial_data_storage_size_in_gb, node_count, shape, source, ssh_public_keys, subnet_id].hash
366
+ end
367
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
368
+
369
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
370
+
371
+
372
+ # Builds the object from hash
373
+ # @param [Hash] attributes Model attributes in the form of hash
374
+ # @return [Object] Returns the model itself
375
+ def build_from_hash(attributes)
376
+ return nil unless attributes.is_a?(Hash)
377
+ self.class.swagger_types.each_pair do |key, type|
378
+ if type =~ /^Array<(.*)>/i
379
+ # check to ensure the input is an array given that the the attribute
380
+ # is documented as an array but the input is not
381
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
382
+ public_method("#{key}=").call(
383
+ attributes[self.class.attribute_map[key]]
384
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
385
+ )
386
+ end
387
+ elsif !attributes[self.class.attribute_map[key]].nil?
388
+ public_method("#{key}=").call(
389
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
390
+ )
391
+ end
392
+ # or else data not found in attributes(hash), not an issue as the data can be optional
393
+ end
394
+
395
+ self
396
+ end
397
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
398
+
399
+ # Returns the string representation of the object
400
+ # @return [String] String presentation of the object
401
+ def to_s
402
+ to_hash.to_s
403
+ end
404
+
405
+ # Returns the object in the form of hash
406
+ # @return [Hash] Returns the object in the form of hash
407
+ def to_hash
408
+ hash = {}
409
+ self.class.attribute_map.each_pair do |attr, param|
410
+ value = public_method(attr).call
411
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
412
+ hash[param] = _to_hash(value)
413
+ end
414
+ hash
415
+ end
416
+
417
+ private
418
+
419
+ # Outputs non-array value in the form of hash
420
+ # For object, use to_hash. Otherwise, just return the value
421
+ # @param [Object] value Any valid value
422
+ # @return [Hash] Returns the value in the form of hash
423
+ def _to_hash(value)
424
+ if value.is_a?(Array)
425
+ value.compact.map { |v| _to_hash(v) }
426
+ elsif value.is_a?(Hash)
427
+ {}.tap do |hash|
428
+ value.each { |k, v| hash[k] = _to_hash(v) }
429
+ end
430
+ elsif value.respond_to? :to_hash
431
+ value.to_hash
432
+ else
433
+ value
434
+ end
435
+ end
436
+ end
437
+ end
438
+ # rubocop:enable Lint/UnneededCopDisableDirective