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,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
+ # The properties that define a cluster summary.
9
+ class ContainerEngine::Models::ClusterSummary # 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,198 @@
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 create a cluster.
8
+ class ContainerEngine::Models::CreateClusterDetails # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The name of the cluster. Avoid entering confidential information.
10
+ # @return [String]
11
+ attr_accessor :name
12
+
13
+ # **[Required]** The OCID of the compartment in which to create the cluster.
14
+ # @return [String]
15
+ attr_accessor :compartment_id
16
+
17
+ # **[Required]** The OCID of the virtual cloud network (VCN) in which to create the cluster.
18
+ # @return [String]
19
+ attr_accessor :vcn_id
20
+
21
+ # **[Required]** The version of Kubernetes to install into the cluster masters.
22
+ # @return [String]
23
+ attr_accessor :kubernetes_version
24
+
25
+ # Optional attributes for the cluster.
26
+ # @return [OCI::ContainerEngine::Models::ClusterCreateOptions]
27
+ attr_accessor :options
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
+ 'compartment_id': :'compartmentId',
35
+ 'vcn_id': :'vcnId',
36
+ 'kubernetes_version': :'kubernetesVersion',
37
+ 'options': :'options'
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
+ 'compartment_id': :'String',
48
+ 'vcn_id': :'String',
49
+ 'kubernetes_version': :'String',
50
+ 'options': :'OCI::ContainerEngine::Models::ClusterCreateOptions'
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] :compartment_id The value to assign to the {#compartment_id} property
63
+ # @option attributes [String] :vcn_id The value to assign to the {#vcn_id} property
64
+ # @option attributes [String] :kubernetes_version The value to assign to the {#kubernetes_version} property
65
+ # @option attributes [OCI::ContainerEngine::Models::ClusterCreateOptions] :options The value to assign to the {#options} 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.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
75
+
76
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
77
+
78
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
79
+
80
+ self.vcn_id = attributes[:'vcnId'] if attributes[:'vcnId']
81
+
82
+ raise 'You cannot provide both :vcnId and :vcn_id' if attributes.key?(:'vcnId') && attributes.key?(:'vcn_id')
83
+
84
+ self.vcn_id = attributes[:'vcn_id'] if attributes[:'vcn_id']
85
+
86
+ self.kubernetes_version = attributes[:'kubernetesVersion'] if attributes[:'kubernetesVersion']
87
+
88
+ raise 'You cannot provide both :kubernetesVersion and :kubernetes_version' if attributes.key?(:'kubernetesVersion') && attributes.key?(:'kubernetes_version')
89
+
90
+ self.kubernetes_version = attributes[:'kubernetes_version'] if attributes[:'kubernetes_version']
91
+
92
+ self.options = attributes[:'options'] if attributes[:'options']
93
+ end
94
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
95
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
96
+
97
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
98
+
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] other the other object to be compared
102
+ def ==(other)
103
+ return true if equal?(other)
104
+ self.class == other.class &&
105
+ name == other.name &&
106
+ compartment_id == other.compartment_id &&
107
+ vcn_id == other.vcn_id &&
108
+ kubernetes_version == other.kubernetes_version &&
109
+ options == other.options
110
+ end
111
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
112
+
113
+ # @see the `==` method
114
+ # @param [Object] other the other object to be compared
115
+ def eql?(other)
116
+ self == other
117
+ end
118
+
119
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
120
+
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Fixnum] Hash code
124
+ def hash
125
+ [name, compartment_id, vcn_id, kubernetes_version, options].hash
126
+ end
127
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
128
+
129
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
130
+
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.swagger_types.each_pair do |key, type|
138
+ if type =~ /^Array<(.*)>/i
139
+ # check to ensure the input is an array given that the the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ public_method("#{key}=").call(
143
+ attributes[self.class.attribute_map[key]]
144
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
145
+ )
146
+ end
147
+ elsif !attributes[self.class.attribute_map[key]].nil?
148
+ public_method("#{key}=").call(
149
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
150
+ )
151
+ end
152
+ # or else data not found in attributes(hash), not an issue as the data can be optional
153
+ end
154
+
155
+ self
156
+ end
157
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
158
+
159
+ # Returns the string representation of the object
160
+ # @return [String] String presentation of the object
161
+ def to_s
162
+ to_hash.to_s
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = public_method(attr).call
171
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ private
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map { |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+ end
197
+ end
198
+ # rubocop:enable Lint/UnneededCopDisableDirective