aws-sdk-inspector2 1.75.0 → 1.76.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.
@@ -0,0 +1,225 @@
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/version-3/CONTRIBUTING.md
7
+ #
8
+ # WARNING ABOUT GENERATED CODE
9
+
10
+ require 'aws-sdk-core/waiters'
11
+
12
+ module Aws::Inspector2
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
+ # | connector_connected | {Client#list_connectors} | 30 | 5 |
73
+ # | connector_deleted | {Client#list_connectors} | 30 | 5 |
74
+ # | connector_enabled | {Client#list_connectors} | 30 | 5 |
75
+ #
76
+ module Waiters
77
+
78
+ # Wait until a connector reaches the CONNECTED health status, typically after CreateConnector or UpdateConnector + ConnectorEnabled. Caller MUST filter ListConnectors by the specific connector ARN so the matchers apply only to the target connector. Success when all returned items have health.connectorStatus == CONNECTED. Failure when any item is in health.connectorStatus == FAILED_TO_CONNECT or enablementStatus == FAILED_TO_ENABLE.
79
+ class ConnectorConnected
80
+
81
+ # @param [Hash] options
82
+ # @option options [required, Client] :client
83
+ # @option options [Integer] :max_attempts (5)
84
+ # @option options [Integer] :delay (30)
85
+ # @option options [Proc] :before_attempt
86
+ # @option options [Proc] :before_wait
87
+ def initialize(options)
88
+ @client = options.fetch(:client)
89
+ @waiter = Aws::Waiters::Waiter.new({
90
+ max_attempts: 5,
91
+ delay: 30,
92
+ poller: Aws::Waiters::Poller.new(
93
+ operation_name: :list_connectors,
94
+ acceptors: [
95
+ {
96
+ "matcher" => "pathAll",
97
+ "argument" => "items[].health.connector_status",
98
+ "state" => "success",
99
+ "expected" => "CONNECTED"
100
+ },
101
+ {
102
+ "matcher" => "pathAny",
103
+ "argument" => "items[].health.connector_status",
104
+ "state" => "failure",
105
+ "expected" => "FAILED_TO_CONNECT"
106
+ },
107
+ {
108
+ "matcher" => "pathAny",
109
+ "argument" => "items[].enablement_status",
110
+ "state" => "failure",
111
+ "expected" => "FAILED_TO_ENABLE"
112
+ }
113
+ ]
114
+ )
115
+ }.merge(options))
116
+ end
117
+
118
+ # @option (see Client#list_connectors)
119
+ # @return (see Client#list_connectors)
120
+ def wait(params = {})
121
+ @waiter.wait(client: @client, params: params)
122
+ end
123
+
124
+ # @api private
125
+ attr_reader :waiter
126
+
127
+ end
128
+
129
+ # Wait until a connector is no longer returned by ListConnectors. Caller MUST filter ListConnectors by the specific connector ARN; success is reached when the filtered result returns zero items. Failure when the deletion terminally fails (FAILED_TO_DELETE).
130
+ class ConnectorDeleted
131
+
132
+ # @param [Hash] options
133
+ # @option options [required, Client] :client
134
+ # @option options [Integer] :max_attempts (5)
135
+ # @option options [Integer] :delay (30)
136
+ # @option options [Proc] :before_attempt
137
+ # @option options [Proc] :before_wait
138
+ def initialize(options)
139
+ @client = options.fetch(:client)
140
+ @waiter = Aws::Waiters::Waiter.new({
141
+ max_attempts: 5,
142
+ delay: 30,
143
+ poller: Aws::Waiters::Poller.new(
144
+ operation_name: :list_connectors,
145
+ acceptors: [
146
+ {
147
+ "matcher" => "path",
148
+ "argument" => "length(items) == `0`",
149
+ "state" => "success",
150
+ "expected" => true
151
+ },
152
+ {
153
+ "matcher" => "pathAny",
154
+ "argument" => "items[].enablement_status",
155
+ "state" => "failure",
156
+ "expected" => "FAILED_TO_DELETE"
157
+ }
158
+ ]
159
+ )
160
+ }.merge(options))
161
+ end
162
+
163
+ # @option (see Client#list_connectors)
164
+ # @return (see Client#list_connectors)
165
+ def wait(params = {})
166
+ @waiter.wait(client: @client, params: params)
167
+ end
168
+
169
+ # @api private
170
+ attr_reader :waiter
171
+
172
+ end
173
+
174
+ # Wait until a connector reaches the ENABLED state, whether after CreateConnector or UpdateConnector. Caller MUST filter ListConnectors by the specific connector ARN so the matchers apply only to the target connector. Success when all returned items have enablementStatus == ENABLED. Failure when any item is in FAILED_TO_ENABLE or FAILED_TO_UPDATE.
175
+ class ConnectorEnabled
176
+
177
+ # @param [Hash] options
178
+ # @option options [required, Client] :client
179
+ # @option options [Integer] :max_attempts (5)
180
+ # @option options [Integer] :delay (30)
181
+ # @option options [Proc] :before_attempt
182
+ # @option options [Proc] :before_wait
183
+ def initialize(options)
184
+ @client = options.fetch(:client)
185
+ @waiter = Aws::Waiters::Waiter.new({
186
+ max_attempts: 5,
187
+ delay: 30,
188
+ poller: Aws::Waiters::Poller.new(
189
+ operation_name: :list_connectors,
190
+ acceptors: [
191
+ {
192
+ "matcher" => "pathAll",
193
+ "argument" => "items[].enablement_status",
194
+ "state" => "success",
195
+ "expected" => "ENABLED"
196
+ },
197
+ {
198
+ "matcher" => "pathAny",
199
+ "argument" => "items[].enablement_status",
200
+ "state" => "failure",
201
+ "expected" => "FAILED_TO_ENABLE"
202
+ },
203
+ {
204
+ "matcher" => "pathAny",
205
+ "argument" => "items[].enablement_status",
206
+ "state" => "failure",
207
+ "expected" => "FAILED_TO_UPDATE"
208
+ }
209
+ ]
210
+ )
211
+ }.merge(options))
212
+ end
213
+
214
+ # @option (see Client#list_connectors)
215
+ # @return (see Client#list_connectors)
216
+ def wait(params = {})
217
+ @waiter.wait(client: @client, params: params)
218
+ end
219
+
220
+ # @api private
221
+ attr_reader :waiter
222
+
223
+ end
224
+ end
225
+ end
@@ -49,12 +49,13 @@ module Aws::Inspector2
49
49
  end
50
50
  autoload :Client, 'aws-sdk-inspector2/client'
51
51
  autoload :Errors, 'aws-sdk-inspector2/errors'
52
+ autoload :Waiters, 'aws-sdk-inspector2/waiters'
52
53
  autoload :Resource, 'aws-sdk-inspector2/resource'
53
54
  autoload :EndpointParameters, 'aws-sdk-inspector2/endpoint_parameters'
54
55
  autoload :EndpointProvider, 'aws-sdk-inspector2/endpoint_provider'
55
56
  autoload :Endpoints, 'aws-sdk-inspector2/endpoints'
56
57
 
57
- GEM_VERSION = '1.75.0'
58
+ GEM_VERSION = '1.76.0'
58
59
 
59
60
  end
60
61