aws-sdk-prometheusservice 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,172 @@
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::PrometheusService
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
+ # | workspace_active | {Client#describe_workspace} | 2 | 60 |
73
+ # | workspace_deleted | {Client#describe_workspace} | 2 | 60 |
74
+ #
75
+ module Waiters
76
+
77
+ # Wait until a workspace reaches ACTIVE status
78
+ class WorkspaceActive
79
+
80
+ # @param [Hash] options
81
+ # @option options [required, Client] :client
82
+ # @option options [Integer] :max_attempts (60)
83
+ # @option options [Integer] :delay (2)
84
+ # @option options [Proc] :before_attempt
85
+ # @option options [Proc] :before_wait
86
+ def initialize(options)
87
+ @client = options.fetch(:client)
88
+ @waiter = Aws::Waiters::Waiter.new({
89
+ max_attempts: 60,
90
+ delay: 2,
91
+ poller: Aws::Waiters::Poller.new(
92
+ operation_name: :describe_workspace,
93
+ acceptors: [
94
+ {
95
+ "matcher" => "path",
96
+ "argument" => "workspace.status.status_code",
97
+ "state" => "success",
98
+ "expected" => "ACTIVE"
99
+ },
100
+ {
101
+ "matcher" => "path",
102
+ "argument" => "workspace.status.status_code",
103
+ "state" => "retry",
104
+ "expected" => "UPDATING"
105
+ },
106
+ {
107
+ "matcher" => "path",
108
+ "argument" => "workspace.status.status_code",
109
+ "state" => "retry",
110
+ "expected" => "CREATING"
111
+ }
112
+ ]
113
+ )
114
+ }.merge(options))
115
+ end
116
+
117
+ # @option (see Client#describe_workspace)
118
+ # @return (see Client#describe_workspace)
119
+ def wait(params = {})
120
+ @waiter.wait(client: @client, params: params)
121
+ end
122
+
123
+ # @api private
124
+ attr_reader :waiter
125
+
126
+ end
127
+
128
+ # Wait until a workspace reaches DELETED status
129
+ class WorkspaceDeleted
130
+
131
+ # @param [Hash] options
132
+ # @option options [required, Client] :client
133
+ # @option options [Integer] :max_attempts (60)
134
+ # @option options [Integer] :delay (2)
135
+ # @option options [Proc] :before_attempt
136
+ # @option options [Proc] :before_wait
137
+ def initialize(options)
138
+ @client = options.fetch(:client)
139
+ @waiter = Aws::Waiters::Waiter.new({
140
+ max_attempts: 60,
141
+ delay: 2,
142
+ poller: Aws::Waiters::Poller.new(
143
+ operation_name: :describe_workspace,
144
+ acceptors: [
145
+ {
146
+ "matcher" => "error",
147
+ "state" => "success",
148
+ "expected" => "ResourceNotFoundException"
149
+ },
150
+ {
151
+ "matcher" => "path",
152
+ "argument" => "workspace.status.status_code",
153
+ "state" => "retry",
154
+ "expected" => "DELETING"
155
+ }
156
+ ]
157
+ )
158
+ }.merge(options))
159
+ end
160
+
161
+ # @option (see Client#describe_workspace)
162
+ # @return (see Client#describe_workspace)
163
+ def wait(params = {})
164
+ @waiter.wait(client: @client, params: params)
165
+ end
166
+
167
+ # @api private
168
+ attr_reader :waiter
169
+
170
+ end
171
+ end
172
+ end
@@ -15,6 +15,7 @@ require_relative 'aws-sdk-prometheusservice/types'
15
15
  require_relative 'aws-sdk-prometheusservice/client_api'
16
16
  require_relative 'aws-sdk-prometheusservice/client'
17
17
  require_relative 'aws-sdk-prometheusservice/errors'
18
+ require_relative 'aws-sdk-prometheusservice/waiters'
18
19
  require_relative 'aws-sdk-prometheusservice/resource'
19
20
  require_relative 'aws-sdk-prometheusservice/customizations'
20
21
 
@@ -28,7 +29,7 @@ require_relative 'aws-sdk-prometheusservice/customizations'
28
29
  # structure.
29
30
  #
30
31
  # prometheus_service = Aws::PrometheusService::Client.new
31
- # resp = prometheus_service.create_workspace(params)
32
+ # resp = prometheus_service.create_alert_manager_definition(params)
32
33
  #
33
34
  # See {Client} for more information.
34
35
  #
@@ -48,6 +49,6 @@ require_relative 'aws-sdk-prometheusservice/customizations'
48
49
  # @!group service
49
50
  module Aws::PrometheusService
50
51
 
51
- GEM_VERSION = '1.7.0'
52
+ GEM_VERSION = '1.8.0'
52
53
 
53
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-prometheusservice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.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: 2021-09-07 00:00:00.000000000 Z
11
+ date: 2021-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -62,6 +62,7 @@ files:
62
62
  - lib/aws-sdk-prometheusservice/errors.rb
63
63
  - lib/aws-sdk-prometheusservice/resource.rb
64
64
  - lib/aws-sdk-prometheusservice/types.rb
65
+ - lib/aws-sdk-prometheusservice/waiters.rb
65
66
  homepage: https://github.com/aws/aws-sdk-ruby
66
67
  licenses:
67
68
  - Apache-2.0