oci 2.3.4 → 2.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/oci/core/models/create_virtual_circuit_public_prefix_details.rb +1 -1
  4. data/lib/oci/core/models/update_boot_volume_details.rb +18 -4
  5. data/lib/oci/core/models/update_volume_details.rb +18 -4
  6. data/lib/oci/core/models/virtual_circuit.rb +1 -1
  7. data/lib/oci/core/models/vnic.rb +1 -1
  8. data/lib/oci/core/models/volume_group.rb +18 -4
  9. data/lib/oci/database/database.rb +18 -0
  10. data/lib/oci/database/database_client.rb +1779 -427
  11. data/lib/oci/database/database_client_composite_operations.rb +316 -0
  12. data/lib/oci/database/models/autonomous_data_warehouse.rb +391 -0
  13. data/lib/oci/database/models/autonomous_data_warehouse_backup.rb +316 -0
  14. data/lib/oci/database/models/autonomous_data_warehouse_backup_summary.rb +316 -0
  15. data/lib/oci/database/models/autonomous_data_warehouse_connection_strings.rb +167 -0
  16. data/lib/oci/database/models/autonomous_data_warehouse_summary.rb +391 -0
  17. data/lib/oci/database/models/autonomous_database.rb +391 -0
  18. data/lib/oci/database/models/autonomous_database_backup.rb +316 -0
  19. data/lib/oci/database/models/autonomous_database_backup_summary.rb +316 -0
  20. data/lib/oci/database/models/autonomous_database_connection_strings.rb +167 -0
  21. data/lib/oci/database/models/autonomous_database_summary.rb +391 -0
  22. data/lib/oci/database/models/create_autonomous_data_warehouse_backup_details.rb +165 -0
  23. data/lib/oci/database/models/create_autonomous_data_warehouse_details.rb +287 -0
  24. data/lib/oci/database/models/create_autonomous_database_backup_details.rb +165 -0
  25. data/lib/oci/database/models/create_autonomous_database_details.rb +287 -0
  26. data/lib/oci/database/models/db_system.rb +1 -1
  27. data/lib/oci/database/models/db_system_summary.rb +1 -1
  28. data/lib/oci/database/models/launch_db_system_details.rb +1 -1
  29. data/lib/oci/database/models/launch_db_system_from_backup_details.rb +1 -1
  30. data/lib/oci/database/models/restore_autonomous_data_warehouse_details.rb +147 -0
  31. data/lib/oci/database/models/restore_autonomous_database_details.rb +147 -0
  32. data/lib/oci/database/models/update_autonomous_data_warehouse_details.rb +230 -0
  33. data/lib/oci/database/models/update_autonomous_database_details.rb +230 -0
  34. data/lib/oci/identity/identity.rb +1 -0
  35. data/lib/oci/identity/identity_client.rb +64 -1
  36. data/lib/oci/identity/models/availability_domain.rb +11 -1
  37. data/lib/oci/identity/models/fault_domain.rb +187 -0
  38. data/lib/oci/version.rb +1 -1
  39. metadata +21 -2
@@ -0,0 +1,316 @@
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
+ # An Autonomous Database backup.
9
+ # To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
10
+ #
11
+ class Database::Models::AutonomousDatabaseBackupSummary # rubocop:disable Metrics/LineLength
12
+ LIFECYCLE_STATE_ENUM = [
13
+ LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
14
+ LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
15
+ LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
16
+ LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
17
+ LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
18
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
19
+ ].freeze
20
+
21
+ TYPE_ENUM = [
22
+ TYPE_INCREMENTAL = 'INCREMENTAL'.freeze,
23
+ TYPE_FULL = 'FULL'.freeze,
24
+ TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
25
+ ].freeze
26
+
27
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the Autonomous Database.
28
+ # @return [String]
29
+ attr_accessor :autonomous_database_id
30
+
31
+ # **[Required]** The OCID of the compartment.
32
+ # @return [String]
33
+ attr_accessor :compartment_id
34
+
35
+ # **[Required]** The user-friendly name for the backup. The name does not have to be unique.
36
+ # @return [String]
37
+ attr_accessor :display_name
38
+
39
+ # **[Required]** The [OCID](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm) of the Autonomous Database backup.
40
+ # @return [String]
41
+ attr_accessor :id
42
+
43
+ # **[Required]** Indicates whether the backup is user-initiated or automatic.
44
+ # @return [BOOLEAN]
45
+ attr_accessor :is_automatic
46
+
47
+ # Additional information about the current lifecycle state.
48
+ # @return [String]
49
+ attr_accessor :lifecycle_details
50
+
51
+ # **[Required]** The current state of the backup.
52
+ # @return [String]
53
+ attr_reader :lifecycle_state
54
+
55
+ # The date and time the backup completed.
56
+ # @return [DateTime]
57
+ attr_accessor :time_ended
58
+
59
+ # The date and time the backup started.
60
+ # @return [DateTime]
61
+ attr_accessor :time_started
62
+
63
+ # **[Required]** The type of backup.
64
+ # @return [String]
65
+ attr_reader :type
66
+
67
+ # Attribute mapping from ruby-style variable name to JSON key.
68
+ def self.attribute_map
69
+ {
70
+ # rubocop:disable Style/SymbolLiteral
71
+ 'autonomous_database_id': :'autonomousDatabaseId',
72
+ 'compartment_id': :'compartmentId',
73
+ 'display_name': :'displayName',
74
+ 'id': :'id',
75
+ 'is_automatic': :'isAutomatic',
76
+ 'lifecycle_details': :'lifecycleDetails',
77
+ 'lifecycle_state': :'lifecycleState',
78
+ 'time_ended': :'timeEnded',
79
+ 'time_started': :'timeStarted',
80
+ 'type': :'type'
81
+ # rubocop:enable Style/SymbolLiteral
82
+ }
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.swagger_types
87
+ {
88
+ # rubocop:disable Style/SymbolLiteral
89
+ 'autonomous_database_id': :'String',
90
+ 'compartment_id': :'String',
91
+ 'display_name': :'String',
92
+ 'id': :'String',
93
+ 'is_automatic': :'BOOLEAN',
94
+ 'lifecycle_details': :'String',
95
+ 'lifecycle_state': :'String',
96
+ 'time_ended': :'DateTime',
97
+ 'time_started': :'DateTime',
98
+ 'type': :'String'
99
+ # rubocop:enable Style/SymbolLiteral
100
+ }
101
+ end
102
+
103
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
104
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
105
+
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @option attributes [String] :autonomous_database_id The value to assign to the {#autonomous_database_id} property
110
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
111
+ # @option attributes [String] :display_name The value to assign to the {#display_name} property
112
+ # @option attributes [String] :id The value to assign to the {#id} property
113
+ # @option attributes [BOOLEAN] :is_automatic The value to assign to the {#is_automatic} property
114
+ # @option attributes [String] :lifecycle_details The value to assign to the {#lifecycle_details} property
115
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
116
+ # @option attributes [DateTime] :time_ended The value to assign to the {#time_ended} property
117
+ # @option attributes [DateTime] :time_started The value to assign to the {#time_started} property
118
+ # @option attributes [String] :type The value to assign to the {#type} property
119
+ def initialize(attributes = {})
120
+ return unless attributes.is_a?(Hash)
121
+
122
+ # convert string to symbol for hash key
123
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
124
+
125
+ self.autonomous_database_id = attributes[:'autonomousDatabaseId'] if attributes[:'autonomousDatabaseId']
126
+
127
+ raise 'You cannot provide both :autonomousDatabaseId and :autonomous_database_id' if attributes.key?(:'autonomousDatabaseId') && attributes.key?(:'autonomous_database_id')
128
+
129
+ self.autonomous_database_id = attributes[:'autonomous_database_id'] if attributes[:'autonomous_database_id']
130
+
131
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
132
+
133
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
134
+
135
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
136
+
137
+ self.display_name = attributes[:'displayName'] if attributes[:'displayName']
138
+
139
+ raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name')
140
+
141
+ self.display_name = attributes[:'display_name'] if attributes[:'display_name']
142
+
143
+ self.id = attributes[:'id'] if attributes[:'id']
144
+
145
+ self.is_automatic = attributes[:'isAutomatic'] unless attributes[:'isAutomatic'].nil?
146
+
147
+ raise 'You cannot provide both :isAutomatic and :is_automatic' if attributes.key?(:'isAutomatic') && attributes.key?(:'is_automatic')
148
+
149
+ self.is_automatic = attributes[:'is_automatic'] unless attributes[:'is_automatic'].nil?
150
+
151
+ self.lifecycle_details = attributes[:'lifecycleDetails'] if attributes[:'lifecycleDetails']
152
+
153
+ raise 'You cannot provide both :lifecycleDetails and :lifecycle_details' if attributes.key?(:'lifecycleDetails') && attributes.key?(:'lifecycle_details')
154
+
155
+ self.lifecycle_details = attributes[:'lifecycle_details'] if attributes[:'lifecycle_details']
156
+
157
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
158
+
159
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
160
+
161
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
162
+
163
+ self.time_ended = attributes[:'timeEnded'] if attributes[:'timeEnded']
164
+
165
+ raise 'You cannot provide both :timeEnded and :time_ended' if attributes.key?(:'timeEnded') && attributes.key?(:'time_ended')
166
+
167
+ self.time_ended = attributes[:'time_ended'] if attributes[:'time_ended']
168
+
169
+ self.time_started = attributes[:'timeStarted'] if attributes[:'timeStarted']
170
+
171
+ raise 'You cannot provide both :timeStarted and :time_started' if attributes.key?(:'timeStarted') && attributes.key?(:'time_started')
172
+
173
+ self.time_started = attributes[:'time_started'] if attributes[:'time_started']
174
+
175
+ self.type = attributes[:'type'] if attributes[:'type']
176
+ end
177
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
178
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
179
+
180
+ # Custom attribute writer method checking allowed values (enum).
181
+ # @param [Object] lifecycle_state Object to be assigned
182
+ def lifecycle_state=(lifecycle_state)
183
+ # rubocop:disable Style/ConditionalAssignment
184
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
185
+ # rubocop: disable Metrics/LineLength
186
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
187
+ # rubocop: enable Metrics/LineLength
188
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
189
+ else
190
+ @lifecycle_state = lifecycle_state
191
+ end
192
+ # rubocop:enable Style/ConditionalAssignment
193
+ end
194
+
195
+ # Custom attribute writer method checking allowed values (enum).
196
+ # @param [Object] type Object to be assigned
197
+ def type=(type)
198
+ # rubocop:disable Style/ConditionalAssignment
199
+ if type && !TYPE_ENUM.include?(type)
200
+ # rubocop: disable Metrics/LineLength
201
+ OCI.logger.debug("Unknown value for 'type' [" + type + "]. Mapping to 'TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
202
+ # rubocop: enable Metrics/LineLength
203
+ @type = TYPE_UNKNOWN_ENUM_VALUE
204
+ else
205
+ @type = type
206
+ end
207
+ # rubocop:enable Style/ConditionalAssignment
208
+ end
209
+
210
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
211
+
212
+
213
+ # Checks equality by comparing each attribute.
214
+ # @param [Object] other the other object to be compared
215
+ def ==(other)
216
+ return true if equal?(other)
217
+ self.class == other.class &&
218
+ autonomous_database_id == other.autonomous_database_id &&
219
+ compartment_id == other.compartment_id &&
220
+ display_name == other.display_name &&
221
+ id == other.id &&
222
+ is_automatic == other.is_automatic &&
223
+ lifecycle_details == other.lifecycle_details &&
224
+ lifecycle_state == other.lifecycle_state &&
225
+ time_ended == other.time_ended &&
226
+ time_started == other.time_started &&
227
+ type == other.type
228
+ end
229
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
230
+
231
+ # @see the `==` method
232
+ # @param [Object] other the other object to be compared
233
+ def eql?(other)
234
+ self == other
235
+ end
236
+
237
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
238
+
239
+
240
+ # Calculates hash code according to all attributes.
241
+ # @return [Fixnum] Hash code
242
+ def hash
243
+ [autonomous_database_id, compartment_id, display_name, id, is_automatic, lifecycle_details, lifecycle_state, time_ended, time_started, type].hash
244
+ end
245
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
246
+
247
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
248
+
249
+
250
+ # Builds the object from hash
251
+ # @param [Hash] attributes Model attributes in the form of hash
252
+ # @return [Object] Returns the model itself
253
+ def build_from_hash(attributes)
254
+ return nil unless attributes.is_a?(Hash)
255
+ self.class.swagger_types.each_pair do |key, type|
256
+ if type =~ /^Array<(.*)>/i
257
+ # check to ensure the input is an array given that the the attribute
258
+ # is documented as an array but the input is not
259
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
260
+ public_method("#{key}=").call(
261
+ attributes[self.class.attribute_map[key]]
262
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
263
+ )
264
+ end
265
+ elsif !attributes[self.class.attribute_map[key]].nil?
266
+ public_method("#{key}=").call(
267
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
268
+ )
269
+ end
270
+ # or else data not found in attributes(hash), not an issue as the data can be optional
271
+ end
272
+
273
+ self
274
+ end
275
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
276
+
277
+ # Returns the string representation of the object
278
+ # @return [String] String presentation of the object
279
+ def to_s
280
+ to_hash.to_s
281
+ end
282
+
283
+ # Returns the object in the form of hash
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_hash
286
+ hash = {}
287
+ self.class.attribute_map.each_pair do |attr, param|
288
+ value = public_method(attr).call
289
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ private
296
+
297
+ # Outputs non-array value in the form of hash
298
+ # For object, use to_hash. Otherwise, just return the value
299
+ # @param [Object] value Any valid value
300
+ # @return [Hash] Returns the value in the form of hash
301
+ def _to_hash(value)
302
+ if value.is_a?(Array)
303
+ value.compact.map { |v| _to_hash(v) }
304
+ elsif value.is_a?(Hash)
305
+ {}.tap do |hash|
306
+ value.each { |k, v| hash[k] = _to_hash(v) }
307
+ end
308
+ elsif value.respond_to? :to_hash
309
+ value.to_hash
310
+ else
311
+ value
312
+ end
313
+ end
314
+ end
315
+ end
316
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,167 @@
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
+ # Connection strings to connect to an Oracle Autonomous Database.
8
+ #
9
+ class Database::Models::AutonomousDatabaseConnectionStrings # rubocop:disable Metrics/LineLength
10
+ # The High database service provides the highest level of resources to each SQL statement resulting in the highest performance, but supports the fewest number of concurrent SQL statements.
11
+ # @return [String]
12
+ attr_accessor :high
13
+
14
+ # The Low database service provides the least level of resources to each SQL statement, but supports the most number of concurrent SQL statements.
15
+ # @return [String]
16
+ attr_accessor :low
17
+
18
+ # The Medium database service provides a lower level of resources to each SQL statement potentially resulting a lower level of performance, but supports more concurrent SQL statements.
19
+ # @return [String]
20
+ attr_accessor :medium
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ # rubocop:disable Style/SymbolLiteral
26
+ 'high': :'high',
27
+ 'low': :'low',
28
+ 'medium': :'medium'
29
+ # rubocop:enable Style/SymbolLiteral
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ # rubocop:disable Style/SymbolLiteral
37
+ 'high': :'String',
38
+ 'low': :'String',
39
+ 'medium': :'String'
40
+ # rubocop:enable Style/SymbolLiteral
41
+ }
42
+ end
43
+
44
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
45
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
46
+
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ # @option attributes [String] :high The value to assign to the {#high} property
51
+ # @option attributes [String] :low The value to assign to the {#low} property
52
+ # @option attributes [String] :medium The value to assign to the {#medium} property
53
+ def initialize(attributes = {})
54
+ return unless attributes.is_a?(Hash)
55
+
56
+ # convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
58
+
59
+ self.high = attributes[:'high'] if attributes[:'high']
60
+
61
+ self.low = attributes[:'low'] if attributes[:'low']
62
+
63
+ self.medium = attributes[:'medium'] if attributes[:'medium']
64
+ end
65
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
66
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
67
+
68
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
69
+
70
+
71
+ # Checks equality by comparing each attribute.
72
+ # @param [Object] other the other object to be compared
73
+ def ==(other)
74
+ return true if equal?(other)
75
+ self.class == other.class &&
76
+ high == other.high &&
77
+ low == other.low &&
78
+ medium == other.medium
79
+ end
80
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
81
+
82
+ # @see the `==` method
83
+ # @param [Object] other the other object to be compared
84
+ def eql?(other)
85
+ self == other
86
+ end
87
+
88
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
89
+
90
+
91
+ # Calculates hash code according to all attributes.
92
+ # @return [Fixnum] Hash code
93
+ def hash
94
+ [high, low, medium].hash
95
+ end
96
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
97
+
98
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
99
+
100
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.swagger_types.each_pair do |key, type|
107
+ if type =~ /^Array<(.*)>/i
108
+ # check to ensure the input is an array given that the the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ public_method("#{key}=").call(
112
+ attributes[self.class.attribute_map[key]]
113
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
114
+ )
115
+ end
116
+ elsif !attributes[self.class.attribute_map[key]].nil?
117
+ public_method("#{key}=").call(
118
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
119
+ )
120
+ end
121
+ # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+
124
+ self
125
+ end
126
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
127
+
128
+ # Returns the string representation of the object
129
+ # @return [String] String presentation of the object
130
+ def to_s
131
+ to_hash.to_s
132
+ end
133
+
134
+ # Returns the object in the form of hash
135
+ # @return [Hash] Returns the object in the form of hash
136
+ def to_hash
137
+ hash = {}
138
+ self.class.attribute_map.each_pair do |attr, param|
139
+ value = public_method(attr).call
140
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
141
+ hash[param] = _to_hash(value)
142
+ end
143
+ hash
144
+ end
145
+
146
+ private
147
+
148
+ # Outputs non-array value in the form of hash
149
+ # For object, use to_hash. Otherwise, just return the value
150
+ # @param [Object] value Any valid value
151
+ # @return [Hash] Returns the value in the form of hash
152
+ def _to_hash(value)
153
+ if value.is_a?(Array)
154
+ value.compact.map { |v| _to_hash(v) }
155
+ elsif value.is_a?(Hash)
156
+ {}.tap do |hash|
157
+ value.each { |k, v| hash[k] = _to_hash(v) }
158
+ end
159
+ elsif value.respond_to? :to_hash
160
+ value.to_hash
161
+ else
162
+ value
163
+ end
164
+ end
165
+ end
166
+ end
167
+ # rubocop:enable Lint/UnneededCopDisableDirective