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,202 @@
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 a request to update a node pool.
8
+ class ContainerEngine::Models::UpdateNodePoolDetails # rubocop:disable Metrics/LineLength
9
+ # The new name for the cluster. Avoid entering confidential information.
10
+ # @return [String]
11
+ attr_accessor :name
12
+
13
+ # The version of Kubernetes to which the nodes in the node pool should be upgraded.
14
+ # @return [String]
15
+ attr_accessor :kubernetes_version
16
+
17
+ # The number of nodes to ensure in each subnet.
18
+ # @return [Integer]
19
+ attr_accessor :quantity_per_subnet
20
+
21
+ # A list of key/value pairs to add to nodes after they join the Kubernetes cluster.
22
+ # @return [Array<OCI::ContainerEngine::Models::KeyValue>]
23
+ attr_accessor :initial_node_labels
24
+
25
+ # The OCIDs of the subnets in which to place nodes for this node pool.
26
+ # @return [Array<String>]
27
+ attr_accessor :subnet_ids
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ # rubocop:disable Style/SymbolLiteral
33
+ 'name': :'name',
34
+ 'kubernetes_version': :'kubernetesVersion',
35
+ 'quantity_per_subnet': :'quantityPerSubnet',
36
+ 'initial_node_labels': :'initialNodeLabels',
37
+ 'subnet_ids': :'subnetIds'
38
+ # rubocop:enable Style/SymbolLiteral
39
+ }
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.swagger_types
44
+ {
45
+ # rubocop:disable Style/SymbolLiteral
46
+ 'name': :'String',
47
+ 'kubernetes_version': :'String',
48
+ 'quantity_per_subnet': :'Integer',
49
+ 'initial_node_labels': :'Array<OCI::ContainerEngine::Models::KeyValue>',
50
+ 'subnet_ids': :'Array<String>'
51
+ # rubocop:enable Style/SymbolLiteral
52
+ }
53
+ end
54
+
55
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
56
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
57
+
58
+
59
+ # Initializes the object
60
+ # @param [Hash] attributes Model attributes in the form of hash
61
+ # @option attributes [String] :name The value to assign to the {#name} property
62
+ # @option attributes [String] :kubernetes_version The value to assign to the {#kubernetes_version} property
63
+ # @option attributes [Integer] :quantity_per_subnet The value to assign to the {#quantity_per_subnet} property
64
+ # @option attributes [Array<OCI::ContainerEngine::Models::KeyValue>] :initial_node_labels The value to assign to the {#initial_node_labels} property
65
+ # @option attributes [Array<String>] :subnet_ids The value to assign to the {#subnet_ids} property
66
+ def initialize(attributes = {})
67
+ return unless attributes.is_a?(Hash)
68
+
69
+ # convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
71
+
72
+ self.name = attributes[:'name'] if attributes[:'name']
73
+
74
+ self.kubernetes_version = attributes[:'kubernetesVersion'] if attributes[:'kubernetesVersion']
75
+
76
+ raise 'You cannot provide both :kubernetesVersion and :kubernetes_version' if attributes.key?(:'kubernetesVersion') && attributes.key?(:'kubernetes_version')
77
+
78
+ self.kubernetes_version = attributes[:'kubernetes_version'] if attributes[:'kubernetes_version']
79
+
80
+ self.quantity_per_subnet = attributes[:'quantityPerSubnet'] if attributes[:'quantityPerSubnet']
81
+
82
+ raise 'You cannot provide both :quantityPerSubnet and :quantity_per_subnet' if attributes.key?(:'quantityPerSubnet') && attributes.key?(:'quantity_per_subnet')
83
+
84
+ self.quantity_per_subnet = attributes[:'quantity_per_subnet'] if attributes[:'quantity_per_subnet']
85
+
86
+ self.initial_node_labels = attributes[:'initialNodeLabels'] if attributes[:'initialNodeLabels']
87
+
88
+ raise 'You cannot provide both :initialNodeLabels and :initial_node_labels' if attributes.key?(:'initialNodeLabels') && attributes.key?(:'initial_node_labels')
89
+
90
+ self.initial_node_labels = attributes[:'initial_node_labels'] if attributes[:'initial_node_labels']
91
+
92
+ self.subnet_ids = attributes[:'subnetIds'] if attributes[:'subnetIds']
93
+
94
+ raise 'You cannot provide both :subnetIds and :subnet_ids' if attributes.key?(:'subnetIds') && attributes.key?(:'subnet_ids')
95
+
96
+ self.subnet_ids = attributes[:'subnet_ids'] if attributes[:'subnet_ids']
97
+ end
98
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
99
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
100
+
101
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
102
+
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] other the other object to be compared
106
+ def ==(other)
107
+ return true if equal?(other)
108
+ self.class == other.class &&
109
+ name == other.name &&
110
+ kubernetes_version == other.kubernetes_version &&
111
+ quantity_per_subnet == other.quantity_per_subnet &&
112
+ initial_node_labels == other.initial_node_labels &&
113
+ subnet_ids == other.subnet_ids
114
+ end
115
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
116
+
117
+ # @see the `==` method
118
+ # @param [Object] other the other object to be compared
119
+ def eql?(other)
120
+ self == other
121
+ end
122
+
123
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
124
+
125
+
126
+ # Calculates hash code according to all attributes.
127
+ # @return [Fixnum] Hash code
128
+ def hash
129
+ [name, kubernetes_version, quantity_per_subnet, initial_node_labels, subnet_ids].hash
130
+ end
131
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
132
+
133
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
134
+
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ self.class.swagger_types.each_pair do |key, type|
142
+ if type =~ /^Array<(.*)>/i
143
+ # check to ensure the input is an array given that the the attribute
144
+ # is documented as an array but the input is not
145
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
146
+ public_method("#{key}=").call(
147
+ attributes[self.class.attribute_map[key]]
148
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
149
+ )
150
+ end
151
+ elsif !attributes[self.class.attribute_map[key]].nil?
152
+ public_method("#{key}=").call(
153
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
154
+ )
155
+ end
156
+ # or else data not found in attributes(hash), not an issue as the data can be optional
157
+ end
158
+
159
+ self
160
+ end
161
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # Returns the object in the form of hash
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_hash
172
+ hash = {}
173
+ self.class.attribute_map.each_pair do |attr, param|
174
+ value = public_method(attr).call
175
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
176
+ hash[param] = _to_hash(value)
177
+ end
178
+ hash
179
+ end
180
+
181
+ private
182
+
183
+ # Outputs non-array value in the form of hash
184
+ # For object, use to_hash. Otherwise, just return the value
185
+ # @param [Object] value Any valid value
186
+ # @return [Hash] Returns the value in the form of hash
187
+ def _to_hash(value)
188
+ if value.is_a?(Array)
189
+ value.compact.map { |v| _to_hash(v) }
190
+ elsif value.is_a?(Hash)
191
+ {}.tap do |hash|
192
+ value.each { |k, v| hash[k] = _to_hash(v) }
193
+ end
194
+ elsif value.respond_to? :to_hash
195
+ value.to_hash
196
+ else
197
+ value
198
+ end
199
+ end
200
+ end
201
+ end
202
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,288 @@
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 asynchronous work request.
9
+ class ContainerEngine::Models::WorkRequest # rubocop:disable Metrics/LineLength
10
+ OPERATION_TYPE_ENUM = [
11
+ OPERATION_TYPE_CLUSTER_CREATE = 'CLUSTER_CREATE'.freeze,
12
+ OPERATION_TYPE_CLUSTER_UPDATE = 'CLUSTER_UPDATE'.freeze,
13
+ OPERATION_TYPE_CLUSTER_DELETE = 'CLUSTER_DELETE'.freeze,
14
+ OPERATION_TYPE_NODEPOOL_CREATE = 'NODEPOOL_CREATE'.freeze,
15
+ OPERATION_TYPE_NODEPOOL_UPDATE = 'NODEPOOL_UPDATE'.freeze,
16
+ OPERATION_TYPE_NODEPOOL_DELETE = 'NODEPOOL_DELETE'.freeze,
17
+ OPERATION_TYPE_WORKREQUEST_CANCEL = 'WORKREQUEST_CANCEL'.freeze,
18
+ OPERATION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
19
+ ].freeze
20
+
21
+ STATUS_ENUM = [
22
+ STATUS_ACCEPTED = 'ACCEPTED'.freeze,
23
+ STATUS_IN_PROGRESS = 'IN_PROGRESS'.freeze,
24
+ STATUS_FAILED = 'FAILED'.freeze,
25
+ STATUS_SUCCEEDED = 'SUCCEEDED'.freeze,
26
+ STATUS_CANCELING = 'CANCELING'.freeze,
27
+ STATUS_CANCELED = 'CANCELED'.freeze,
28
+ STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
29
+ ].freeze
30
+
31
+ # The OCID of the work request.
32
+ # @return [String]
33
+ attr_accessor :id
34
+
35
+ # The type of work the work request is doing.
36
+ # @return [String]
37
+ attr_reader :operation_type
38
+
39
+ # The current status of the work request.
40
+ # @return [String]
41
+ attr_reader :status
42
+
43
+ # The OCID of the compartment in which the work request exists.
44
+ # @return [String]
45
+ attr_accessor :compartment_id
46
+
47
+ # The resources this work request affects.
48
+ # @return [Array<OCI::ContainerEngine::Models::WorkRequestResource>]
49
+ attr_accessor :resources
50
+
51
+ # The time the work request was accepted.
52
+ # @return [DateTime]
53
+ attr_accessor :time_accepted
54
+
55
+ # The time the work request was started.
56
+ # @return [DateTime]
57
+ attr_accessor :time_started
58
+
59
+ # The time the work request was finished.
60
+ # @return [DateTime]
61
+ attr_accessor :time_finished
62
+
63
+ # Attribute mapping from ruby-style variable name to JSON key.
64
+ def self.attribute_map
65
+ {
66
+ # rubocop:disable Style/SymbolLiteral
67
+ 'id': :'id',
68
+ 'operation_type': :'operationType',
69
+ 'status': :'status',
70
+ 'compartment_id': :'compartmentId',
71
+ 'resources': :'resources',
72
+ 'time_accepted': :'timeAccepted',
73
+ 'time_started': :'timeStarted',
74
+ 'time_finished': :'timeFinished'
75
+ # rubocop:enable Style/SymbolLiteral
76
+ }
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.swagger_types
81
+ {
82
+ # rubocop:disable Style/SymbolLiteral
83
+ 'id': :'String',
84
+ 'operation_type': :'String',
85
+ 'status': :'String',
86
+ 'compartment_id': :'String',
87
+ 'resources': :'Array<OCI::ContainerEngine::Models::WorkRequestResource>',
88
+ 'time_accepted': :'DateTime',
89
+ 'time_started': :'DateTime',
90
+ 'time_finished': :'DateTime'
91
+ # rubocop:enable Style/SymbolLiteral
92
+ }
93
+ end
94
+
95
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
96
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
97
+
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @option attributes [String] :id The value to assign to the {#id} property
102
+ # @option attributes [String] :operation_type The value to assign to the {#operation_type} property
103
+ # @option attributes [String] :status The value to assign to the {#status} property
104
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
105
+ # @option attributes [Array<OCI::ContainerEngine::Models::WorkRequestResource>] :resources The value to assign to the {#resources} property
106
+ # @option attributes [DateTime] :time_accepted The value to assign to the {#time_accepted} property
107
+ # @option attributes [DateTime] :time_started The value to assign to the {#time_started} property
108
+ # @option attributes [DateTime] :time_finished The value to assign to the {#time_finished} property
109
+ def initialize(attributes = {})
110
+ return unless attributes.is_a?(Hash)
111
+
112
+ # convert string to symbol for hash key
113
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
114
+
115
+ self.id = attributes[:'id'] if attributes[:'id']
116
+
117
+ self.operation_type = attributes[:'operationType'] if attributes[:'operationType']
118
+
119
+ raise 'You cannot provide both :operationType and :operation_type' if attributes.key?(:'operationType') && attributes.key?(:'operation_type')
120
+
121
+ self.operation_type = attributes[:'operation_type'] if attributes[:'operation_type']
122
+
123
+ self.status = attributes[:'status'] if attributes[:'status']
124
+
125
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
126
+
127
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
128
+
129
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
130
+
131
+ self.resources = attributes[:'resources'] if attributes[:'resources']
132
+
133
+ self.time_accepted = attributes[:'timeAccepted'] if attributes[:'timeAccepted']
134
+
135
+ raise 'You cannot provide both :timeAccepted and :time_accepted' if attributes.key?(:'timeAccepted') && attributes.key?(:'time_accepted')
136
+
137
+ self.time_accepted = attributes[:'time_accepted'] if attributes[:'time_accepted']
138
+
139
+ self.time_started = attributes[:'timeStarted'] if attributes[:'timeStarted']
140
+
141
+ raise 'You cannot provide both :timeStarted and :time_started' if attributes.key?(:'timeStarted') && attributes.key?(:'time_started')
142
+
143
+ self.time_started = attributes[:'time_started'] if attributes[:'time_started']
144
+
145
+ self.time_finished = attributes[:'timeFinished'] if attributes[:'timeFinished']
146
+
147
+ raise 'You cannot provide both :timeFinished and :time_finished' if attributes.key?(:'timeFinished') && attributes.key?(:'time_finished')
148
+
149
+ self.time_finished = attributes[:'time_finished'] if attributes[:'time_finished']
150
+ end
151
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
152
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
153
+
154
+ # Custom attribute writer method checking allowed values (enum).
155
+ # @param [Object] operation_type Object to be assigned
156
+ def operation_type=(operation_type)
157
+ # rubocop:disable Style/ConditionalAssignment
158
+ if operation_type && !OPERATION_TYPE_ENUM.include?(operation_type)
159
+ # rubocop: disable Metrics/LineLength
160
+ OCI.logger.debug("Unknown value for 'operation_type' [" + operation_type + "]. Mapping to 'OPERATION_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
161
+ # rubocop: enable Metrics/LineLength
162
+ @operation_type = OPERATION_TYPE_UNKNOWN_ENUM_VALUE
163
+ else
164
+ @operation_type = operation_type
165
+ end
166
+ # rubocop:enable Style/ConditionalAssignment
167
+ end
168
+
169
+ # Custom attribute writer method checking allowed values (enum).
170
+ # @param [Object] status Object to be assigned
171
+ def status=(status)
172
+ # rubocop:disable Style/ConditionalAssignment
173
+ if status && !STATUS_ENUM.include?(status)
174
+ # rubocop: disable Metrics/LineLength
175
+ OCI.logger.debug("Unknown value for 'status' [" + status + "]. Mapping to 'STATUS_UNKNOWN_ENUM_VALUE'") if OCI.logger
176
+ # rubocop: enable Metrics/LineLength
177
+ @status = STATUS_UNKNOWN_ENUM_VALUE
178
+ else
179
+ @status = status
180
+ end
181
+ # rubocop:enable Style/ConditionalAssignment
182
+ end
183
+
184
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
185
+
186
+
187
+ # Checks equality by comparing each attribute.
188
+ # @param [Object] other the other object to be compared
189
+ def ==(other)
190
+ return true if equal?(other)
191
+ self.class == other.class &&
192
+ id == other.id &&
193
+ operation_type == other.operation_type &&
194
+ status == other.status &&
195
+ compartment_id == other.compartment_id &&
196
+ resources == other.resources &&
197
+ time_accepted == other.time_accepted &&
198
+ time_started == other.time_started &&
199
+ time_finished == other.time_finished
200
+ end
201
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
202
+
203
+ # @see the `==` method
204
+ # @param [Object] other the other object to be compared
205
+ def eql?(other)
206
+ self == other
207
+ end
208
+
209
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
210
+
211
+
212
+ # Calculates hash code according to all attributes.
213
+ # @return [Fixnum] Hash code
214
+ def hash
215
+ [id, operation_type, status, compartment_id, resources, time_accepted, time_started, time_finished].hash
216
+ end
217
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
218
+
219
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
220
+
221
+
222
+ # Builds the object from hash
223
+ # @param [Hash] attributes Model attributes in the form of hash
224
+ # @return [Object] Returns the model itself
225
+ def build_from_hash(attributes)
226
+ return nil unless attributes.is_a?(Hash)
227
+ self.class.swagger_types.each_pair do |key, type|
228
+ if type =~ /^Array<(.*)>/i
229
+ # check to ensure the input is an array given that the the attribute
230
+ # is documented as an array but the input is not
231
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
232
+ public_method("#{key}=").call(
233
+ attributes[self.class.attribute_map[key]]
234
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
235
+ )
236
+ end
237
+ elsif !attributes[self.class.attribute_map[key]].nil?
238
+ public_method("#{key}=").call(
239
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
240
+ )
241
+ end
242
+ # or else data not found in attributes(hash), not an issue as the data can be optional
243
+ end
244
+
245
+ self
246
+ end
247
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
248
+
249
+ # Returns the string representation of the object
250
+ # @return [String] String presentation of the object
251
+ def to_s
252
+ to_hash.to_s
253
+ end
254
+
255
+ # Returns the object in the form of hash
256
+ # @return [Hash] Returns the object in the form of hash
257
+ def to_hash
258
+ hash = {}
259
+ self.class.attribute_map.each_pair do |attr, param|
260
+ value = public_method(attr).call
261
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
262
+ hash[param] = _to_hash(value)
263
+ end
264
+ hash
265
+ end
266
+
267
+ private
268
+
269
+ # Outputs non-array value in the form of hash
270
+ # For object, use to_hash. Otherwise, just return the value
271
+ # @param [Object] value Any valid value
272
+ # @return [Hash] Returns the value in the form of hash
273
+ def _to_hash(value)
274
+ if value.is_a?(Array)
275
+ value.compact.map { |v| _to_hash(v) }
276
+ elsif value.is_a?(Hash)
277
+ {}.tap do |hash|
278
+ value.each { |k, v| hash[k] = _to_hash(v) }
279
+ end
280
+ elsif value.respond_to? :to_hash
281
+ value.to_hash
282
+ else
283
+ value
284
+ end
285
+ end
286
+ end
287
+ end
288
+ # rubocop:enable Lint/UnneededCopDisableDirective