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,162 @@
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 kubeconfig.
8
+ class ContainerEngine::Models::CreateClusterKubeconfigContentDetails # rubocop:disable Metrics/LineLength
9
+ # The version of the kubeconfig token.
10
+ # @return [String]
11
+ attr_accessor :token_version
12
+
13
+ # The desired expiration, in seconds, to use for the kubeconfig token.
14
+ # @return [Integer]
15
+ attr_accessor :expiration
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ # rubocop:disable Style/SymbolLiteral
21
+ 'token_version': :'tokenVersion',
22
+ 'expiration': :'expiration'
23
+ # rubocop:enable Style/SymbolLiteral
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ # rubocop:disable Style/SymbolLiteral
31
+ 'token_version': :'String',
32
+ 'expiration': :'Integer'
33
+ # rubocop:enable Style/SymbolLiteral
34
+ }
35
+ end
36
+
37
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
38
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
39
+
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ # @option attributes [String] :token_version The value to assign to the {#token_version} property
44
+ # @option attributes [Integer] :expiration The value to assign to the {#expiration} property
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
50
+
51
+ self.token_version = attributes[:'tokenVersion'] if attributes[:'tokenVersion']
52
+ self.token_version = "1.0.0" if token_version.nil? && !attributes.key?(:'tokenVersion') # rubocop:disable Style/StringLiterals
53
+
54
+ raise 'You cannot provide both :tokenVersion and :token_version' if attributes.key?(:'tokenVersion') && attributes.key?(:'token_version')
55
+
56
+ self.token_version = attributes[:'token_version'] if attributes[:'token_version']
57
+ self.token_version = "1.0.0" if token_version.nil? && !attributes.key?(:'tokenVersion') && !attributes.key?(:'token_version') # rubocop:disable Style/StringLiterals
58
+
59
+ self.expiration = attributes[:'expiration'] if attributes[:'expiration']
60
+ end
61
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
62
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
63
+
64
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
65
+
66
+
67
+ # Checks equality by comparing each attribute.
68
+ # @param [Object] other the other object to be compared
69
+ def ==(other)
70
+ return true if equal?(other)
71
+ self.class == other.class &&
72
+ token_version == other.token_version &&
73
+ expiration == other.expiration
74
+ end
75
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
76
+
77
+ # @see the `==` method
78
+ # @param [Object] other the other object to be compared
79
+ def eql?(other)
80
+ self == other
81
+ end
82
+
83
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
84
+
85
+
86
+ # Calculates hash code according to all attributes.
87
+ # @return [Fixnum] Hash code
88
+ def hash
89
+ [token_version, expiration].hash
90
+ end
91
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
92
+
93
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
94
+
95
+
96
+ # Builds the object from hash
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ # @return [Object] Returns the model itself
99
+ def build_from_hash(attributes)
100
+ return nil unless attributes.is_a?(Hash)
101
+ self.class.swagger_types.each_pair do |key, type|
102
+ if type =~ /^Array<(.*)>/i
103
+ # check to ensure the input is an array given that the the attribute
104
+ # is documented as an array but the input is not
105
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
106
+ public_method("#{key}=").call(
107
+ attributes[self.class.attribute_map[key]]
108
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
109
+ )
110
+ end
111
+ elsif !attributes[self.class.attribute_map[key]].nil?
112
+ public_method("#{key}=").call(
113
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
114
+ )
115
+ end
116
+ # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
122
+
123
+ # Returns the string representation of the object
124
+ # @return [String] String presentation of the object
125
+ def to_s
126
+ to_hash.to_s
127
+ end
128
+
129
+ # Returns the object in the form of hash
130
+ # @return [Hash] Returns the object in the form of hash
131
+ def to_hash
132
+ hash = {}
133
+ self.class.attribute_map.each_pair do |attr, param|
134
+ value = public_method(attr).call
135
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
136
+ hash[param] = _to_hash(value)
137
+ end
138
+ hash
139
+ end
140
+
141
+ private
142
+
143
+ # Outputs non-array value in the form of hash
144
+ # For object, use to_hash. Otherwise, just return the value
145
+ # @param [Object] value Any valid value
146
+ # @return [Hash] Returns the value in the form of hash
147
+ def _to_hash(value)
148
+ if value.is_a?(Array)
149
+ value.compact.map { |v| _to_hash(v) }
150
+ elsif value.is_a?(Hash)
151
+ {}.tap do |hash|
152
+ value.each { |k, v| hash[k] = _to_hash(v) }
153
+ end
154
+ elsif value.respond_to? :to_hash
155
+ value.to_hash
156
+ else
157
+ value
158
+ end
159
+ end
160
+ end
161
+ end
162
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,272 @@
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 node pool.
8
+ class ContainerEngine::Models::CreateNodePoolDetails # rubocop:disable Metrics/LineLength
9
+ # **[Required]** The OCID of the compartment in which the node pool exists.
10
+ # @return [String]
11
+ attr_accessor :compartment_id
12
+
13
+ # **[Required]** The OCID of the cluster to which this node pool is attached.
14
+ # @return [String]
15
+ attr_accessor :cluster_id
16
+
17
+ # **[Required]** The name of the node pool. Avoid entering confidential information.
18
+ # @return [String]
19
+ attr_accessor :name
20
+
21
+ # **[Required]** The version of Kubernetes to install on the nodes in the node pool.
22
+ # @return [String]
23
+ attr_accessor :kubernetes_version
24
+
25
+ # **[Required]** The name of the image running on the nodes in the node pool.
26
+ # @return [String]
27
+ attr_accessor :node_image_name
28
+
29
+ # **[Required]** The name of the node shape of the nodes in the node pool.
30
+ # @return [String]
31
+ attr_accessor :node_shape
32
+
33
+ # A list of key/value pairs to add to nodes after they join the Kubernetes cluster.
34
+ # @return [Array<OCI::ContainerEngine::Models::KeyValue>]
35
+ attr_accessor :initial_node_labels
36
+
37
+ # The SSH public key to add to each node in the node pool.
38
+ # @return [String]
39
+ attr_accessor :ssh_public_key
40
+
41
+ # The number of nodes to create in each subnet.
42
+ # @return [Integer]
43
+ attr_accessor :quantity_per_subnet
44
+
45
+ # **[Required]** The OCIDs of the subnets in which to place nodes for this node pool.
46
+ # @return [Array<String>]
47
+ attr_accessor :subnet_ids
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ # rubocop:disable Style/SymbolLiteral
53
+ 'compartment_id': :'compartmentId',
54
+ 'cluster_id': :'clusterId',
55
+ 'name': :'name',
56
+ 'kubernetes_version': :'kubernetesVersion',
57
+ 'node_image_name': :'nodeImageName',
58
+ 'node_shape': :'nodeShape',
59
+ 'initial_node_labels': :'initialNodeLabels',
60
+ 'ssh_public_key': :'sshPublicKey',
61
+ 'quantity_per_subnet': :'quantityPerSubnet',
62
+ 'subnet_ids': :'subnetIds'
63
+ # rubocop:enable Style/SymbolLiteral
64
+ }
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.swagger_types
69
+ {
70
+ # rubocop:disable Style/SymbolLiteral
71
+ 'compartment_id': :'String',
72
+ 'cluster_id': :'String',
73
+ 'name': :'String',
74
+ 'kubernetes_version': :'String',
75
+ 'node_image_name': :'String',
76
+ 'node_shape': :'String',
77
+ 'initial_node_labels': :'Array<OCI::ContainerEngine::Models::KeyValue>',
78
+ 'ssh_public_key': :'String',
79
+ 'quantity_per_subnet': :'Integer',
80
+ 'subnet_ids': :'Array<String>'
81
+ # rubocop:enable Style/SymbolLiteral
82
+ }
83
+ end
84
+
85
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
86
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
87
+
88
+
89
+ # Initializes the object
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
92
+ # @option attributes [String] :cluster_id The value to assign to the {#cluster_id} property
93
+ # @option attributes [String] :name The value to assign to the {#name} property
94
+ # @option attributes [String] :kubernetes_version The value to assign to the {#kubernetes_version} property
95
+ # @option attributes [String] :node_image_name The value to assign to the {#node_image_name} property
96
+ # @option attributes [String] :node_shape The value to assign to the {#node_shape} property
97
+ # @option attributes [Array<OCI::ContainerEngine::Models::KeyValue>] :initial_node_labels The value to assign to the {#initial_node_labels} property
98
+ # @option attributes [String] :ssh_public_key The value to assign to the {#ssh_public_key} property
99
+ # @option attributes [Integer] :quantity_per_subnet The value to assign to the {#quantity_per_subnet} property
100
+ # @option attributes [Array<String>] :subnet_ids The value to assign to the {#subnet_ids} property
101
+ def initialize(attributes = {})
102
+ return unless attributes.is_a?(Hash)
103
+
104
+ # convert string to symbol for hash key
105
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
106
+
107
+ self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
108
+
109
+ raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
110
+
111
+ self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id']
112
+
113
+ self.cluster_id = attributes[:'clusterId'] if attributes[:'clusterId']
114
+
115
+ raise 'You cannot provide both :clusterId and :cluster_id' if attributes.key?(:'clusterId') && attributes.key?(:'cluster_id')
116
+
117
+ self.cluster_id = attributes[:'cluster_id'] if attributes[:'cluster_id']
118
+
119
+ self.name = attributes[:'name'] if attributes[:'name']
120
+
121
+ self.kubernetes_version = attributes[:'kubernetesVersion'] if attributes[:'kubernetesVersion']
122
+
123
+ raise 'You cannot provide both :kubernetesVersion and :kubernetes_version' if attributes.key?(:'kubernetesVersion') && attributes.key?(:'kubernetes_version')
124
+
125
+ self.kubernetes_version = attributes[:'kubernetes_version'] if attributes[:'kubernetes_version']
126
+
127
+ self.node_image_name = attributes[:'nodeImageName'] if attributes[:'nodeImageName']
128
+
129
+ raise 'You cannot provide both :nodeImageName and :node_image_name' if attributes.key?(:'nodeImageName') && attributes.key?(:'node_image_name')
130
+
131
+ self.node_image_name = attributes[:'node_image_name'] if attributes[:'node_image_name']
132
+
133
+ self.node_shape = attributes[:'nodeShape'] if attributes[:'nodeShape']
134
+
135
+ raise 'You cannot provide both :nodeShape and :node_shape' if attributes.key?(:'nodeShape') && attributes.key?(:'node_shape')
136
+
137
+ self.node_shape = attributes[:'node_shape'] if attributes[:'node_shape']
138
+
139
+ self.initial_node_labels = attributes[:'initialNodeLabels'] if attributes[:'initialNodeLabels']
140
+
141
+ raise 'You cannot provide both :initialNodeLabels and :initial_node_labels' if attributes.key?(:'initialNodeLabels') && attributes.key?(:'initial_node_labels')
142
+
143
+ self.initial_node_labels = attributes[:'initial_node_labels'] if attributes[:'initial_node_labels']
144
+
145
+ self.ssh_public_key = attributes[:'sshPublicKey'] if attributes[:'sshPublicKey']
146
+
147
+ raise 'You cannot provide both :sshPublicKey and :ssh_public_key' if attributes.key?(:'sshPublicKey') && attributes.key?(:'ssh_public_key')
148
+
149
+ self.ssh_public_key = attributes[:'ssh_public_key'] if attributes[:'ssh_public_key']
150
+
151
+ self.quantity_per_subnet = attributes[:'quantityPerSubnet'] if attributes[:'quantityPerSubnet']
152
+
153
+ raise 'You cannot provide both :quantityPerSubnet and :quantity_per_subnet' if attributes.key?(:'quantityPerSubnet') && attributes.key?(:'quantity_per_subnet')
154
+
155
+ self.quantity_per_subnet = attributes[:'quantity_per_subnet'] if attributes[:'quantity_per_subnet']
156
+
157
+ self.subnet_ids = attributes[:'subnetIds'] if attributes[:'subnetIds']
158
+
159
+ raise 'You cannot provide both :subnetIds and :subnet_ids' if attributes.key?(:'subnetIds') && attributes.key?(:'subnet_ids')
160
+
161
+ self.subnet_ids = attributes[:'subnet_ids'] if attributes[:'subnet_ids']
162
+ end
163
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
164
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
165
+
166
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
167
+
168
+
169
+ # Checks equality by comparing each attribute.
170
+ # @param [Object] other the other object to be compared
171
+ def ==(other)
172
+ return true if equal?(other)
173
+ self.class == other.class &&
174
+ compartment_id == other.compartment_id &&
175
+ cluster_id == other.cluster_id &&
176
+ name == other.name &&
177
+ kubernetes_version == other.kubernetes_version &&
178
+ node_image_name == other.node_image_name &&
179
+ node_shape == other.node_shape &&
180
+ initial_node_labels == other.initial_node_labels &&
181
+ ssh_public_key == other.ssh_public_key &&
182
+ quantity_per_subnet == other.quantity_per_subnet &&
183
+ subnet_ids == other.subnet_ids
184
+ end
185
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
186
+
187
+ # @see the `==` method
188
+ # @param [Object] other the other object to be compared
189
+ def eql?(other)
190
+ self == other
191
+ end
192
+
193
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
194
+
195
+
196
+ # Calculates hash code according to all attributes.
197
+ # @return [Fixnum] Hash code
198
+ def hash
199
+ [compartment_id, cluster_id, name, kubernetes_version, node_image_name, node_shape, initial_node_labels, ssh_public_key, quantity_per_subnet, subnet_ids].hash
200
+ end
201
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
202
+
203
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
204
+
205
+
206
+ # Builds the object from hash
207
+ # @param [Hash] attributes Model attributes in the form of hash
208
+ # @return [Object] Returns the model itself
209
+ def build_from_hash(attributes)
210
+ return nil unless attributes.is_a?(Hash)
211
+ self.class.swagger_types.each_pair do |key, type|
212
+ if type =~ /^Array<(.*)>/i
213
+ # check to ensure the input is an array given that the the attribute
214
+ # is documented as an array but the input is not
215
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
216
+ public_method("#{key}=").call(
217
+ attributes[self.class.attribute_map[key]]
218
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
219
+ )
220
+ end
221
+ elsif !attributes[self.class.attribute_map[key]].nil?
222
+ public_method("#{key}=").call(
223
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
224
+ )
225
+ end
226
+ # or else data not found in attributes(hash), not an issue as the data can be optional
227
+ end
228
+
229
+ self
230
+ end
231
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
232
+
233
+ # Returns the string representation of the object
234
+ # @return [String] String presentation of the object
235
+ def to_s
236
+ to_hash.to_s
237
+ end
238
+
239
+ # Returns the object in the form of hash
240
+ # @return [Hash] Returns the object in the form of hash
241
+ def to_hash
242
+ hash = {}
243
+ self.class.attribute_map.each_pair do |attr, param|
244
+ value = public_method(attr).call
245
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
246
+ hash[param] = _to_hash(value)
247
+ end
248
+ hash
249
+ end
250
+
251
+ private
252
+
253
+ # Outputs non-array value in the form of hash
254
+ # For object, use to_hash. Otherwise, just return the value
255
+ # @param [Object] value Any valid value
256
+ # @return [Hash] Returns the value in the form of hash
257
+ def _to_hash(value)
258
+ if value.is_a?(Array)
259
+ value.compact.map { |v| _to_hash(v) }
260
+ elsif value.is_a?(Hash)
261
+ {}.tap do |hash|
262
+ value.each { |k, v| hash[k] = _to_hash(v) }
263
+ end
264
+ elsif value.respond_to? :to_hash
265
+ value.to_hash
266
+ else
267
+ value
268
+ end
269
+ end
270
+ end
271
+ end
272
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,156 @@
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 key value pair.
8
+ class ContainerEngine::Models::KeyValue # rubocop:disable Metrics/LineLength
9
+ # The key of the pair.
10
+ # @return [String]
11
+ attr_accessor :key
12
+
13
+ # The value of the pair.
14
+ # @return [String]
15
+ attr_accessor :value
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ # rubocop:disable Style/SymbolLiteral
21
+ 'key': :'key',
22
+ 'value': :'value'
23
+ # rubocop:enable Style/SymbolLiteral
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ # rubocop:disable Style/SymbolLiteral
31
+ 'key': :'String',
32
+ 'value': :'String'
33
+ # rubocop:enable Style/SymbolLiteral
34
+ }
35
+ end
36
+
37
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
38
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
39
+
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ # @option attributes [String] :key The value to assign to the {#key} property
44
+ # @option attributes [String] :value The value to assign to the {#value} property
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
50
+
51
+ self.key = attributes[:'key'] if attributes[:'key']
52
+
53
+ self.value = attributes[:'value'] if attributes[:'value']
54
+ end
55
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
56
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
57
+
58
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
59
+
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] other the other object to be compared
63
+ def ==(other)
64
+ return true if equal?(other)
65
+ self.class == other.class &&
66
+ key == other.key &&
67
+ value == other.value
68
+ end
69
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
70
+
71
+ # @see the `==` method
72
+ # @param [Object] other the other object to be compared
73
+ def eql?(other)
74
+ self == other
75
+ end
76
+
77
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
78
+
79
+
80
+ # Calculates hash code according to all attributes.
81
+ # @return [Fixnum] Hash code
82
+ def hash
83
+ [key, value].hash
84
+ end
85
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
86
+
87
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
88
+
89
+
90
+ # Builds the object from hash
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ # @return [Object] Returns the model itself
93
+ def build_from_hash(attributes)
94
+ return nil unless attributes.is_a?(Hash)
95
+ self.class.swagger_types.each_pair do |key, type|
96
+ if type =~ /^Array<(.*)>/i
97
+ # check to ensure the input is an array given that the the attribute
98
+ # is documented as an array but the input is not
99
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
100
+ public_method("#{key}=").call(
101
+ attributes[self.class.attribute_map[key]]
102
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
103
+ )
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ public_method("#{key}=").call(
107
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
108
+ )
109
+ end
110
+ # or else data not found in attributes(hash), not an issue as the data can be optional
111
+ end
112
+
113
+ self
114
+ end
115
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
116
+
117
+ # Returns the string representation of the object
118
+ # @return [String] String presentation of the object
119
+ def to_s
120
+ to_hash.to_s
121
+ end
122
+
123
+ # Returns the object in the form of hash
124
+ # @return [Hash] Returns the object in the form of hash
125
+ def to_hash
126
+ hash = {}
127
+ self.class.attribute_map.each_pair do |attr, param|
128
+ value = public_method(attr).call
129
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
130
+ hash[param] = _to_hash(value)
131
+ end
132
+ hash
133
+ end
134
+
135
+ private
136
+
137
+ # Outputs non-array value in the form of hash
138
+ # For object, use to_hash. Otherwise, just return the value
139
+ # @param [Object] value Any valid value
140
+ # @return [Hash] Returns the value in the form of hash
141
+ def _to_hash(value)
142
+ if value.is_a?(Array)
143
+ value.compact.map { |v| _to_hash(v) }
144
+ elsif value.is_a?(Hash)
145
+ {}.tap do |hash|
146
+ value.each { |k, v| hash[k] = _to_hash(v) }
147
+ end
148
+ elsif value.respond_to? :to_hash
149
+ value.to_hash
150
+ else
151
+ value
152
+ end
153
+ end
154
+ end
155
+ end
156
+ # rubocop:enable Lint/UnneededCopDisableDirective