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,146 @@
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 endpoints for a cluster.
8
+ class ContainerEngine::Models::ClusterEndpoints # rubocop:disable Metrics/LineLength
9
+ # The Kubernetes API server endpoint.
10
+ # @return [String]
11
+ attr_accessor :kubernetes
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ # rubocop:disable Style/SymbolLiteral
17
+ 'kubernetes': :'kubernetes'
18
+ # rubocop:enable Style/SymbolLiteral
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.swagger_types
24
+ {
25
+ # rubocop:disable Style/SymbolLiteral
26
+ 'kubernetes': :'String'
27
+ # rubocop:enable Style/SymbolLiteral
28
+ }
29
+ end
30
+
31
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
32
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
33
+
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ # @option attributes [String] :kubernetes The value to assign to the {#kubernetes} property
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
43
+
44
+ self.kubernetes = attributes[:'kubernetes'] if attributes[:'kubernetes']
45
+ end
46
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
47
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
48
+
49
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
50
+
51
+
52
+ # Checks equality by comparing each attribute.
53
+ # @param [Object] other the other object to be compared
54
+ def ==(other)
55
+ return true if equal?(other)
56
+ self.class == other.class &&
57
+ kubernetes == other.kubernetes
58
+ end
59
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
60
+
61
+ # @see the `==` method
62
+ # @param [Object] other the other object to be compared
63
+ def eql?(other)
64
+ self == other
65
+ end
66
+
67
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
68
+
69
+
70
+ # Calculates hash code according to all attributes.
71
+ # @return [Fixnum] Hash code
72
+ def hash
73
+ [kubernetes].hash
74
+ end
75
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
76
+
77
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
78
+
79
+
80
+ # Builds the object from hash
81
+ # @param [Hash] attributes Model attributes in the form of hash
82
+ # @return [Object] Returns the model itself
83
+ def build_from_hash(attributes)
84
+ return nil unless attributes.is_a?(Hash)
85
+ self.class.swagger_types.each_pair do |key, type|
86
+ if type =~ /^Array<(.*)>/i
87
+ # check to ensure the input is an array given that the the attribute
88
+ # is documented as an array but the input is not
89
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
90
+ public_method("#{key}=").call(
91
+ attributes[self.class.attribute_map[key]]
92
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
93
+ )
94
+ end
95
+ elsif !attributes[self.class.attribute_map[key]].nil?
96
+ public_method("#{key}=").call(
97
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
98
+ )
99
+ end
100
+ # or else data not found in attributes(hash), not an issue as the data can be optional
101
+ end
102
+
103
+ self
104
+ end
105
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
106
+
107
+ # Returns the string representation of the object
108
+ # @return [String] String presentation of the object
109
+ def to_s
110
+ to_hash.to_s
111
+ end
112
+
113
+ # Returns the object in the form of hash
114
+ # @return [Hash] Returns the object in the form of hash
115
+ def to_hash
116
+ hash = {}
117
+ self.class.attribute_map.each_pair do |attr, param|
118
+ value = public_method(attr).call
119
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
120
+ hash[param] = _to_hash(value)
121
+ end
122
+ hash
123
+ end
124
+
125
+ private
126
+
127
+ # Outputs non-array value in the form of hash
128
+ # For object, use to_hash. Otherwise, just return the value
129
+ # @param [Object] value Any valid value
130
+ # @return [Hash] Returns the value in the form of hash
131
+ def _to_hash(value)
132
+ if value.is_a?(Array)
133
+ value.compact.map { |v| _to_hash(v) }
134
+ elsif value.is_a?(Hash)
135
+ {}.tap do |hash|
136
+ value.each { |k, v| hash[k] = _to_hash(v) }
137
+ end
138
+ elsif value.respond_to? :to_hash
139
+ value.to_hash
140
+ else
141
+ value
142
+ end
143
+ end
144
+ end
145
+ end
146
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,14 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ module OCI
4
+ module ContainerEngine::Models
5
+ CLUSTER_LIFECYCLE_STATE_ENUM = [
6
+ CLUSTER_LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
7
+ CLUSTER_LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
8
+ CLUSTER_LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
9
+ CLUSTER_LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
10
+ CLUSTER_LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
11
+ CLUSTER_LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze
12
+ ].freeze
13
+ end
14
+ end
@@ -0,0 +1,262 @@
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 meta data for a cluster.
8
+ class ContainerEngine::Models::ClusterMetadata # rubocop:disable Metrics/LineLength
9
+ # The time the cluster was created.
10
+ # @return [DateTime]
11
+ attr_accessor :time_created
12
+
13
+ # The user who created the cluster.
14
+ # @return [String]
15
+ attr_accessor :created_by_user_id
16
+
17
+ # The OCID of the work request which created the cluster.
18
+ # @return [String]
19
+ attr_accessor :created_by_work_request_id
20
+
21
+ # The time the cluster was deleted.
22
+ # @return [DateTime]
23
+ attr_accessor :time_deleted
24
+
25
+ # The user who deleted the cluster.
26
+ # @return [String]
27
+ attr_accessor :deleted_by_user_id
28
+
29
+ # The OCID of the work request which deleted the cluster.
30
+ # @return [String]
31
+ attr_accessor :deleted_by_work_request_id
32
+
33
+ # The time the cluster was updated.
34
+ # @return [DateTime]
35
+ attr_accessor :time_updated
36
+
37
+ # The user who updated the cluster.
38
+ # @return [String]
39
+ attr_accessor :updated_by_user_id
40
+
41
+ # The OCID of the work request which updated the cluster.
42
+ # @return [String]
43
+ attr_accessor :updated_by_work_request_id
44
+
45
+ # Attribute mapping from ruby-style variable name to JSON key.
46
+ def self.attribute_map
47
+ {
48
+ # rubocop:disable Style/SymbolLiteral
49
+ 'time_created': :'timeCreated',
50
+ 'created_by_user_id': :'createdByUserId',
51
+ 'created_by_work_request_id': :'createdByWorkRequestId',
52
+ 'time_deleted': :'timeDeleted',
53
+ 'deleted_by_user_id': :'deletedByUserId',
54
+ 'deleted_by_work_request_id': :'deletedByWorkRequestId',
55
+ 'time_updated': :'timeUpdated',
56
+ 'updated_by_user_id': :'updatedByUserId',
57
+ 'updated_by_work_request_id': :'updatedByWorkRequestId'
58
+ # rubocop:enable Style/SymbolLiteral
59
+ }
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.swagger_types
64
+ {
65
+ # rubocop:disable Style/SymbolLiteral
66
+ 'time_created': :'DateTime',
67
+ 'created_by_user_id': :'String',
68
+ 'created_by_work_request_id': :'String',
69
+ 'time_deleted': :'DateTime',
70
+ 'deleted_by_user_id': :'String',
71
+ 'deleted_by_work_request_id': :'String',
72
+ 'time_updated': :'DateTime',
73
+ 'updated_by_user_id': :'String',
74
+ 'updated_by_work_request_id': :'String'
75
+ # rubocop:enable Style/SymbolLiteral
76
+ }
77
+ end
78
+
79
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
80
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
81
+
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
86
+ # @option attributes [String] :created_by_user_id The value to assign to the {#created_by_user_id} property
87
+ # @option attributes [String] :created_by_work_request_id The value to assign to the {#created_by_work_request_id} property
88
+ # @option attributes [DateTime] :time_deleted The value to assign to the {#time_deleted} property
89
+ # @option attributes [String] :deleted_by_user_id The value to assign to the {#deleted_by_user_id} property
90
+ # @option attributes [String] :deleted_by_work_request_id The value to assign to the {#deleted_by_work_request_id} property
91
+ # @option attributes [DateTime] :time_updated The value to assign to the {#time_updated} property
92
+ # @option attributes [String] :updated_by_user_id The value to assign to the {#updated_by_user_id} property
93
+ # @option attributes [String] :updated_by_work_request_id The value to assign to the {#updated_by_work_request_id} property
94
+ def initialize(attributes = {})
95
+ return unless attributes.is_a?(Hash)
96
+
97
+ # convert string to symbol for hash key
98
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
99
+
100
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
101
+
102
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
103
+
104
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
105
+
106
+ self.created_by_user_id = attributes[:'createdByUserId'] if attributes[:'createdByUserId']
107
+
108
+ raise 'You cannot provide both :createdByUserId and :created_by_user_id' if attributes.key?(:'createdByUserId') && attributes.key?(:'created_by_user_id')
109
+
110
+ self.created_by_user_id = attributes[:'created_by_user_id'] if attributes[:'created_by_user_id']
111
+
112
+ self.created_by_work_request_id = attributes[:'createdByWorkRequestId'] if attributes[:'createdByWorkRequestId']
113
+
114
+ raise 'You cannot provide both :createdByWorkRequestId and :created_by_work_request_id' if attributes.key?(:'createdByWorkRequestId') && attributes.key?(:'created_by_work_request_id')
115
+
116
+ self.created_by_work_request_id = attributes[:'created_by_work_request_id'] if attributes[:'created_by_work_request_id']
117
+
118
+ self.time_deleted = attributes[:'timeDeleted'] if attributes[:'timeDeleted']
119
+
120
+ raise 'You cannot provide both :timeDeleted and :time_deleted' if attributes.key?(:'timeDeleted') && attributes.key?(:'time_deleted')
121
+
122
+ self.time_deleted = attributes[:'time_deleted'] if attributes[:'time_deleted']
123
+
124
+ self.deleted_by_user_id = attributes[:'deletedByUserId'] if attributes[:'deletedByUserId']
125
+
126
+ raise 'You cannot provide both :deletedByUserId and :deleted_by_user_id' if attributes.key?(:'deletedByUserId') && attributes.key?(:'deleted_by_user_id')
127
+
128
+ self.deleted_by_user_id = attributes[:'deleted_by_user_id'] if attributes[:'deleted_by_user_id']
129
+
130
+ self.deleted_by_work_request_id = attributes[:'deletedByWorkRequestId'] if attributes[:'deletedByWorkRequestId']
131
+
132
+ raise 'You cannot provide both :deletedByWorkRequestId and :deleted_by_work_request_id' if attributes.key?(:'deletedByWorkRequestId') && attributes.key?(:'deleted_by_work_request_id')
133
+
134
+ self.deleted_by_work_request_id = attributes[:'deleted_by_work_request_id'] if attributes[:'deleted_by_work_request_id']
135
+
136
+ self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']
137
+
138
+ raise 'You cannot provide both :timeUpdated and :time_updated' if attributes.key?(:'timeUpdated') && attributes.key?(:'time_updated')
139
+
140
+ self.time_updated = attributes[:'time_updated'] if attributes[:'time_updated']
141
+
142
+ self.updated_by_user_id = attributes[:'updatedByUserId'] if attributes[:'updatedByUserId']
143
+
144
+ raise 'You cannot provide both :updatedByUserId and :updated_by_user_id' if attributes.key?(:'updatedByUserId') && attributes.key?(:'updated_by_user_id')
145
+
146
+ self.updated_by_user_id = attributes[:'updated_by_user_id'] if attributes[:'updated_by_user_id']
147
+
148
+ self.updated_by_work_request_id = attributes[:'updatedByWorkRequestId'] if attributes[:'updatedByWorkRequestId']
149
+
150
+ raise 'You cannot provide both :updatedByWorkRequestId and :updated_by_work_request_id' if attributes.key?(:'updatedByWorkRequestId') && attributes.key?(:'updated_by_work_request_id')
151
+
152
+ self.updated_by_work_request_id = attributes[:'updated_by_work_request_id'] if attributes[:'updated_by_work_request_id']
153
+ end
154
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
155
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
156
+
157
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
158
+
159
+
160
+ # Checks equality by comparing each attribute.
161
+ # @param [Object] other the other object to be compared
162
+ def ==(other)
163
+ return true if equal?(other)
164
+ self.class == other.class &&
165
+ time_created == other.time_created &&
166
+ created_by_user_id == other.created_by_user_id &&
167
+ created_by_work_request_id == other.created_by_work_request_id &&
168
+ time_deleted == other.time_deleted &&
169
+ deleted_by_user_id == other.deleted_by_user_id &&
170
+ deleted_by_work_request_id == other.deleted_by_work_request_id &&
171
+ time_updated == other.time_updated &&
172
+ updated_by_user_id == other.updated_by_user_id &&
173
+ updated_by_work_request_id == other.updated_by_work_request_id
174
+ end
175
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
176
+
177
+ # @see the `==` method
178
+ # @param [Object] other the other object to be compared
179
+ def eql?(other)
180
+ self == other
181
+ end
182
+
183
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
184
+
185
+
186
+ # Calculates hash code according to all attributes.
187
+ # @return [Fixnum] Hash code
188
+ def hash
189
+ [time_created, created_by_user_id, created_by_work_request_id, time_deleted, deleted_by_user_id, deleted_by_work_request_id, time_updated, updated_by_user_id, updated_by_work_request_id].hash
190
+ end
191
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
192
+
193
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
194
+
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def build_from_hash(attributes)
200
+ return nil unless attributes.is_a?(Hash)
201
+ self.class.swagger_types.each_pair do |key, type|
202
+ if type =~ /^Array<(.*)>/i
203
+ # check to ensure the input is an array given that the the attribute
204
+ # is documented as an array but the input is not
205
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
206
+ public_method("#{key}=").call(
207
+ attributes[self.class.attribute_map[key]]
208
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
209
+ )
210
+ end
211
+ elsif !attributes[self.class.attribute_map[key]].nil?
212
+ public_method("#{key}=").call(
213
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
214
+ )
215
+ end
216
+ # or else data not found in attributes(hash), not an issue as the data can be optional
217
+ end
218
+
219
+ self
220
+ end
221
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
222
+
223
+ # Returns the string representation of the object
224
+ # @return [String] String presentation of the object
225
+ def to_s
226
+ to_hash.to_s
227
+ end
228
+
229
+ # Returns the object in the form of hash
230
+ # @return [Hash] Returns the object in the form of hash
231
+ def to_hash
232
+ hash = {}
233
+ self.class.attribute_map.each_pair do |attr, param|
234
+ value = public_method(attr).call
235
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
236
+ hash[param] = _to_hash(value)
237
+ end
238
+ hash
239
+ end
240
+
241
+ private
242
+
243
+ # Outputs non-array value in the form of hash
244
+ # For object, use to_hash. Otherwise, just return the value
245
+ # @param [Object] value Any valid value
246
+ # @return [Hash] Returns the value in the form of hash
247
+ def _to_hash(value)
248
+ if value.is_a?(Array)
249
+ value.compact.map { |v| _to_hash(v) }
250
+ elsif value.is_a?(Hash)
251
+ {}.tap do |hash|
252
+ value.each { |k, v| hash[k] = _to_hash(v) }
253
+ end
254
+ elsif value.respond_to? :to_hash
255
+ value.to_hash
256
+ else
257
+ value
258
+ end
259
+ end
260
+ end
261
+ end
262
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -0,0 +1,150 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # Options for creating or updating clusters.
8
+ class ContainerEngine::Models::ClusterOptions # rubocop:disable Metrics/LineLength
9
+ # Available Kubernetes versions.
10
+ # @return [Array<String>]
11
+ attr_accessor :kubernetes_versions
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ # rubocop:disable Style/SymbolLiteral
17
+ 'kubernetes_versions': :'kubernetesVersions'
18
+ # rubocop:enable Style/SymbolLiteral
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.swagger_types
24
+ {
25
+ # rubocop:disable Style/SymbolLiteral
26
+ 'kubernetes_versions': :'Array<String>'
27
+ # rubocop:enable Style/SymbolLiteral
28
+ }
29
+ end
30
+
31
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
32
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
33
+
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ # @option attributes [Array<String>] :kubernetes_versions The value to assign to the {#kubernetes_versions} property
38
+ def initialize(attributes = {})
39
+ return unless attributes.is_a?(Hash)
40
+
41
+ # convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
43
+
44
+ self.kubernetes_versions = attributes[:'kubernetesVersions'] if attributes[:'kubernetesVersions']
45
+
46
+ raise 'You cannot provide both :kubernetesVersions and :kubernetes_versions' if attributes.key?(:'kubernetesVersions') && attributes.key?(:'kubernetes_versions')
47
+
48
+ self.kubernetes_versions = attributes[:'kubernetes_versions'] if attributes[:'kubernetes_versions']
49
+ end
50
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
51
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
52
+
53
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
54
+
55
+
56
+ # Checks equality by comparing each attribute.
57
+ # @param [Object] other the other object to be compared
58
+ def ==(other)
59
+ return true if equal?(other)
60
+ self.class == other.class &&
61
+ kubernetes_versions == other.kubernetes_versions
62
+ end
63
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
64
+
65
+ # @see the `==` method
66
+ # @param [Object] other the other object to be compared
67
+ def eql?(other)
68
+ self == other
69
+ end
70
+
71
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
72
+
73
+
74
+ # Calculates hash code according to all attributes.
75
+ # @return [Fixnum] Hash code
76
+ def hash
77
+ [kubernetes_versions].hash
78
+ end
79
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
80
+
81
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
82
+
83
+
84
+ # Builds the object from hash
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ # @return [Object] Returns the model itself
87
+ def build_from_hash(attributes)
88
+ return nil unless attributes.is_a?(Hash)
89
+ self.class.swagger_types.each_pair do |key, type|
90
+ if type =~ /^Array<(.*)>/i
91
+ # check to ensure the input is an array given that the the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
94
+ public_method("#{key}=").call(
95
+ attributes[self.class.attribute_map[key]]
96
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
97
+ )
98
+ end
99
+ elsif !attributes[self.class.attribute_map[key]].nil?
100
+ public_method("#{key}=").call(
101
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
102
+ )
103
+ end
104
+ # or else data not found in attributes(hash), not an issue as the data can be optional
105
+ end
106
+
107
+ self
108
+ end
109
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
110
+
111
+ # Returns the string representation of the object
112
+ # @return [String] String presentation of the object
113
+ def to_s
114
+ to_hash.to_s
115
+ end
116
+
117
+ # Returns the object in the form of hash
118
+ # @return [Hash] Returns the object in the form of hash
119
+ def to_hash
120
+ hash = {}
121
+ self.class.attribute_map.each_pair do |attr, param|
122
+ value = public_method(attr).call
123
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
124
+ hash[param] = _to_hash(value)
125
+ end
126
+ hash
127
+ end
128
+
129
+ private
130
+
131
+ # Outputs non-array value in the form of hash
132
+ # For object, use to_hash. Otherwise, just return the value
133
+ # @param [Object] value Any valid value
134
+ # @return [Hash] Returns the value in the form of hash
135
+ def _to_hash(value)
136
+ if value.is_a?(Array)
137
+ value.compact.map { |v| _to_hash(v) }
138
+ elsif value.is_a?(Hash)
139
+ {}.tap do |hash|
140
+ value.each { |k, v| hash[k] = _to_hash(v) }
141
+ end
142
+ elsif value.respond_to? :to_hash
143
+ value.to_hash
144
+ else
145
+ value
146
+ end
147
+ end
148
+ end
149
+ end
150
+ # rubocop:enable Lint/UnneededCopDisableDirective