oci 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/oci.rb +1 -0
  4. data/lib/oci/audit/audit_client_composite_operations.rb +16 -6
  5. data/lib/oci/container_engine/container_engine.rb +47 -0
  6. data/lib/oci/container_engine/container_engine_client.rb +1276 -0
  7. data/lib/oci/container_engine/container_engine_client_composite_operations.rb +320 -0
  8. data/lib/oci/container_engine/models/add_on_options.rb +164 -0
  9. data/lib/oci/container_engine/models/cluster.rb +296 -0
  10. data/lib/oci/container_engine/models/cluster_create_options.rb +178 -0
  11. data/lib/oci/container_engine/models/cluster_endpoints.rb +146 -0
  12. data/lib/oci/container_engine/models/cluster_lifecycle_state.rb +14 -0
  13. data/lib/oci/container_engine/models/cluster_metadata.rb +262 -0
  14. data/lib/oci/container_engine/models/cluster_options.rb +150 -0
  15. data/lib/oci/container_engine/models/cluster_summary.rb +296 -0
  16. data/lib/oci/container_engine/models/create_cluster_details.rb +198 -0
  17. data/lib/oci/container_engine/models/create_cluster_kubeconfig_content_details.rb +162 -0
  18. data/lib/oci/container_engine/models/create_node_pool_details.rb +272 -0
  19. data/lib/oci/container_engine/models/key_value.rb +156 -0
  20. data/lib/oci/container_engine/models/kubernetes_network_config.rb +164 -0
  21. data/lib/oci/container_engine/models/node.rb +281 -0
  22. data/lib/oci/container_engine/models/node_error.rb +180 -0
  23. data/lib/oci/container_engine/models/node_pool.rb +306 -0
  24. data/lib/oci/container_engine/models/node_pool_options.rb +170 -0
  25. data/lib/oci/container_engine/models/node_pool_summary.rb +296 -0
  26. data/lib/oci/container_engine/models/sort_order.rb +10 -0
  27. data/lib/oci/container_engine/models/update_cluster_details.rb +160 -0
  28. data/lib/oci/container_engine/models/update_node_pool_details.rb +202 -0
  29. data/lib/oci/container_engine/models/work_request.rb +288 -0
  30. data/lib/oci/container_engine/models/work_request_error.rb +167 -0
  31. data/lib/oci/container_engine/models/work_request_log_entry.rb +156 -0
  32. data/lib/oci/container_engine/models/work_request_operation_type.rb +15 -0
  33. data/lib/oci/container_engine/models/work_request_resource.rb +214 -0
  34. data/lib/oci/container_engine/models/work_request_status.rb +14 -0
  35. data/lib/oci/container_engine/models/work_request_summary.rb +288 -0
  36. data/lib/oci/container_engine/util.rb +46 -0
  37. data/lib/oci/errors.rb +21 -2
  38. data/lib/oci/load_balancer/load_balancer_client_composite_operations.rb +336 -133
  39. data/lib/oci/load_balancer/util.rb +19 -32
  40. data/lib/oci/regions.rb +2 -1
  41. data/lib/oci/version.rb +1 -1
  42. data/lib/oci/waiter.rb +47 -0
  43. metadata +34 -2
@@ -0,0 +1,306 @@
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
+ # A pool of compute nodes attached to a cluster.
8
+ class ContainerEngine::Models::NodePool # rubocop:disable Metrics/LineLength
9
+ # The OCID of the node pool.
10
+ # @return [String]
11
+ attr_accessor :id
12
+
13
+ # The OCID of the compartment in which the node pool exists.
14
+ # @return [String]
15
+ attr_accessor :compartment_id
16
+
17
+ # The OCID of the cluster to which this node pool is attached.
18
+ # @return [String]
19
+ attr_accessor :cluster_id
20
+
21
+ # The name of the node pool.
22
+ # @return [String]
23
+ attr_accessor :name
24
+
25
+ # The version of Kubernetes running on the nodes in the node pool.
26
+ # @return [String]
27
+ attr_accessor :kubernetes_version
28
+
29
+ # The OCID of the image running on the nodes in the node pool.
30
+ # @return [String]
31
+ attr_accessor :node_image_id
32
+
33
+ # The name of the image running on the nodes in the node pool.
34
+ # @return [String]
35
+ attr_accessor :node_image_name
36
+
37
+ # The name of the node shape of the nodes in the node pool.
38
+ # @return [String]
39
+ attr_accessor :node_shape
40
+
41
+ # A list of key/value pairs to add to nodes after they join the Kubernetes cluster.
42
+ # @return [Array<OCI::ContainerEngine::Models::KeyValue>]
43
+ attr_accessor :initial_node_labels
44
+
45
+ # The SSH public key on each node in the node pool.
46
+ # @return [String]
47
+ attr_accessor :ssh_public_key
48
+
49
+ # The number of nodes in each subnet.
50
+ # @return [Integer]
51
+ attr_accessor :quantity_per_subnet
52
+
53
+ # The OCIDs of the subnets in which to place nodes for this node pool.
54
+ # @return [Array<String>]
55
+ attr_accessor :subnet_ids
56
+
57
+ # The nodes in the node pool.
58
+ # @return [Array<OCI::ContainerEngine::Models::Node>]
59
+ attr_accessor :nodes
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ # rubocop:disable Style/SymbolLiteral
65
+ 'id': :'id',
66
+ 'compartment_id': :'compartmentId',
67
+ 'cluster_id': :'clusterId',
68
+ 'name': :'name',
69
+ 'kubernetes_version': :'kubernetesVersion',
70
+ 'node_image_id': :'nodeImageId',
71
+ 'node_image_name': :'nodeImageName',
72
+ 'node_shape': :'nodeShape',
73
+ 'initial_node_labels': :'initialNodeLabels',
74
+ 'ssh_public_key': :'sshPublicKey',
75
+ 'quantity_per_subnet': :'quantityPerSubnet',
76
+ 'subnet_ids': :'subnetIds',
77
+ 'nodes': :'nodes'
78
+ # rubocop:enable Style/SymbolLiteral
79
+ }
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.swagger_types
84
+ {
85
+ # rubocop:disable Style/SymbolLiteral
86
+ 'id': :'String',
87
+ 'compartment_id': :'String',
88
+ 'cluster_id': :'String',
89
+ 'name': :'String',
90
+ 'kubernetes_version': :'String',
91
+ 'node_image_id': :'String',
92
+ 'node_image_name': :'String',
93
+ 'node_shape': :'String',
94
+ 'initial_node_labels': :'Array<OCI::ContainerEngine::Models::KeyValue>',
95
+ 'ssh_public_key': :'String',
96
+ 'quantity_per_subnet': :'Integer',
97
+ 'subnet_ids': :'Array<String>',
98
+ 'nodes': :'Array<OCI::ContainerEngine::Models::Node>'
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] :id The value to assign to the {#id} property
110
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
111
+ # @option attributes [String] :cluster_id The value to assign to the {#cluster_id} property
112
+ # @option attributes [String] :name The value to assign to the {#name} property
113
+ # @option attributes [String] :kubernetes_version The value to assign to the {#kubernetes_version} property
114
+ # @option attributes [String] :node_image_id The value to assign to the {#node_image_id} property
115
+ # @option attributes [String] :node_image_name The value to assign to the {#node_image_name} property
116
+ # @option attributes [String] :node_shape The value to assign to the {#node_shape} property
117
+ # @option attributes [Array<OCI::ContainerEngine::Models::KeyValue>] :initial_node_labels The value to assign to the {#initial_node_labels} property
118
+ # @option attributes [String] :ssh_public_key The value to assign to the {#ssh_public_key} property
119
+ # @option attributes [Integer] :quantity_per_subnet The value to assign to the {#quantity_per_subnet} property
120
+ # @option attributes [Array<String>] :subnet_ids The value to assign to the {#subnet_ids} property
121
+ # @option attributes [Array<OCI::ContainerEngine::Models::Node>] :nodes The value to assign to the {#nodes} property
122
+ def initialize(attributes = {})
123
+ return unless attributes.is_a?(Hash)
124
+
125
+ # convert string to symbol for hash key
126
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
127
+
128
+ self.id = attributes[:'id'] if attributes[:'id']
129
+
130
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
131
+
132
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
133
+
134
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
135
+
136
+ self.cluster_id = attributes[:'clusterId'] if attributes[:'clusterId']
137
+
138
+ raise 'You cannot provide both :clusterId and :cluster_id' if attributes.key?(:'clusterId') && attributes.key?(:'cluster_id')
139
+
140
+ self.cluster_id = attributes[:'cluster_id'] if attributes[:'cluster_id']
141
+
142
+ self.name = attributes[:'name'] if attributes[:'name']
143
+
144
+ self.kubernetes_version = attributes[:'kubernetesVersion'] if attributes[:'kubernetesVersion']
145
+
146
+ raise 'You cannot provide both :kubernetesVersion and :kubernetes_version' if attributes.key?(:'kubernetesVersion') && attributes.key?(:'kubernetes_version')
147
+
148
+ self.kubernetes_version = attributes[:'kubernetes_version'] if attributes[:'kubernetes_version']
149
+
150
+ self.node_image_id = attributes[:'nodeImageId'] if attributes[:'nodeImageId']
151
+
152
+ raise 'You cannot provide both :nodeImageId and :node_image_id' if attributes.key?(:'nodeImageId') && attributes.key?(:'node_image_id')
153
+
154
+ self.node_image_id = attributes[:'node_image_id'] if attributes[:'node_image_id']
155
+
156
+ self.node_image_name = attributes[:'nodeImageName'] if attributes[:'nodeImageName']
157
+
158
+ raise 'You cannot provide both :nodeImageName and :node_image_name' if attributes.key?(:'nodeImageName') && attributes.key?(:'node_image_name')
159
+
160
+ self.node_image_name = attributes[:'node_image_name'] if attributes[:'node_image_name']
161
+
162
+ self.node_shape = attributes[:'nodeShape'] if attributes[:'nodeShape']
163
+
164
+ raise 'You cannot provide both :nodeShape and :node_shape' if attributes.key?(:'nodeShape') && attributes.key?(:'node_shape')
165
+
166
+ self.node_shape = attributes[:'node_shape'] if attributes[:'node_shape']
167
+
168
+ self.initial_node_labels = attributes[:'initialNodeLabels'] if attributes[:'initialNodeLabels']
169
+
170
+ raise 'You cannot provide both :initialNodeLabels and :initial_node_labels' if attributes.key?(:'initialNodeLabels') && attributes.key?(:'initial_node_labels')
171
+
172
+ self.initial_node_labels = attributes[:'initial_node_labels'] if attributes[:'initial_node_labels']
173
+
174
+ self.ssh_public_key = attributes[:'sshPublicKey'] if attributes[:'sshPublicKey']
175
+
176
+ raise 'You cannot provide both :sshPublicKey and :ssh_public_key' if attributes.key?(:'sshPublicKey') && attributes.key?(:'ssh_public_key')
177
+
178
+ self.ssh_public_key = attributes[:'ssh_public_key'] if attributes[:'ssh_public_key']
179
+
180
+ self.quantity_per_subnet = attributes[:'quantityPerSubnet'] if attributes[:'quantityPerSubnet']
181
+
182
+ raise 'You cannot provide both :quantityPerSubnet and :quantity_per_subnet' if attributes.key?(:'quantityPerSubnet') && attributes.key?(:'quantity_per_subnet')
183
+
184
+ self.quantity_per_subnet = attributes[:'quantity_per_subnet'] if attributes[:'quantity_per_subnet']
185
+
186
+ self.subnet_ids = attributes[:'subnetIds'] if attributes[:'subnetIds']
187
+
188
+ raise 'You cannot provide both :subnetIds and :subnet_ids' if attributes.key?(:'subnetIds') && attributes.key?(:'subnet_ids')
189
+
190
+ self.subnet_ids = attributes[:'subnet_ids'] if attributes[:'subnet_ids']
191
+
192
+ self.nodes = attributes[:'nodes'] if attributes[:'nodes']
193
+ end
194
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
195
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
196
+
197
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
198
+
199
+
200
+ # Checks equality by comparing each attribute.
201
+ # @param [Object] other the other object to be compared
202
+ def ==(other)
203
+ return true if equal?(other)
204
+ self.class == other.class &&
205
+ id == other.id &&
206
+ compartment_id == other.compartment_id &&
207
+ cluster_id == other.cluster_id &&
208
+ name == other.name &&
209
+ kubernetes_version == other.kubernetes_version &&
210
+ node_image_id == other.node_image_id &&
211
+ node_image_name == other.node_image_name &&
212
+ node_shape == other.node_shape &&
213
+ initial_node_labels == other.initial_node_labels &&
214
+ ssh_public_key == other.ssh_public_key &&
215
+ quantity_per_subnet == other.quantity_per_subnet &&
216
+ subnet_ids == other.subnet_ids &&
217
+ nodes == other.nodes
218
+ end
219
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
220
+
221
+ # @see the `==` method
222
+ # @param [Object] other the other object to be compared
223
+ def eql?(other)
224
+ self == other
225
+ end
226
+
227
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
228
+
229
+
230
+ # Calculates hash code according to all attributes.
231
+ # @return [Fixnum] Hash code
232
+ def hash
233
+ [id, compartment_id, cluster_id, name, kubernetes_version, node_image_id, node_image_name, node_shape, initial_node_labels, ssh_public_key, quantity_per_subnet, subnet_ids, nodes].hash
234
+ end
235
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
236
+
237
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
238
+
239
+
240
+ # Builds the object from hash
241
+ # @param [Hash] attributes Model attributes in the form of hash
242
+ # @return [Object] Returns the model itself
243
+ def build_from_hash(attributes)
244
+ return nil unless attributes.is_a?(Hash)
245
+ self.class.swagger_types.each_pair do |key, type|
246
+ if type =~ /^Array<(.*)>/i
247
+ # check to ensure the input is an array given that the the attribute
248
+ # is documented as an array but the input is not
249
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
250
+ public_method("#{key}=").call(
251
+ attributes[self.class.attribute_map[key]]
252
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
253
+ )
254
+ end
255
+ elsif !attributes[self.class.attribute_map[key]].nil?
256
+ public_method("#{key}=").call(
257
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
258
+ )
259
+ end
260
+ # or else data not found in attributes(hash), not an issue as the data can be optional
261
+ end
262
+
263
+ self
264
+ end
265
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
266
+
267
+ # Returns the string representation of the object
268
+ # @return [String] String presentation of the object
269
+ def to_s
270
+ to_hash.to_s
271
+ end
272
+
273
+ # Returns the object in the form of hash
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_hash
276
+ hash = {}
277
+ self.class.attribute_map.each_pair do |attr, param|
278
+ value = public_method(attr).call
279
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ private
286
+
287
+ # Outputs non-array value in the form of hash
288
+ # For object, use to_hash. Otherwise, just return the value
289
+ # @param [Object] value Any valid value
290
+ # @return [Hash] Returns the value in the form of hash
291
+ def _to_hash(value)
292
+ if value.is_a?(Array)
293
+ value.compact.map { |v| _to_hash(v) }
294
+ elsif value.is_a?(Hash)
295
+ {}.tap do |hash|
296
+ value.each { |k, v| hash[k] = _to_hash(v) }
297
+ end
298
+ elsif value.respond_to? :to_hash
299
+ value.to_hash
300
+ else
301
+ value
302
+ end
303
+ end
304
+ end
305
+ end
306
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,170 @@
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
+ # Options for creating or updating node pools.
8
+ class ContainerEngine::Models::NodePoolOptions # rubocop:disable Metrics/LineLength
9
+ # Available Kubernetes versions.
10
+ # @return [Array<String>]
11
+ attr_accessor :kubernetes_versions
12
+
13
+ # Available Kubernetes versions.
14
+ # @return [Array<String>]
15
+ attr_accessor :images
16
+
17
+ # Available shapes for nodes.
18
+ # @return [Array<String>]
19
+ attr_accessor :shapes
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ # rubocop:disable Style/SymbolLiteral
25
+ 'kubernetes_versions': :'kubernetesVersions',
26
+ 'images': :'images',
27
+ 'shapes': :'shapes'
28
+ # rubocop:enable Style/SymbolLiteral
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ # rubocop:disable Style/SymbolLiteral
36
+ 'kubernetes_versions': :'Array<String>',
37
+ 'images': :'Array<String>',
38
+ 'shapes': :'Array<String>'
39
+ # rubocop:enable Style/SymbolLiteral
40
+ }
41
+ end
42
+
43
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
44
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
45
+
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ # @option attributes [Array<String>] :kubernetes_versions The value to assign to the {#kubernetes_versions} property
50
+ # @option attributes [Array<String>] :images The value to assign to the {#images} property
51
+ # @option attributes [Array<String>] :shapes The value to assign to the {#shapes} property
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ self.kubernetes_versions = attributes[:'kubernetesVersions'] if attributes[:'kubernetesVersions']
59
+
60
+ raise 'You cannot provide both :kubernetesVersions and :kubernetes_versions' if attributes.key?(:'kubernetesVersions') && attributes.key?(:'kubernetes_versions')
61
+
62
+ self.kubernetes_versions = attributes[:'kubernetes_versions'] if attributes[:'kubernetes_versions']
63
+
64
+ self.images = attributes[:'images'] if attributes[:'images']
65
+
66
+ self.shapes = attributes[:'shapes'] if attributes[:'shapes']
67
+ end
68
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
69
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
70
+
71
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
72
+
73
+
74
+ # Checks equality by comparing each attribute.
75
+ # @param [Object] other the other object to be compared
76
+ def ==(other)
77
+ return true if equal?(other)
78
+ self.class == other.class &&
79
+ kubernetes_versions == other.kubernetes_versions &&
80
+ images == other.images &&
81
+ shapes == other.shapes
82
+ end
83
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
84
+
85
+ # @see the `==` method
86
+ # @param [Object] other the other object to be compared
87
+ def eql?(other)
88
+ self == other
89
+ end
90
+
91
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
92
+
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Fixnum] Hash code
96
+ def hash
97
+ [kubernetes_versions, images, shapes].hash
98
+ end
99
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
100
+
101
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
102
+
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def build_from_hash(attributes)
108
+ return nil unless attributes.is_a?(Hash)
109
+ self.class.swagger_types.each_pair do |key, type|
110
+ if type =~ /^Array<(.*)>/i
111
+ # check to ensure the input is an array given that the the attribute
112
+ # is documented as an array but the input is not
113
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
114
+ public_method("#{key}=").call(
115
+ attributes[self.class.attribute_map[key]]
116
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
117
+ )
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ public_method("#{key}=").call(
121
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
122
+ )
123
+ end
124
+ # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
130
+
131
+ # Returns the string representation of the object
132
+ # @return [String] String presentation of the object
133
+ def to_s
134
+ to_hash.to_s
135
+ end
136
+
137
+ # Returns the object in the form of hash
138
+ # @return [Hash] Returns the object in the form of hash
139
+ def to_hash
140
+ hash = {}
141
+ self.class.attribute_map.each_pair do |attr, param|
142
+ value = public_method(attr).call
143
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
144
+ hash[param] = _to_hash(value)
145
+ end
146
+ hash
147
+ end
148
+
149
+ private
150
+
151
+ # Outputs non-array value in the form of hash
152
+ # For object, use to_hash. Otherwise, just return the value
153
+ # @param [Object] value Any valid value
154
+ # @return [Hash] Returns the value in the form of hash
155
+ def _to_hash(value)
156
+ if value.is_a?(Array)
157
+ value.compact.map { |v| _to_hash(v) }
158
+ elsif value.is_a?(Hash)
159
+ {}.tap do |hash|
160
+ value.each { |k, v| hash[k] = _to_hash(v) }
161
+ end
162
+ elsif value.respond_to? :to_hash
163
+ value.to_hash
164
+ else
165
+ value
166
+ end
167
+ end
168
+ end
169
+ end
170
+ # rubocop:enable Lint/UnneededCopDisableDirective