aws-sdk-transfer 1.49.0 → 1.50.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4dcec53c534ecacf09fc94f69e2df74a13999f50aa80f275128e8d18f76b443
4
- data.tar.gz: 5fbcbbe7e310309089ebdb58bef2285c085fca6aa19858cbf718df923504fb96
3
+ metadata.gz: 4e4409d8646c52571f98d0f73d469176b53d7a405abb734576d1246d449c4852
4
+ data.tar.gz: 79ab9afb3e5e42cd699384918c77c6e93f04d65e509c9482cf3364d9b7a26919
5
5
  SHA512:
6
- metadata.gz: 18a7b532fd07a10853847090bb0c6e940a332ec059bc032ede56fd28fea63013862038c874b1537b905d9be0b1c2aa9f0424d5a3e86ef6309d1784a3c0b56d3a
7
- data.tar.gz: 2f8c878b83effecd7ed1d52698c1b13229477604639a593d3f42a4833febd225bc69d2a74d04a3a55360fb7d8c95e6f0708feeb3908e78967f9e891c802b28c3
6
+ metadata.gz: 407fc4c5de4a8347616dde8a71db841ccd4193a6e7b38cc42e2b8df41df3350d7fe1eb03d6d996a3d9589f1e2cd215165c9e8078160fc8ae610ed19e9ace6bd1
7
+ data.tar.gz: ffc9a729b8a42a08d0e4d74b5e3b47c96a1c008bfcb5188b31df56ce5a3bd7608409432f116bd6c59e0a7ce8438d2035ee28a26fa2114c6158c15cdeadfb9282
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.50.0 (2022-03-04)
5
+ ------------------
6
+
7
+ * Feature - Add waiters for server online and offline.
8
+
4
9
  1.49.0 (2022-02-24)
5
10
  ------------------
6
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.49.0
1
+ 1.50.0
@@ -1483,6 +1483,12 @@ module Aws::Transfer
1483
1483
  # resp.server.workflow_details.on_upload[0].workflow_id #=> String
1484
1484
  # resp.server.workflow_details.on_upload[0].execution_role #=> String
1485
1485
  #
1486
+ #
1487
+ # The following waiters are defined for this operation (see {Client#wait_until} for detailed usage):
1488
+ #
1489
+ # * server_offline
1490
+ # * server_online
1491
+ #
1486
1492
  # @see http://docs.aws.amazon.com/goto/WebAPI/transfer-2018-11-05/DescribeServer AWS API Documentation
1487
1493
  #
1488
1494
  # @overload describe_server(params = {})
@@ -2824,14 +2830,129 @@ module Aws::Transfer
2824
2830
  params: params,
2825
2831
  config: config)
2826
2832
  context[:gem_name] = 'aws-sdk-transfer'
2827
- context[:gem_version] = '1.49.0'
2833
+ context[:gem_version] = '1.50.0'
2828
2834
  Seahorse::Client::Request.new(handlers, context)
2829
2835
  end
2830
2836
 
2837
+ # Polls an API operation until a resource enters a desired state.
2838
+ #
2839
+ # ## Basic Usage
2840
+ #
2841
+ # A waiter will call an API operation until:
2842
+ #
2843
+ # * It is successful
2844
+ # * It enters a terminal state
2845
+ # * It makes the maximum number of attempts
2846
+ #
2847
+ # In between attempts, the waiter will sleep.
2848
+ #
2849
+ # # polls in a loop, sleeping between attempts
2850
+ # client.wait_until(waiter_name, params)
2851
+ #
2852
+ # ## Configuration
2853
+ #
2854
+ # You can configure the maximum number of polling attempts, and the
2855
+ # delay (in seconds) between each polling attempt. You can pass
2856
+ # configuration as the final arguments hash.
2857
+ #
2858
+ # # poll for ~25 seconds
2859
+ # client.wait_until(waiter_name, params, {
2860
+ # max_attempts: 5,
2861
+ # delay: 5,
2862
+ # })
2863
+ #
2864
+ # ## Callbacks
2865
+ #
2866
+ # You can be notified before each polling attempt and before each
2867
+ # delay. If you throw `:success` or `:failure` from these callbacks,
2868
+ # it will terminate the waiter.
2869
+ #
2870
+ # started_at = Time.now
2871
+ # client.wait_until(waiter_name, params, {
2872
+ #
2873
+ # # disable max attempts
2874
+ # max_attempts: nil,
2875
+ #
2876
+ # # poll for 1 hour, instead of a number of attempts
2877
+ # before_wait: -> (attempts, response) do
2878
+ # throw :failure if Time.now - started_at > 3600
2879
+ # end
2880
+ # })
2881
+ #
2882
+ # ## Handling Errors
2883
+ #
2884
+ # When a waiter is unsuccessful, it will raise an error.
2885
+ # All of the failure errors extend from
2886
+ # {Aws::Waiters::Errors::WaiterFailed}.
2887
+ #
2888
+ # begin
2889
+ # client.wait_until(...)
2890
+ # rescue Aws::Waiters::Errors::WaiterFailed
2891
+ # # resource did not enter the desired state in time
2892
+ # end
2893
+ #
2894
+ # ## Valid Waiters
2895
+ #
2896
+ # The following table lists the valid waiter names, the operations they call,
2897
+ # and the default `:delay` and `:max_attempts` values.
2898
+ #
2899
+ # | waiter_name | params | :delay | :max_attempts |
2900
+ # | -------------- | ------------------------ | -------- | ------------- |
2901
+ # | server_offline | {Client#describe_server} | 30 | 120 |
2902
+ # | server_online | {Client#describe_server} | 30 | 120 |
2903
+ #
2904
+ # @raise [Errors::FailureStateError] Raised when the waiter terminates
2905
+ # because the waiter has entered a state that it will not transition
2906
+ # out of, preventing success.
2907
+ #
2908
+ # @raise [Errors::TooManyAttemptsError] Raised when the configured
2909
+ # maximum number of attempts have been made, and the waiter is not
2910
+ # yet successful.
2911
+ #
2912
+ # @raise [Errors::UnexpectedError] Raised when an error is encounted
2913
+ # while polling for a resource that is not expected.
2914
+ #
2915
+ # @raise [Errors::NoSuchWaiterError] Raised when you request to wait
2916
+ # for an unknown state.
2917
+ #
2918
+ # @return [Boolean] Returns `true` if the waiter was successful.
2919
+ # @param [Symbol] waiter_name
2920
+ # @param [Hash] params ({})
2921
+ # @param [Hash] options ({})
2922
+ # @option options [Integer] :max_attempts
2923
+ # @option options [Integer] :delay
2924
+ # @option options [Proc] :before_attempt
2925
+ # @option options [Proc] :before_wait
2926
+ def wait_until(waiter_name, params = {}, options = {})
2927
+ w = waiter(waiter_name, options)
2928
+ yield(w.waiter) if block_given? # deprecated
2929
+ w.wait(params)
2930
+ end
2931
+
2831
2932
  # @api private
2832
2933
  # @deprecated
2833
2934
  def waiter_names
2834
- []
2935
+ waiters.keys
2936
+ end
2937
+
2938
+ private
2939
+
2940
+ # @param [Symbol] waiter_name
2941
+ # @param [Hash] options ({})
2942
+ def waiter(waiter_name, options = {})
2943
+ waiter_class = waiters[waiter_name]
2944
+ if waiter_class
2945
+ waiter_class.new(options.merge(client: self))
2946
+ else
2947
+ raise Aws::Waiters::Errors::NoSuchWaiterError.new(waiter_name, waiters.keys)
2948
+ end
2949
+ end
2950
+
2951
+ def waiters
2952
+ {
2953
+ server_offline: Waiters::ServerOffline,
2954
+ server_online: Waiters::ServerOnline
2955
+ }
2835
2956
  end
2836
2957
 
2837
2958
  class << self
@@ -0,0 +1,165 @@
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::Transfer
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
+ # | server_offline | {Client#describe_server} | 30 | 120 |
73
+ # | server_online | {Client#describe_server} | 30 | 120 |
74
+ #
75
+ module Waiters
76
+
77
+ class ServerOffline
78
+
79
+ # @param [Hash] options
80
+ # @option options [required, Client] :client
81
+ # @option options [Integer] :max_attempts (120)
82
+ # @option options [Integer] :delay (30)
83
+ # @option options [Proc] :before_attempt
84
+ # @option options [Proc] :before_wait
85
+ def initialize(options)
86
+ @client = options.fetch(:client)
87
+ @waiter = Aws::Waiters::Waiter.new({
88
+ max_attempts: 120,
89
+ delay: 30,
90
+ poller: Aws::Waiters::Poller.new(
91
+ operation_name: :describe_server,
92
+ acceptors: [
93
+ {
94
+ "argument" => "server.state",
95
+ "expected" => "OFFLINE",
96
+ "matcher" => "path",
97
+ "state" => "success"
98
+ },
99
+ {
100
+ "argument" => "server.state",
101
+ "expected" => "STOP_FAILED",
102
+ "matcher" => "path",
103
+ "state" => "failure"
104
+ }
105
+ ]
106
+ )
107
+ }.merge(options))
108
+ end
109
+
110
+ # @option (see Client#describe_server)
111
+ # @return (see Client#describe_server)
112
+ def wait(params = {})
113
+ @waiter.wait(client: @client, params: params)
114
+ end
115
+
116
+ # @api private
117
+ attr_reader :waiter
118
+
119
+ end
120
+
121
+ class ServerOnline
122
+
123
+ # @param [Hash] options
124
+ # @option options [required, Client] :client
125
+ # @option options [Integer] :max_attempts (120)
126
+ # @option options [Integer] :delay (30)
127
+ # @option options [Proc] :before_attempt
128
+ # @option options [Proc] :before_wait
129
+ def initialize(options)
130
+ @client = options.fetch(:client)
131
+ @waiter = Aws::Waiters::Waiter.new({
132
+ max_attempts: 120,
133
+ delay: 30,
134
+ poller: Aws::Waiters::Poller.new(
135
+ operation_name: :describe_server,
136
+ acceptors: [
137
+ {
138
+ "argument" => "server.state",
139
+ "expected" => "ONLINE",
140
+ "matcher" => "path",
141
+ "state" => "success"
142
+ },
143
+ {
144
+ "argument" => "server.state",
145
+ "expected" => "START_FAILED",
146
+ "matcher" => "path",
147
+ "state" => "failure"
148
+ }
149
+ ]
150
+ )
151
+ }.merge(options))
152
+ end
153
+
154
+ # @option (see Client#describe_server)
155
+ # @return (see Client#describe_server)
156
+ def wait(params = {})
157
+ @waiter.wait(client: @client, params: params)
158
+ end
159
+
160
+ # @api private
161
+ attr_reader :waiter
162
+
163
+ end
164
+ end
165
+ end
@@ -15,6 +15,7 @@ require_relative 'aws-sdk-transfer/types'
15
15
  require_relative 'aws-sdk-transfer/client_api'
16
16
  require_relative 'aws-sdk-transfer/client'
17
17
  require_relative 'aws-sdk-transfer/errors'
18
+ require_relative 'aws-sdk-transfer/waiters'
18
19
  require_relative 'aws-sdk-transfer/resource'
19
20
  require_relative 'aws-sdk-transfer/customizations'
20
21
 
@@ -48,6 +49,6 @@ require_relative 'aws-sdk-transfer/customizations'
48
49
  # @!group service
49
50
  module Aws::Transfer
50
51
 
51
- GEM_VERSION = '1.49.0'
52
+ GEM_VERSION = '1.50.0'
52
53
 
53
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-transfer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.49.0
4
+ version: 1.50.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: 2022-02-24 00:00:00.000000000 Z
11
+ date: 2022-03-04 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-transfer/errors.rb
63
63
  - lib/aws-sdk-transfer/resource.rb
64
64
  - lib/aws-sdk-transfer/types.rb
65
+ - lib/aws-sdk-transfer/waiters.rb
65
66
  homepage: https://github.com/aws/aws-sdk-ruby
66
67
  licenses:
67
68
  - Apache-2.0