aws-sdk-resources 2.0.34 → 2.0.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e919f0b752d0c452b8a330bfe8e20d0e05ea32e6
4
- data.tar.gz: cac98b1667805d16c0d07ec074a17dee0692515b
3
+ metadata.gz: 25964c9557fb27724f67bfddf9709199f2fd111c
4
+ data.tar.gz: e4fdff1ab152b2625c2525c81aa05c7dc2343d12
5
5
  SHA512:
6
- metadata.gz: bd0ac1a60590c3563ca0cfb33df6b7d8dd7c35401130b82ee9a9b66f78592f67352c3090b4c55fcd021a5bfae9f4f8cdb2db2dcf2a2a721e997aa0cb18cdfc69
7
- data.tar.gz: bfce885ffbc5105dfb9e4b8cb16fa504139858ff82f045228d97df8909e6d054ba2530a28bf73e90c2756a17b84c8fa7fd318629749f95812a930fe69973b40d
6
+ metadata.gz: 0a74c603f35b9181b20e4041bcfc00acf534998781e69df7ca859d232c7e3aec25894d21ddff02a00df6976bcdc4dbca4906ce87187a41e9fb7c07b4aba5849a
7
+ data.tar.gz: 4ca2daea3869b9d685137d5136d0ffc05f43c5b09e9552dd335225ebff7d8382aa0b3da5fa4aa402930dbf61b14a53dbce28e2f426924f95b91f28069eb23992
@@ -94,7 +94,7 @@ module Aws
94
94
  m.source_type = :json
95
95
  m.source = source.format
96
96
  filename = source.file
97
- filename = filename.match('(aws-sdk-core/apis/.+\.resources\.json)')[1]
97
+ filename = filename.match('(aws-sdk-core/apis/.+)')[1]
98
98
  m.add_file(filename, nil, true)
99
99
  end
100
100
  tags.each do |tag|
@@ -23,6 +23,98 @@ module Aws
23
23
  # @return [Hash<Symbol,String>]
24
24
  attr_reader :identifiers
25
25
 
26
+ # Waiter polls an API operation until a resource enters a desired
27
+ # state.
28
+ #
29
+ # @note The waiting operation is performed on a copy. The original resource remains unchanged
30
+ #
31
+ # ## Basic Usage
32
+ #
33
+ # Waiter will polls until it is succesful, it fails by
34
+ # entering a terminal state, or until a maximum number of attempts
35
+ # are made.
36
+ #
37
+ # # polls in a loop until condition is true
38
+ # resource.wait_until(options) {|resource| condition}
39
+ #
40
+ # ## Example
41
+ #
42
+ # instance.wait_until(max_attempts:10, delay:5) {|instance| instance.state.name == 'running' }
43
+ #
44
+ # ## Configuration
45
+ #
46
+ # You can configure the maximum number of polling attempts, and the
47
+ # delay (in seconds) between each polling attempt. The waiting condition is set
48
+ # by passing a block to {#wait_until}:
49
+ #
50
+ # # poll for ~25 seconds
51
+ # resource.wait_until(max_attempts:5,delay:5) {|resource|...}
52
+ #
53
+ # ## Callbacks
54
+ #
55
+ # You can be notified before each polling attempt and before each
56
+ # delay. If you throw `:success` or `:failure` from these callbacks,
57
+ # it will terminate the waiter.
58
+ #
59
+ # started_at = Time.now
60
+ # # poll for 1 hour, instead of a number of attempts
61
+ # proc = Proc.new do |attempts, response|
62
+ # throw :failure if Time.now - started_at > 3600
63
+ # end
64
+ #
65
+ # # disable max attempts
66
+ # instance.wait_until(before_wait:proc, max_attempts:nil) {...}
67
+ #
68
+ # ## Handling Errors
69
+ #
70
+ # When a waiter is successful, it returns the Resource. When a waiter
71
+ # fails, it raises an error.
72
+ #
73
+ # begin
74
+ # resource.wait_until(...)
75
+ # rescue Aws::Waiters::Errors::WaiterFailed
76
+ # # resource did not enter the desired state in time
77
+ # end
78
+ #
79
+ #
80
+ # @yieldparam [Resource] resource to be used in the waiting condition
81
+ #
82
+ # @raise [Aws::Waiters::Errors::FailureStateError] Raised when the waiter terminates
83
+ # because the waiter has entered a state that it will not transition
84
+ # out of, preventing success.
85
+ #
86
+ # @raise [Aws::Waiters::Errors::TooManyAttemptsError] Raised when the configured
87
+ # maximum number of attempts have been made, and the waiter is not
88
+ # yet successful.
89
+ #
90
+ # @raise [Aws::Waiters::Errors::UnexpectedError] Raised when an error is encounted
91
+ # while polling for a resource that is not expected.
92
+ #
93
+ # @raise [NotImplementedError] Raised when the resource does not
94
+ # support #reload operation
95
+ #
96
+ # @option options [Integer] :max_attempts (10) Maximum number of attempts
97
+ # @option options [Integer] :delay (10) Delay between each attempt in seconds
98
+ # @option options [Proc] :before_attempt (nil) Callback invoked before each attempt
99
+ # @option options [Proc] :before_wait (nil) Callback invoked before each wait
100
+ # @return [Resource] if the waiter was successful
101
+ def wait_until(options = {}, &block)
102
+ resource_copy = self.dup
103
+ attempts = 0
104
+ options[:max_attempts] ||= 10
105
+ options[:delay] ||= 10
106
+ options[:poller] = Proc.new do
107
+ attempts += 1
108
+ if block.call(resource_copy)
109
+ [:success, resource_copy]
110
+ else
111
+ resource_copy.reload unless attempts == options[:max_attempts]
112
+ :retry
113
+ end
114
+ end
115
+ Waiters::Waiter.new(options).wait({})
116
+ end
117
+
26
118
  # @return [Struct]
27
119
  def data
28
120
  load unless @data
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.34
4
+ version: 2.0.35
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: 2015-04-02 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.34
19
+ version: 2.0.35
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.34
26
+ version: 2.0.35
27
27
  description: Provides resource oriented interfaces and other higher-level abstractions
28
28
  for many AWS services. This gem is part of the official AWS SDK for Ruby.
29
29
  email:
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.4.6
107
+ rubygems_version: 2.4.5
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: AWS SDK for Ruby - Resources