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,320 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
4
+ module OCI
5
+ # This class provides a wrapper around {OCI::ContainerEngine::ContainerEngineClient} and offers convenience methods
6
+ # for operations that would otherwise need to be chained together. For example, instead of performing an action
7
+ # on a resource (e.g. launching an instance, creating a load balancer) and then using a waiter to wait for the resource
8
+ # to enter a given state, you can call a single method in this class to accomplish the same functionality
9
+ class ContainerEngine::ContainerEngineClientCompositeOperations
10
+ # The {OCI::ContainerEngine::ContainerEngineClient} used to communicate with the service_client
11
+ #
12
+ # @return [OCI::ContainerEngine::ContainerEngineClient]
13
+ attr_reader :service_client
14
+
15
+ # Initializes a new ContainerEngineClientCompositeOperations
16
+ #
17
+ # @param [OCI::ContainerEngine::ContainerEngineClient] service_client The client used to communicate with the service.
18
+ # Defaults to a new service client created via {OCI::ContainerEngine::ContainerEngineClient#initialize} with no arguments
19
+ def initialize(service_client = OCI::ContainerEngine::ContainerEngineClient.new)
20
+ @service_client = service_client
21
+ end
22
+
23
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
24
+ # rubocop:disable Layout/EmptyLines
25
+
26
+
27
+ # Calls {OCI::ContainerEngine::ContainerEngineClient#create_cluster} and then waits for the {OCI::ContainerEngine::Models::WorkRequest}
28
+ # to enter the given state(s).
29
+ #
30
+ # @param [OCI::ContainerEngine::Models::CreateClusterDetails] create_cluster_details The details of the cluster to create.
31
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::ContainerEngine::Models::WorkRequest#status}
32
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::ContainerEngine::ContainerEngineClient#create_cluster}
33
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
34
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
35
+ # * max_wait_seconds The maximum time to wait, in seconds
36
+ #
37
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::ContainerEngine::Models::WorkRequest}
38
+ def create_cluster_and_wait_for_state(create_cluster_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
39
+ operation_result = @service_client.create_cluster(create_cluster_details, base_operation_opts)
40
+ use_util = OCI::ContainerEngine::Util.respond_to?(:wait_on_work_request)
41
+
42
+ return operation_result if wait_for_states.empty? && !use_util
43
+
44
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
45
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
46
+
47
+ begin
48
+ if use_util
49
+ waiter_result = OCI::ContainerEngine::Util.wait_on_work_request(
50
+ @service_client,
51
+ wait_for_resource_id,
52
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
53
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
54
+ )
55
+ else
56
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
57
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
58
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
59
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
60
+ )
61
+ end
62
+ result_to_return = waiter_result
63
+
64
+ return result_to_return
65
+ rescue StandardError
66
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
67
+ end
68
+ end
69
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
70
+ # rubocop:enable Layout/EmptyLines
71
+
72
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
73
+ # rubocop:disable Layout/EmptyLines
74
+
75
+
76
+ # Calls {OCI::ContainerEngine::ContainerEngineClient#create_node_pool} and then waits for the {OCI::ContainerEngine::Models::WorkRequest}
77
+ # to enter the given state(s).
78
+ #
79
+ # @param [OCI::ContainerEngine::Models::CreateNodePoolDetails] create_node_pool_details The details of the node pool to create.
80
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::ContainerEngine::Models::WorkRequest#status}
81
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::ContainerEngine::ContainerEngineClient#create_node_pool}
82
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
83
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
84
+ # * max_wait_seconds The maximum time to wait, in seconds
85
+ #
86
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::ContainerEngine::Models::WorkRequest}
87
+ def create_node_pool_and_wait_for_state(create_node_pool_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
88
+ operation_result = @service_client.create_node_pool(create_node_pool_details, base_operation_opts)
89
+ use_util = OCI::ContainerEngine::Util.respond_to?(:wait_on_work_request)
90
+
91
+ return operation_result if wait_for_states.empty? && !use_util
92
+
93
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
94
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
95
+
96
+ begin
97
+ if use_util
98
+ waiter_result = OCI::ContainerEngine::Util.wait_on_work_request(
99
+ @service_client,
100
+ wait_for_resource_id,
101
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
102
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
103
+ )
104
+ else
105
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
106
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
107
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
108
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
109
+ )
110
+ end
111
+ result_to_return = waiter_result
112
+
113
+ return result_to_return
114
+ rescue StandardError
115
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
116
+ end
117
+ end
118
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
119
+ # rubocop:enable Layout/EmptyLines
120
+
121
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
122
+ # rubocop:disable Layout/EmptyLines
123
+
124
+
125
+ # Calls {OCI::ContainerEngine::ContainerEngineClient#delete_cluster} and then waits for the {OCI::ContainerEngine::Models::WorkRequest}
126
+ # to enter the given state(s).
127
+ #
128
+ # @param [String] cluster_id The OCID of the cluster.
129
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::ContainerEngine::Models::WorkRequest#status}
130
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::ContainerEngine::ContainerEngineClient#delete_cluster}
131
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
132
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
133
+ # * max_wait_seconds The maximum time to wait, in seconds
134
+ #
135
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::ContainerEngine::Models::WorkRequest}
136
+ def delete_cluster_and_wait_for_state(cluster_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
137
+ operation_result = @service_client.delete_cluster(cluster_id, base_operation_opts)
138
+ use_util = OCI::ContainerEngine::Util.respond_to?(:wait_on_work_request)
139
+
140
+ return operation_result if wait_for_states.empty? && !use_util
141
+
142
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
143
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
144
+
145
+ begin
146
+ if use_util
147
+ waiter_result = OCI::ContainerEngine::Util.wait_on_work_request(
148
+ @service_client,
149
+ wait_for_resource_id,
150
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
151
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
152
+ )
153
+ else
154
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
155
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
156
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
157
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
158
+ )
159
+ end
160
+ result_to_return = waiter_result
161
+
162
+ return result_to_return
163
+ rescue StandardError
164
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
165
+ end
166
+ end
167
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
168
+ # rubocop:enable Layout/EmptyLines
169
+
170
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
171
+ # rubocop:disable Layout/EmptyLines
172
+
173
+
174
+ # Calls {OCI::ContainerEngine::ContainerEngineClient#delete_node_pool} and then waits for the {OCI::ContainerEngine::Models::WorkRequest}
175
+ # to enter the given state(s).
176
+ #
177
+ # @param [String] node_pool_id The OCID of the node pool.
178
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::ContainerEngine::Models::WorkRequest#status}
179
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::ContainerEngine::ContainerEngineClient#delete_node_pool}
180
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
181
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
182
+ # * max_wait_seconds The maximum time to wait, in seconds
183
+ #
184
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::ContainerEngine::Models::WorkRequest}
185
+ def delete_node_pool_and_wait_for_state(node_pool_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
186
+ operation_result = @service_client.delete_node_pool(node_pool_id, base_operation_opts)
187
+ use_util = OCI::ContainerEngine::Util.respond_to?(:wait_on_work_request)
188
+
189
+ return operation_result if wait_for_states.empty? && !use_util
190
+
191
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
192
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
193
+
194
+ begin
195
+ if use_util
196
+ waiter_result = OCI::ContainerEngine::Util.wait_on_work_request(
197
+ @service_client,
198
+ wait_for_resource_id,
199
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
200
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
201
+ )
202
+ else
203
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
204
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
205
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
206
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
207
+ )
208
+ end
209
+ result_to_return = waiter_result
210
+
211
+ return result_to_return
212
+ rescue StandardError
213
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
214
+ end
215
+ end
216
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
217
+ # rubocop:enable Layout/EmptyLines
218
+
219
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
220
+ # rubocop:disable Layout/EmptyLines
221
+
222
+
223
+ # Calls {OCI::ContainerEngine::ContainerEngineClient#update_cluster} and then waits for the {OCI::ContainerEngine::Models::WorkRequest}
224
+ # to enter the given state(s).
225
+ #
226
+ # @param [String] cluster_id The OCID of the cluster.
227
+ # @param [OCI::ContainerEngine::Models::UpdateClusterDetails] update_cluster_details The details of the cluster to update.
228
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::ContainerEngine::Models::WorkRequest#status}
229
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::ContainerEngine::ContainerEngineClient#update_cluster}
230
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
231
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
232
+ # * max_wait_seconds The maximum time to wait, in seconds
233
+ #
234
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::ContainerEngine::Models::WorkRequest}
235
+ def update_cluster_and_wait_for_state(cluster_id, update_cluster_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
236
+ operation_result = @service_client.update_cluster(cluster_id, update_cluster_details, base_operation_opts)
237
+ use_util = OCI::ContainerEngine::Util.respond_to?(:wait_on_work_request)
238
+
239
+ return operation_result if wait_for_states.empty? && !use_util
240
+
241
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
242
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
243
+
244
+ begin
245
+ if use_util
246
+ waiter_result = OCI::ContainerEngine::Util.wait_on_work_request(
247
+ @service_client,
248
+ wait_for_resource_id,
249
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
250
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
251
+ )
252
+ else
253
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
254
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
255
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
256
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
257
+ )
258
+ end
259
+ result_to_return = waiter_result
260
+
261
+ return result_to_return
262
+ rescue StandardError
263
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
264
+ end
265
+ end
266
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
267
+ # rubocop:enable Layout/EmptyLines
268
+
269
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
270
+ # rubocop:disable Layout/EmptyLines
271
+
272
+
273
+ # Calls {OCI::ContainerEngine::ContainerEngineClient#update_node_pool} and then waits for the {OCI::ContainerEngine::Models::WorkRequest}
274
+ # to enter the given state(s).
275
+ #
276
+ # @param [String] node_pool_id The OCID of the node pool.
277
+ # @param [OCI::ContainerEngine::Models::UpdateNodePoolDetails] update_node_pool_details The fields to update in a node pool.
278
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::ContainerEngine::Models::WorkRequest#status}
279
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::ContainerEngine::ContainerEngineClient#update_node_pool}
280
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
281
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
282
+ # * max_wait_seconds The maximum time to wait, in seconds
283
+ #
284
+ # @return [OCI::Response] A {OCI::Response} object containing the completed {OCI::ContainerEngine::Models::WorkRequest}
285
+ def update_node_pool_and_wait_for_state(node_pool_id, update_node_pool_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
286
+ operation_result = @service_client.update_node_pool(node_pool_id, update_node_pool_details, base_operation_opts)
287
+ use_util = OCI::ContainerEngine::Util.respond_to?(:wait_on_work_request)
288
+
289
+ return operation_result if wait_for_states.empty? && !use_util
290
+
291
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
292
+ wait_for_resource_id = operation_result.headers['opc-work-request-id']
293
+
294
+ begin
295
+ if use_util
296
+ waiter_result = OCI::ContainerEngine::Util.wait_on_work_request(
297
+ @service_client,
298
+ wait_for_resource_id,
299
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
300
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
301
+ )
302
+ else
303
+ waiter_result = @service_client.get_work_request(wait_for_resource_id).wait_until(
304
+ eval_proc: ->(response) { response.data.respond_to?(:status) && lowered_wait_for_states.include?(response.data.status.downcase) },
305
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
306
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
307
+ )
308
+ end
309
+ result_to_return = waiter_result
310
+
311
+ return result_to_return
312
+ rescue StandardError
313
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
314
+ end
315
+ end
316
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
317
+ # rubocop:enable Layout/EmptyLines
318
+ end
319
+ end
320
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,164 @@
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 options for supported add-ons.
8
+ class ContainerEngine::Models::AddOnOptions # rubocop:disable Metrics/LineLength
9
+ # Whether or not to enable the Kubernetes Dashboard add-on.
10
+ # @return [BOOLEAN]
11
+ attr_accessor :is_kubernetes_dashboard_enabled
12
+
13
+ # Whether or not to enable the Tiller add-on.
14
+ # @return [BOOLEAN]
15
+ attr_accessor :is_tiller_enabled
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ # rubocop:disable Style/SymbolLiteral
21
+ 'is_kubernetes_dashboard_enabled': :'isKubernetesDashboardEnabled',
22
+ 'is_tiller_enabled': :'isTillerEnabled'
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
+ 'is_kubernetes_dashboard_enabled': :'BOOLEAN',
32
+ 'is_tiller_enabled': :'BOOLEAN'
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 [BOOLEAN] :is_kubernetes_dashboard_enabled The value to assign to the {#is_kubernetes_dashboard_enabled} property
44
+ # @option attributes [BOOLEAN] :is_tiller_enabled The value to assign to the {#is_tiller_enabled} 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.is_kubernetes_dashboard_enabled = attributes[:'isKubernetesDashboardEnabled'] unless attributes[:'isKubernetesDashboardEnabled'].nil?
52
+
53
+ raise 'You cannot provide both :isKubernetesDashboardEnabled and :is_kubernetes_dashboard_enabled' if attributes.key?(:'isKubernetesDashboardEnabled') && attributes.key?(:'is_kubernetes_dashboard_enabled')
54
+
55
+ self.is_kubernetes_dashboard_enabled = attributes[:'is_kubernetes_dashboard_enabled'] unless attributes[:'is_kubernetes_dashboard_enabled'].nil?
56
+
57
+ self.is_tiller_enabled = attributes[:'isTillerEnabled'] unless attributes[:'isTillerEnabled'].nil?
58
+
59
+ raise 'You cannot provide both :isTillerEnabled and :is_tiller_enabled' if attributes.key?(:'isTillerEnabled') && attributes.key?(:'is_tiller_enabled')
60
+
61
+ self.is_tiller_enabled = attributes[:'is_tiller_enabled'] unless attributes[:'is_tiller_enabled'].nil?
62
+ end
63
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
64
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
65
+
66
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
67
+
68
+
69
+ # Checks equality by comparing each attribute.
70
+ # @param [Object] other the other object to be compared
71
+ def ==(other)
72
+ return true if equal?(other)
73
+ self.class == other.class &&
74
+ is_kubernetes_dashboard_enabled == other.is_kubernetes_dashboard_enabled &&
75
+ is_tiller_enabled == other.is_tiller_enabled
76
+ end
77
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
78
+
79
+ # @see the `==` method
80
+ # @param [Object] other the other object to be compared
81
+ def eql?(other)
82
+ self == other
83
+ end
84
+
85
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
86
+
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Fixnum] Hash code
90
+ def hash
91
+ [is_kubernetes_dashboard_enabled, is_tiller_enabled].hash
92
+ end
93
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
94
+
95
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
96
+
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def build_from_hash(attributes)
102
+ return nil unless attributes.is_a?(Hash)
103
+ self.class.swagger_types.each_pair do |key, type|
104
+ if type =~ /^Array<(.*)>/i
105
+ # check to ensure the input is an array given that the the attribute
106
+ # is documented as an array but the input is not
107
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
108
+ public_method("#{key}=").call(
109
+ attributes[self.class.attribute_map[key]]
110
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
111
+ )
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ public_method("#{key}=").call(
115
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
116
+ )
117
+ end
118
+ # or else data not found in attributes(hash), not an issue as the data can be optional
119
+ end
120
+
121
+ self
122
+ end
123
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
124
+
125
+ # Returns the string representation of the object
126
+ # @return [String] String presentation of the object
127
+ def to_s
128
+ to_hash.to_s
129
+ end
130
+
131
+ # Returns the object in the form of hash
132
+ # @return [Hash] Returns the object in the form of hash
133
+ def to_hash
134
+ hash = {}
135
+ self.class.attribute_map.each_pair do |attr, param|
136
+ value = public_method(attr).call
137
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
138
+ hash[param] = _to_hash(value)
139
+ end
140
+ hash
141
+ end
142
+
143
+ private
144
+
145
+ # Outputs non-array value in the form of hash
146
+ # For object, use to_hash. Otherwise, just return the value
147
+ # @param [Object] value Any valid value
148
+ # @return [Hash] Returns the value in the form of hash
149
+ def _to_hash(value)
150
+ if value.is_a?(Array)
151
+ value.compact.map { |v| _to_hash(v) }
152
+ elsif value.is_a?(Hash)
153
+ {}.tap do |hash|
154
+ value.each { |k, v| hash[k] = _to_hash(v) }
155
+ end
156
+ elsif value.respond_to? :to_hash
157
+ value.to_hash
158
+ else
159
+ value
160
+ end
161
+ end
162
+ end
163
+ end
164
+ # rubocop:enable Lint/UnneededCopDisableDirective