oci 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
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,296 @@
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 Kubernetes cluster.
9
+ class ContainerEngine::Models::Cluster # rubocop:disable Metrics/LineLength
10
+ LIFECYCLE_STATE_ENUM = [
11
+ LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
12
+ LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
13
+ LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
14
+ LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
15
+ LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
16
+ LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
17
+ LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
18
+ ].freeze
19
+
20
+ # The OCID of the cluster.
21
+ # @return [String]
22
+ attr_accessor :id
23
+
24
+ # The name of the cluster.
25
+ # @return [String]
26
+ attr_accessor :name
27
+
28
+ # The OCID of the compartment in which the cluster exists.
29
+ # @return [String]
30
+ attr_accessor :compartment_id
31
+
32
+ # The OCID of the virtual cloud network (VCN) in which the cluster exists.
33
+ # @return [String]
34
+ attr_accessor :vcn_id
35
+
36
+ # The version of Kubernetes running on the cluster masters.
37
+ # @return [String]
38
+ attr_accessor :kubernetes_version
39
+
40
+ # Optional attributes for the cluster.
41
+ # @return [OCI::ContainerEngine::Models::ClusterCreateOptions]
42
+ attr_accessor :options
43
+
44
+ # Metadata about the cluster.
45
+ # @return [OCI::ContainerEngine::Models::ClusterMetadata]
46
+ attr_accessor :metadata
47
+
48
+ # The state of the cluster masters.
49
+ # @return [String]
50
+ attr_reader :lifecycle_state
51
+
52
+ # Details about the state of the cluster masters.
53
+ # @return [String]
54
+ attr_accessor :lifecycle_details
55
+
56
+ # Endpoints served up by the cluster masters.
57
+ # @return [OCI::ContainerEngine::Models::ClusterEndpoints]
58
+ attr_accessor :endpoints
59
+
60
+ # Available Kubernetes versions to which the clusters masters may be upgraded.
61
+ # @return [Array<String>]
62
+ attr_accessor :available_kubernetes_upgrades
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ # rubocop:disable Style/SymbolLiteral
68
+ 'id': :'id',
69
+ 'name': :'name',
70
+ 'compartment_id': :'compartmentId',
71
+ 'vcn_id': :'vcnId',
72
+ 'kubernetes_version': :'kubernetesVersion',
73
+ 'options': :'options',
74
+ 'metadata': :'metadata',
75
+ 'lifecycle_state': :'lifecycleState',
76
+ 'lifecycle_details': :'lifecycleDetails',
77
+ 'endpoints': :'endpoints',
78
+ 'available_kubernetes_upgrades': :'availableKubernetesUpgrades'
79
+ # rubocop:enable Style/SymbolLiteral
80
+ }
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.swagger_types
85
+ {
86
+ # rubocop:disable Style/SymbolLiteral
87
+ 'id': :'String',
88
+ 'name': :'String',
89
+ 'compartment_id': :'String',
90
+ 'vcn_id': :'String',
91
+ 'kubernetes_version': :'String',
92
+ 'options': :'OCI::ContainerEngine::Models::ClusterCreateOptions',
93
+ 'metadata': :'OCI::ContainerEngine::Models::ClusterMetadata',
94
+ 'lifecycle_state': :'String',
95
+ 'lifecycle_details': :'String',
96
+ 'endpoints': :'OCI::ContainerEngine::Models::ClusterEndpoints',
97
+ 'available_kubernetes_upgrades': :'Array<String>'
98
+ # rubocop:enable Style/SymbolLiteral
99
+ }
100
+ end
101
+
102
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
103
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
104
+
105
+
106
+ # Initializes the object
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @option attributes [String] :id The value to assign to the {#id} property
109
+ # @option attributes [String] :name The value to assign to the {#name} property
110
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
111
+ # @option attributes [String] :vcn_id The value to assign to the {#vcn_id} property
112
+ # @option attributes [String] :kubernetes_version The value to assign to the {#kubernetes_version} property
113
+ # @option attributes [OCI::ContainerEngine::Models::ClusterCreateOptions] :options The value to assign to the {#options} property
114
+ # @option attributes [OCI::ContainerEngine::Models::ClusterMetadata] :metadata The value to assign to the {#metadata} property
115
+ # @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property
116
+ # @option attributes [String] :lifecycle_details The value to assign to the {#lifecycle_details} property
117
+ # @option attributes [OCI::ContainerEngine::Models::ClusterEndpoints] :endpoints The value to assign to the {#endpoints} property
118
+ # @option attributes [Array<String>] :available_kubernetes_upgrades The value to assign to the {#available_kubernetes_upgrades} 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.id = attributes[:'id'] if attributes[:'id']
126
+
127
+ self.name = attributes[:'name'] if attributes[:'name']
128
+
129
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
130
+
131
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
132
+
133
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
134
+
135
+ self.vcn_id = attributes[:'vcnId'] if attributes[:'vcnId']
136
+
137
+ raise 'You cannot provide both :vcnId and :vcn_id' if attributes.key?(:'vcnId') && attributes.key?(:'vcn_id')
138
+
139
+ self.vcn_id = attributes[:'vcn_id'] if attributes[:'vcn_id']
140
+
141
+ self.kubernetes_version = attributes[:'kubernetesVersion'] if attributes[:'kubernetesVersion']
142
+
143
+ raise 'You cannot provide both :kubernetesVersion and :kubernetes_version' if attributes.key?(:'kubernetesVersion') && attributes.key?(:'kubernetes_version')
144
+
145
+ self.kubernetes_version = attributes[:'kubernetes_version'] if attributes[:'kubernetes_version']
146
+
147
+ self.options = attributes[:'options'] if attributes[:'options']
148
+
149
+ self.metadata = attributes[:'metadata'] if attributes[:'metadata']
150
+
151
+ self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']
152
+
153
+ raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state')
154
+
155
+ self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state']
156
+
157
+ self.lifecycle_details = attributes[:'lifecycleDetails'] if attributes[:'lifecycleDetails']
158
+
159
+ raise 'You cannot provide both :lifecycleDetails and :lifecycle_details' if attributes.key?(:'lifecycleDetails') && attributes.key?(:'lifecycle_details')
160
+
161
+ self.lifecycle_details = attributes[:'lifecycle_details'] if attributes[:'lifecycle_details']
162
+
163
+ self.endpoints = attributes[:'endpoints'] if attributes[:'endpoints']
164
+
165
+ self.available_kubernetes_upgrades = attributes[:'availableKubernetesUpgrades'] if attributes[:'availableKubernetesUpgrades']
166
+
167
+ raise 'You cannot provide both :availableKubernetesUpgrades and :available_kubernetes_upgrades' if attributes.key?(:'availableKubernetesUpgrades') && attributes.key?(:'available_kubernetes_upgrades')
168
+
169
+ self.available_kubernetes_upgrades = attributes[:'available_kubernetes_upgrades'] if attributes[:'available_kubernetes_upgrades']
170
+ end
171
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
172
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
173
+
174
+ # Custom attribute writer method checking allowed values (enum).
175
+ # @param [Object] lifecycle_state Object to be assigned
176
+ def lifecycle_state=(lifecycle_state)
177
+ # rubocop:disable Style/ConditionalAssignment
178
+ if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state)
179
+ # rubocop: disable Metrics/LineLength
180
+ OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger
181
+ # rubocop: enable Metrics/LineLength
182
+ @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE
183
+ else
184
+ @lifecycle_state = lifecycle_state
185
+ end
186
+ # rubocop:enable Style/ConditionalAssignment
187
+ end
188
+
189
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
190
+
191
+
192
+ # Checks equality by comparing each attribute.
193
+ # @param [Object] other the other object to be compared
194
+ def ==(other)
195
+ return true if equal?(other)
196
+ self.class == other.class &&
197
+ id == other.id &&
198
+ name == other.name &&
199
+ compartment_id == other.compartment_id &&
200
+ vcn_id == other.vcn_id &&
201
+ kubernetes_version == other.kubernetes_version &&
202
+ options == other.options &&
203
+ metadata == other.metadata &&
204
+ lifecycle_state == other.lifecycle_state &&
205
+ lifecycle_details == other.lifecycle_details &&
206
+ endpoints == other.endpoints &&
207
+ available_kubernetes_upgrades == other.available_kubernetes_upgrades
208
+ end
209
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
210
+
211
+ # @see the `==` method
212
+ # @param [Object] other the other object to be compared
213
+ def eql?(other)
214
+ self == other
215
+ end
216
+
217
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
218
+
219
+
220
+ # Calculates hash code according to all attributes.
221
+ # @return [Fixnum] Hash code
222
+ def hash
223
+ [id, name, compartment_id, vcn_id, kubernetes_version, options, metadata, lifecycle_state, lifecycle_details, endpoints, available_kubernetes_upgrades].hash
224
+ end
225
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
226
+
227
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
228
+
229
+
230
+ # Builds the object from hash
231
+ # @param [Hash] attributes Model attributes in the form of hash
232
+ # @return [Object] Returns the model itself
233
+ def build_from_hash(attributes)
234
+ return nil unless attributes.is_a?(Hash)
235
+ self.class.swagger_types.each_pair do |key, type|
236
+ if type =~ /^Array<(.*)>/i
237
+ # check to ensure the input is an array given that the the attribute
238
+ # is documented as an array but the input is not
239
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
240
+ public_method("#{key}=").call(
241
+ attributes[self.class.attribute_map[key]]
242
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
243
+ )
244
+ end
245
+ elsif !attributes[self.class.attribute_map[key]].nil?
246
+ public_method("#{key}=").call(
247
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
248
+ )
249
+ end
250
+ # or else data not found in attributes(hash), not an issue as the data can be optional
251
+ end
252
+
253
+ self
254
+ end
255
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
256
+
257
+ # Returns the string representation of the object
258
+ # @return [String] String presentation of the object
259
+ def to_s
260
+ to_hash.to_s
261
+ end
262
+
263
+ # Returns the object in the form of hash
264
+ # @return [Hash] Returns the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = public_method(attr).call
269
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
270
+ hash[param] = _to_hash(value)
271
+ end
272
+ hash
273
+ end
274
+
275
+ private
276
+
277
+ # Outputs non-array value in the form of hash
278
+ # For object, use to_hash. Otherwise, just return the value
279
+ # @param [Object] value Any valid value
280
+ # @return [Hash] Returns the value in the form of hash
281
+ def _to_hash(value)
282
+ if value.is_a?(Array)
283
+ value.compact.map { |v| _to_hash(v) }
284
+ elsif value.is_a?(Hash)
285
+ {}.tap do |hash|
286
+ value.each { |k, v| hash[k] = _to_hash(v) }
287
+ end
288
+ elsif value.respond_to? :to_hash
289
+ value.to_hash
290
+ else
291
+ value
292
+ end
293
+ end
294
+ end
295
+ end
296
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,178 @@
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
+ # The properties that define extra options for a cluster.
8
+ class ContainerEngine::Models::ClusterCreateOptions # rubocop:disable Metrics/LineLength
9
+ # The OCIDs of the subnets used for Kubernetes services load balancers.
10
+ # @return [Array<String>]
11
+ attr_accessor :service_lb_subnet_ids
12
+
13
+ # Network configuration for Kubernetes.
14
+ # @return [OCI::ContainerEngine::Models::KubernetesNetworkConfig]
15
+ attr_accessor :kubernetes_network_config
16
+
17
+ # Configurable cluster add-ons
18
+ # @return [OCI::ContainerEngine::Models::AddOnOptions]
19
+ attr_accessor :add_ons
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ # rubocop:disable Style/SymbolLiteral
25
+ 'service_lb_subnet_ids': :'serviceLbSubnetIds',
26
+ 'kubernetes_network_config': :'kubernetesNetworkConfig',
27
+ 'add_ons': :'addOns'
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
+ 'service_lb_subnet_ids': :'Array<String>',
37
+ 'kubernetes_network_config': :'OCI::ContainerEngine::Models::KubernetesNetworkConfig',
38
+ 'add_ons': :'OCI::ContainerEngine::Models::AddOnOptions'
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>] :service_lb_subnet_ids The value to assign to the {#service_lb_subnet_ids} property
50
+ # @option attributes [OCI::ContainerEngine::Models::KubernetesNetworkConfig] :kubernetes_network_config The value to assign to the {#kubernetes_network_config} property
51
+ # @option attributes [OCI::ContainerEngine::Models::AddOnOptions] :add_ons The value to assign to the {#add_ons} 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.service_lb_subnet_ids = attributes[:'serviceLbSubnetIds'] if attributes[:'serviceLbSubnetIds']
59
+
60
+ raise 'You cannot provide both :serviceLbSubnetIds and :service_lb_subnet_ids' if attributes.key?(:'serviceLbSubnetIds') && attributes.key?(:'service_lb_subnet_ids')
61
+
62
+ self.service_lb_subnet_ids = attributes[:'service_lb_subnet_ids'] if attributes[:'service_lb_subnet_ids']
63
+
64
+ self.kubernetes_network_config = attributes[:'kubernetesNetworkConfig'] if attributes[:'kubernetesNetworkConfig']
65
+
66
+ raise 'You cannot provide both :kubernetesNetworkConfig and :kubernetes_network_config' if attributes.key?(:'kubernetesNetworkConfig') && attributes.key?(:'kubernetes_network_config')
67
+
68
+ self.kubernetes_network_config = attributes[:'kubernetes_network_config'] if attributes[:'kubernetes_network_config']
69
+
70
+ self.add_ons = attributes[:'addOns'] if attributes[:'addOns']
71
+
72
+ raise 'You cannot provide both :addOns and :add_ons' if attributes.key?(:'addOns') && attributes.key?(:'add_ons')
73
+
74
+ self.add_ons = attributes[:'add_ons'] if attributes[:'add_ons']
75
+ end
76
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
77
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
78
+
79
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
80
+
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] other the other object to be compared
84
+ def ==(other)
85
+ return true if equal?(other)
86
+ self.class == other.class &&
87
+ service_lb_subnet_ids == other.service_lb_subnet_ids &&
88
+ kubernetes_network_config == other.kubernetes_network_config &&
89
+ add_ons == other.add_ons
90
+ end
91
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
92
+
93
+ # @see the `==` method
94
+ # @param [Object] other the other object to be compared
95
+ def eql?(other)
96
+ self == other
97
+ end
98
+
99
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
100
+
101
+
102
+ # Calculates hash code according to all attributes.
103
+ # @return [Fixnum] Hash code
104
+ def hash
105
+ [service_lb_subnet_ids, kubernetes_network_config, add_ons].hash
106
+ end
107
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
108
+
109
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
110
+
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def build_from_hash(attributes)
116
+ return nil unless attributes.is_a?(Hash)
117
+ self.class.swagger_types.each_pair do |key, type|
118
+ if type =~ /^Array<(.*)>/i
119
+ # check to ensure the input is an array given that the the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ public_method("#{key}=").call(
123
+ attributes[self.class.attribute_map[key]]
124
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
125
+ )
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ public_method("#{key}=").call(
129
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
130
+ )
131
+ end
132
+ # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
138
+
139
+ # Returns the string representation of the object
140
+ # @return [String] String presentation of the object
141
+ def to_s
142
+ to_hash.to_s
143
+ end
144
+
145
+ # Returns the object in the form of hash
146
+ # @return [Hash] Returns the object in the form of hash
147
+ def to_hash
148
+ hash = {}
149
+ self.class.attribute_map.each_pair do |attr, param|
150
+ value = public_method(attr).call
151
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
152
+ hash[param] = _to_hash(value)
153
+ end
154
+ hash
155
+ end
156
+
157
+ private
158
+
159
+ # Outputs non-array value in the form of hash
160
+ # For object, use to_hash. Otherwise, just return the value
161
+ # @param [Object] value Any valid value
162
+ # @return [Hash] Returns the value in the form of hash
163
+ def _to_hash(value)
164
+ if value.is_a?(Array)
165
+ value.compact.map { |v| _to_hash(v) }
166
+ elsif value.is_a?(Hash)
167
+ {}.tap do |hash|
168
+ value.each { |k, v| hash[k] = _to_hash(v) }
169
+ end
170
+ elsif value.respond_to? :to_hash
171
+ value.to_hash
172
+ else
173
+ value
174
+ end
175
+ end
176
+ end
177
+ end
178
+ # rubocop:enable Lint/UnneededCopDisableDirective