aws-sdk-ssm 1.81.1 → 1.86.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,156 @@
1
+ # frozen_string_literal: true
2
+
3
+ # WARNING ABOUT GENERATED CODE
4
+ #
5
+ # This file is generated. See the contributing guide for more information:
6
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ require 'aws-sdk-core/waiters'
11
+
12
+ module Aws::SSM
13
+ # Waiters are utility methods that poll for a particular state to occur
14
+ # on a client. Waiters can fail after a number of attempts at a polling
15
+ # interval defined for the service client.
16
+ #
17
+ # For a list of operations that can be waited for and the
18
+ # client methods called for each operation, see the table below or the
19
+ # {Client#wait_until} field documentation for the {Client}.
20
+ #
21
+ # # Invoking a Waiter
22
+ # To invoke a waiter, call #wait_until on a {Client}. The first parameter
23
+ # is the waiter name, which is specific to the service client and indicates
24
+ # which operation is being waited for. The second parameter is a hash of
25
+ # parameters that are passed to the client method called by the waiter,
26
+ # which varies according to the waiter name.
27
+ #
28
+ # # Wait Failures
29
+ # To catch errors in a waiter, use WaiterFailed,
30
+ # as shown in the following example.
31
+ #
32
+ # rescue rescue Aws::Waiters::Errors::WaiterFailed => error
33
+ # puts "failed waiting for instance running: #{error.message}
34
+ # end
35
+ #
36
+ # # Configuring a Waiter
37
+ # Each waiter has a default polling interval and a maximum number of
38
+ # attempts it will make before returning control to your program.
39
+ # To set these values, use the `max_attempts` and `delay` parameters
40
+ # in your `#wait_until` call.
41
+ # The following example waits for up to 25 seconds, polling every five seconds.
42
+ #
43
+ # client.wait_until(...) do |w|
44
+ # w.max_attempts = 5
45
+ # w.delay = 5
46
+ # end
47
+ #
48
+ # To disable wait failures, set the value of either of these parameters
49
+ # to `nil`.
50
+ #
51
+ # # Extending a Waiter
52
+ # To modify the behavior of waiters, you can register callbacks that are
53
+ # triggered before each polling attempt and before waiting.
54
+ #
55
+ # The following example implements an exponential backoff in a waiter
56
+ # by doubling the amount of time to wait on every attempt.
57
+ #
58
+ # client.wait_until(...) do |w|
59
+ # w.interval = 0 # disable normal sleep
60
+ # w.before_wait do |n, resp|
61
+ # sleep(n ** 2)
62
+ # end
63
+ # end
64
+ #
65
+ # # Available Waiters
66
+ #
67
+ # The following table lists the valid waiter names, the operations they call,
68
+ # and the default `:delay` and `:max_attempts` values.
69
+ #
70
+ # | waiter_name | params | :delay | :max_attempts |
71
+ # | ---------------- | ------------------------------- | -------- | ------------- |
72
+ # | command_executed | {Client#get_command_invocation} | 5 | 20 |
73
+ #
74
+ module Waiters
75
+
76
+ class CommandExecuted
77
+
78
+ # @param [Hash] options
79
+ # @option options [required, Client] :client
80
+ # @option options [Integer] :max_attempts (20)
81
+ # @option options [Integer] :delay (5)
82
+ # @option options [Proc] :before_attempt
83
+ # @option options [Proc] :before_wait
84
+ def initialize(options)
85
+ @client = options.fetch(:client)
86
+ @waiter = Aws::Waiters::Waiter.new({
87
+ max_attempts: 20,
88
+ delay: 5,
89
+ poller: Aws::Waiters::Poller.new(
90
+ operation_name: :get_command_invocation,
91
+ acceptors: [
92
+ {
93
+ "expected" => "Pending",
94
+ "matcher" => "path",
95
+ "state" => "retry",
96
+ "argument" => "status"
97
+ },
98
+ {
99
+ "expected" => "InProgress",
100
+ "matcher" => "path",
101
+ "state" => "retry",
102
+ "argument" => "status"
103
+ },
104
+ {
105
+ "expected" => "Delayed",
106
+ "matcher" => "path",
107
+ "state" => "retry",
108
+ "argument" => "status"
109
+ },
110
+ {
111
+ "expected" => "Success",
112
+ "matcher" => "path",
113
+ "state" => "success",
114
+ "argument" => "status"
115
+ },
116
+ {
117
+ "expected" => "Cancelled",
118
+ "matcher" => "path",
119
+ "state" => "failure",
120
+ "argument" => "status"
121
+ },
122
+ {
123
+ "expected" => "TimedOut",
124
+ "matcher" => "path",
125
+ "state" => "failure",
126
+ "argument" => "status"
127
+ },
128
+ {
129
+ "expected" => "Failed",
130
+ "matcher" => "path",
131
+ "state" => "failure",
132
+ "argument" => "status"
133
+ },
134
+ {
135
+ "expected" => "Cancelling",
136
+ "matcher" => "path",
137
+ "state" => "failure",
138
+ "argument" => "status"
139
+ }
140
+ ]
141
+ )
142
+ }.merge(options))
143
+ end
144
+
145
+ # @option (see Client#get_command_invocation)
146
+ # @return (see Client#get_command_invocation)
147
+ def wait(params = {})
148
+ @waiter.wait(client: @client, params: params)
149
+ end
150
+
151
+ # @api private
152
+ attr_reader :waiter
153
+
154
+ end
155
+ end
156
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-ssm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.81.1
4
+ version: 1.86.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-11 00:00:00.000000000 Z
11
+ date: 2020-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -59,6 +59,7 @@ files:
59
59
  - lib/aws-sdk-ssm/errors.rb
60
60
  - lib/aws-sdk-ssm/resource.rb
61
61
  - lib/aws-sdk-ssm/types.rb
62
+ - lib/aws-sdk-ssm/waiters.rb
62
63
  homepage: https://github.com/aws/aws-sdk-ruby
63
64
  licenses:
64
65
  - Apache-2.0