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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/oci.rb +1 -0
- data/lib/oci/audit/audit_client_composite_operations.rb +16 -6
- data/lib/oci/container_engine/container_engine.rb +47 -0
- data/lib/oci/container_engine/container_engine_client.rb +1276 -0
- data/lib/oci/container_engine/container_engine_client_composite_operations.rb +320 -0
- data/lib/oci/container_engine/models/add_on_options.rb +164 -0
- data/lib/oci/container_engine/models/cluster.rb +296 -0
- data/lib/oci/container_engine/models/cluster_create_options.rb +178 -0
- data/lib/oci/container_engine/models/cluster_endpoints.rb +146 -0
- data/lib/oci/container_engine/models/cluster_lifecycle_state.rb +14 -0
- data/lib/oci/container_engine/models/cluster_metadata.rb +262 -0
- data/lib/oci/container_engine/models/cluster_options.rb +150 -0
- data/lib/oci/container_engine/models/cluster_summary.rb +296 -0
- data/lib/oci/container_engine/models/create_cluster_details.rb +198 -0
- data/lib/oci/container_engine/models/create_cluster_kubeconfig_content_details.rb +162 -0
- data/lib/oci/container_engine/models/create_node_pool_details.rb +272 -0
- data/lib/oci/container_engine/models/key_value.rb +156 -0
- data/lib/oci/container_engine/models/kubernetes_network_config.rb +164 -0
- data/lib/oci/container_engine/models/node.rb +281 -0
- data/lib/oci/container_engine/models/node_error.rb +180 -0
- data/lib/oci/container_engine/models/node_pool.rb +306 -0
- data/lib/oci/container_engine/models/node_pool_options.rb +170 -0
- data/lib/oci/container_engine/models/node_pool_summary.rb +296 -0
- data/lib/oci/container_engine/models/sort_order.rb +10 -0
- data/lib/oci/container_engine/models/update_cluster_details.rb +160 -0
- data/lib/oci/container_engine/models/update_node_pool_details.rb +202 -0
- data/lib/oci/container_engine/models/work_request.rb +288 -0
- data/lib/oci/container_engine/models/work_request_error.rb +167 -0
- data/lib/oci/container_engine/models/work_request_log_entry.rb +156 -0
- data/lib/oci/container_engine/models/work_request_operation_type.rb +15 -0
- data/lib/oci/container_engine/models/work_request_resource.rb +214 -0
- data/lib/oci/container_engine/models/work_request_status.rb +14 -0
- data/lib/oci/container_engine/models/work_request_summary.rb +288 -0
- data/lib/oci/container_engine/util.rb +46 -0
- data/lib/oci/errors.rb +21 -2
- data/lib/oci/load_balancer/load_balancer_client_composite_operations.rb +336 -133
- data/lib/oci/load_balancer/util.rb +19 -32
- data/lib/oci/regions.rb +2 -1
- data/lib/oci/version.rb +1 -1
- data/lib/oci/waiter.rb +47 -0
- metadata +34 -2
@@ -13,43 +13,30 @@ module OCI
|
|
13
13
|
# @param [Integer] max_wait_seconds The maximum total time to wait, in seconds.
|
14
14
|
# @param [Boolean] raise_error_on_failure If true, then a WorkRequestFailedError will be
|
15
15
|
# raised if the work request is in a failed state.
|
16
|
-
# @return [
|
16
|
+
# @return [OCI::Response] A {OCI::Response} object containing the completed
|
17
|
+
# {OCI::LoadBalancer::Models::WorkRequest}
|
17
18
|
def self.wait_on_work_request(client,
|
18
19
|
work_request_id,
|
19
20
|
max_interval_seconds: 30,
|
20
21
|
max_wait_seconds: 1200,
|
21
22
|
raise_error_on_failure: true)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
if elapsed_seconds + interval_seconds > max_wait_seconds
|
41
|
-
raise OCI::Errors::MaximumWaitTimeExceededError, 'Maximum wait time has been exceeded.' \
|
42
|
-
unless max_wait_seconds > elapsed_seconds
|
43
|
-
|
44
|
-
# Make one last request right at the maximum wait time.
|
45
|
-
interval_seconds = max_wait_seconds - elapsed_seconds
|
46
|
-
end
|
47
|
-
|
48
|
-
sleep(interval_seconds)
|
49
|
-
|
50
|
-
interval_seconds *= 2
|
51
|
-
interval_seconds = max_interval_seconds if interval_seconds > max_interval_seconds
|
52
|
-
end
|
23
|
+
OCI::Waiter::WorkRequest.wait_for_state(
|
24
|
+
client,
|
25
|
+
work_request_id,
|
26
|
+
lambda do |work_request|
|
27
|
+
work_request.lifecycle_state == OCI::LoadBalancer::Models::WorkRequest::LIFECYCLE_STATE_SUCCEEDED
|
28
|
+
end,
|
29
|
+
lambda do |work_request|
|
30
|
+
is_failed_state = work_request.lifecycle_state == \
|
31
|
+
OCI::LoadBalancer::Models::WorkRequest::LIFECYCLE_STATE_FAILED
|
32
|
+
raise OCI::Errors::WorkRequestFailedError.new(work_request, work_request.lifecycle_state) \
|
33
|
+
if raise_error_on_failure && is_failed_state
|
34
|
+
|
35
|
+
is_failed_state
|
36
|
+
end,
|
37
|
+
max_interval_seconds: max_interval_seconds,
|
38
|
+
max_wait_seconds: max_wait_seconds
|
39
|
+
)
|
53
40
|
end
|
54
41
|
end
|
55
42
|
end
|
data/lib/oci/regions.rb
CHANGED
data/lib/oci/version.rb
CHANGED
data/lib/oci/waiter.rb
CHANGED
@@ -15,6 +15,53 @@ module OCI
|
|
15
15
|
# waiter to fail with this exception.
|
16
16
|
class WaiterFailedError < RuntimeError; end
|
17
17
|
end
|
18
|
+
|
19
|
+
# Work request waiter utility method.
|
20
|
+
module WorkRequest
|
21
|
+
# Wait until the work request succeeds or fails, or max_wait_seconds is reached.
|
22
|
+
# The work request will be polled at an increasing rate, with a maximum of
|
23
|
+
# max_interval_seconds between requests.
|
24
|
+
#
|
25
|
+
# @param [Client] client A client that is able to call get_work_request()
|
26
|
+
# @param [String] work_request_id, the work request identifier
|
27
|
+
# @param [Proc] eval_success_proc the proc to evaluate if a wait condition has succeeded.
|
28
|
+
# @param [Proc] eval_error_proc the proc to evaluate if an error based terminal condition has occurred.
|
29
|
+
# @param [Integer] max_interval_seconds The maximum interval between queries, in seconds.
|
30
|
+
# @param [Integer] max_wait_seconds The maximum total time to wait, in seconds.
|
31
|
+
# @return [OCI::Response] A {OCI::Response} object containing the completed work request
|
32
|
+
def self.wait_for_state(client,
|
33
|
+
work_request_id,
|
34
|
+
eval_success_proc = nil,
|
35
|
+
eval_error_proc = nil,
|
36
|
+
max_interval_seconds: 30,
|
37
|
+
max_wait_seconds: 1200)
|
38
|
+
raise 'Work request ID not specified.' unless work_request_id
|
39
|
+
raise 'Evaluation proc for determining success not specified' unless eval_success_proc
|
40
|
+
interval_seconds = 1
|
41
|
+
start_time = Time.now
|
42
|
+
|
43
|
+
loop do
|
44
|
+
response = client.get_work_request(work_request_id)
|
45
|
+
return response if eval_success_proc && eval_success_proc.call(response.data)
|
46
|
+
return response if eval_error_proc && eval_error_proc.call(response.data)
|
47
|
+
|
48
|
+
elapsed_seconds = (Time.now - start_time).to_i
|
49
|
+
|
50
|
+
if elapsed_seconds + interval_seconds > max_wait_seconds
|
51
|
+
raise OCI::Errors::MaximumWaitTimeExceededError, 'Maximum wait time has been exceeded.' \
|
52
|
+
unless max_wait_seconds > elapsed_seconds
|
53
|
+
|
54
|
+
# Make one last request right at the maximum wait time.
|
55
|
+
interval_seconds = max_wait_seconds - elapsed_seconds
|
56
|
+
end
|
57
|
+
|
58
|
+
sleep(interval_seconds)
|
59
|
+
|
60
|
+
interval_seconds *= 2
|
61
|
+
interval_seconds = max_interval_seconds if interval_seconds > max_interval_seconds
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
18
65
|
end
|
19
66
|
|
20
67
|
# Adds to the Response class in lib/oci/response.rb to define wait behavior
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oracle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -176,6 +176,38 @@ files:
|
|
176
176
|
- "./lib/oci/base_signer.rb"
|
177
177
|
- "./lib/oci/config.rb"
|
178
178
|
- "./lib/oci/config_file_loader.rb"
|
179
|
+
- "./lib/oci/container_engine/container_engine.rb"
|
180
|
+
- "./lib/oci/container_engine/container_engine_client.rb"
|
181
|
+
- "./lib/oci/container_engine/container_engine_client_composite_operations.rb"
|
182
|
+
- "./lib/oci/container_engine/models/add_on_options.rb"
|
183
|
+
- "./lib/oci/container_engine/models/cluster.rb"
|
184
|
+
- "./lib/oci/container_engine/models/cluster_create_options.rb"
|
185
|
+
- "./lib/oci/container_engine/models/cluster_endpoints.rb"
|
186
|
+
- "./lib/oci/container_engine/models/cluster_lifecycle_state.rb"
|
187
|
+
- "./lib/oci/container_engine/models/cluster_metadata.rb"
|
188
|
+
- "./lib/oci/container_engine/models/cluster_options.rb"
|
189
|
+
- "./lib/oci/container_engine/models/cluster_summary.rb"
|
190
|
+
- "./lib/oci/container_engine/models/create_cluster_details.rb"
|
191
|
+
- "./lib/oci/container_engine/models/create_cluster_kubeconfig_content_details.rb"
|
192
|
+
- "./lib/oci/container_engine/models/create_node_pool_details.rb"
|
193
|
+
- "./lib/oci/container_engine/models/key_value.rb"
|
194
|
+
- "./lib/oci/container_engine/models/kubernetes_network_config.rb"
|
195
|
+
- "./lib/oci/container_engine/models/node.rb"
|
196
|
+
- "./lib/oci/container_engine/models/node_error.rb"
|
197
|
+
- "./lib/oci/container_engine/models/node_pool.rb"
|
198
|
+
- "./lib/oci/container_engine/models/node_pool_options.rb"
|
199
|
+
- "./lib/oci/container_engine/models/node_pool_summary.rb"
|
200
|
+
- "./lib/oci/container_engine/models/sort_order.rb"
|
201
|
+
- "./lib/oci/container_engine/models/update_cluster_details.rb"
|
202
|
+
- "./lib/oci/container_engine/models/update_node_pool_details.rb"
|
203
|
+
- "./lib/oci/container_engine/models/work_request.rb"
|
204
|
+
- "./lib/oci/container_engine/models/work_request_error.rb"
|
205
|
+
- "./lib/oci/container_engine/models/work_request_log_entry.rb"
|
206
|
+
- "./lib/oci/container_engine/models/work_request_operation_type.rb"
|
207
|
+
- "./lib/oci/container_engine/models/work_request_resource.rb"
|
208
|
+
- "./lib/oci/container_engine/models/work_request_status.rb"
|
209
|
+
- "./lib/oci/container_engine/models/work_request_summary.rb"
|
210
|
+
- "./lib/oci/container_engine/util.rb"
|
179
211
|
- "./lib/oci/core/blockstorage_client.rb"
|
180
212
|
- "./lib/oci/core/blockstorage_client_composite_operations.rb"
|
181
213
|
- "./lib/oci/core/compute_client.rb"
|