aws-sdk-ecr 1.23.0 → 1.24.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
  SHA1:
3
- metadata.gz: 22d1ed8cf01031d960bf658999fea1378f262100
4
- data.tar.gz: 0c312cf8cc0510fc830636d58d01b9e160ce7a30
3
+ metadata.gz: 695a39bbac45848e68529621e4d9914c9035d255
4
+ data.tar.gz: 871c57b7957fc8678eff180170ffe4e0b8678b10
5
5
  SHA512:
6
- metadata.gz: f5709aa80ad1be5cfb01e1fb6023942cc1fb51c8bb3d82c165ff7858669b2508d161d6341d63802780fc237b322b21ab0f5bdf86b9ee78a906af7355132dc18e
7
- data.tar.gz: 50e44ff1e8f59bb27c63146e66f2aafada56eeb40ba43dc50460ed2d95d0af0b87c7da3d9cbc8b26e3084bfe7262823bfc4b7278427f365c5a40a89eec19d05a
6
+ metadata.gz: 4417785f27ea27c21593d4d4ce20c75bc2b966848a4176602a9392bdcf031a59c4a6d1aaa34c41eb710ff204b16c48c9da7eac7a2863cc3227eed330837b1491
7
+ data.tar.gz: 7026b8dcee205e6c4d058eba05fbd7ac2c91b76e071c8ed8f9b3c25fad39c673ea854f783659cccba518ac4802b17861d5fdb0cfa1fcf2148b25c64a4a235f2b
@@ -12,6 +12,7 @@ require_relative 'aws-sdk-ecr/types'
12
12
  require_relative 'aws-sdk-ecr/client_api'
13
13
  require_relative 'aws-sdk-ecr/client'
14
14
  require_relative 'aws-sdk-ecr/errors'
15
+ require_relative 'aws-sdk-ecr/waiters'
15
16
  require_relative 'aws-sdk-ecr/resource'
16
17
  require_relative 'aws-sdk-ecr/customizations'
17
18
 
@@ -42,6 +43,6 @@ require_relative 'aws-sdk-ecr/customizations'
42
43
  # @service
43
44
  module Aws::ECR
44
45
 
45
- GEM_VERSION = '1.23.0'
46
+ GEM_VERSION = '1.24.0'
46
47
 
47
48
  end
@@ -2065,14 +2065,129 @@ module Aws::ECR
2065
2065
  params: params,
2066
2066
  config: config)
2067
2067
  context[:gem_name] = 'aws-sdk-ecr'
2068
- context[:gem_version] = '1.23.0'
2068
+ context[:gem_version] = '1.24.0'
2069
2069
  Seahorse::Client::Request.new(handlers, context)
2070
2070
  end
2071
2071
 
2072
+ # Polls an API operation until a resource enters a desired state.
2073
+ #
2074
+ # ## Basic Usage
2075
+ #
2076
+ # A waiter will call an API operation until:
2077
+ #
2078
+ # * It is successful
2079
+ # * It enters a terminal state
2080
+ # * It makes the maximum number of attempts
2081
+ #
2082
+ # In between attempts, the waiter will sleep.
2083
+ #
2084
+ # # polls in a loop, sleeping between attempts
2085
+ # client.wait_until(waiter_name, params)
2086
+ #
2087
+ # ## Configuration
2088
+ #
2089
+ # You can configure the maximum number of polling attempts, and the
2090
+ # delay (in seconds) between each polling attempt. You can pass
2091
+ # configuration as the final arguments hash.
2092
+ #
2093
+ # # poll for ~25 seconds
2094
+ # client.wait_until(waiter_name, params, {
2095
+ # max_attempts: 5,
2096
+ # delay: 5,
2097
+ # })
2098
+ #
2099
+ # ## Callbacks
2100
+ #
2101
+ # You can be notified before each polling attempt and before each
2102
+ # delay. If you throw `:success` or `:failure` from these callbacks,
2103
+ # it will terminate the waiter.
2104
+ #
2105
+ # started_at = Time.now
2106
+ # client.wait_until(waiter_name, params, {
2107
+ #
2108
+ # # disable max attempts
2109
+ # max_attempts: nil,
2110
+ #
2111
+ # # poll for 1 hour, instead of a number of attempts
2112
+ # before_wait: -> (attempts, response) do
2113
+ # throw :failure if Time.now - started_at > 3600
2114
+ # end
2115
+ # })
2116
+ #
2117
+ # ## Handling Errors
2118
+ #
2119
+ # When a waiter is unsuccessful, it will raise an error.
2120
+ # All of the failure errors extend from
2121
+ # {Aws::Waiters::Errors::WaiterFailed}.
2122
+ #
2123
+ # begin
2124
+ # client.wait_until(...)
2125
+ # rescue Aws::Waiters::Errors::WaiterFailed
2126
+ # # resource did not enter the desired state in time
2127
+ # end
2128
+ #
2129
+ # ## Valid Waiters
2130
+ #
2131
+ # The following table lists the valid waiter names, the operations they call,
2132
+ # and the default `:delay` and `:max_attempts` values.
2133
+ #
2134
+ # | waiter_name | params | :delay | :max_attempts |
2135
+ # | --------------------------------- | ------------------------------- | -------- | ------------- |
2136
+ # | image_scan_complete | {#describe_image_scan_findings} | 5 | 60 |
2137
+ # | lifecycle_policy_preview_complete | {#get_lifecycle_policy_preview} | 5 | 20 |
2138
+ #
2139
+ # @raise [Errors::FailureStateError] Raised when the waiter terminates
2140
+ # because the waiter has entered a state that it will not transition
2141
+ # out of, preventing success.
2142
+ #
2143
+ # @raise [Errors::TooManyAttemptsError] Raised when the configured
2144
+ # maximum number of attempts have been made, and the waiter is not
2145
+ # yet successful.
2146
+ #
2147
+ # @raise [Errors::UnexpectedError] Raised when an error is encounted
2148
+ # while polling for a resource that is not expected.
2149
+ #
2150
+ # @raise [Errors::NoSuchWaiterError] Raised when you request to wait
2151
+ # for an unknown state.
2152
+ #
2153
+ # @return [Boolean] Returns `true` if the waiter was successful.
2154
+ # @param [Symbol] waiter_name
2155
+ # @param [Hash] params ({})
2156
+ # @param [Hash] options ({})
2157
+ # @option options [Integer] :max_attempts
2158
+ # @option options [Integer] :delay
2159
+ # @option options [Proc] :before_attempt
2160
+ # @option options [Proc] :before_wait
2161
+ def wait_until(waiter_name, params = {}, options = {})
2162
+ w = waiter(waiter_name, options)
2163
+ yield(w.waiter) if block_given? # deprecated
2164
+ w.wait(params)
2165
+ end
2166
+
2072
2167
  # @api private
2073
2168
  # @deprecated
2074
2169
  def waiter_names
2075
- []
2170
+ waiters.keys
2171
+ end
2172
+
2173
+ private
2174
+
2175
+ # @param [Symbol] waiter_name
2176
+ # @param [Hash] options ({})
2177
+ def waiter(waiter_name, options = {})
2178
+ waiter_class = waiters[waiter_name]
2179
+ if waiter_class
2180
+ waiter_class.new(options.merge(client: self))
2181
+ else
2182
+ raise Aws::Waiters::Errors::NoSuchWaiterError.new(waiter_name, waiters.keys)
2183
+ end
2184
+ end
2185
+
2186
+ def waiters
2187
+ {
2188
+ image_scan_complete: Waiters::ImageScanComplete,
2189
+ lifecycle_policy_preview_complete: Waiters::LifecyclePolicyPreviewComplete
2190
+ }
2076
2191
  end
2077
2192
 
2078
2193
  class << self
@@ -0,0 +1,103 @@
1
+ # WARNING ABOUT GENERATED CODE
2
+ #
3
+ # This file is generated. See the contributing guide for more information:
4
+ # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
5
+ #
6
+ # WARNING ABOUT GENERATED CODE
7
+
8
+ require 'aws-sdk-core/waiters'
9
+
10
+ module Aws::ECR
11
+ module Waiters
12
+
13
+ # Wait until an image scan is complete and findings can be accessed
14
+ class ImageScanComplete
15
+
16
+ # @param [Hash] options
17
+ # @option options [required, Client] :client
18
+ # @option options [Integer] :max_attempts (60)
19
+ # @option options [Integer] :delay (5)
20
+ # @option options [Proc] :before_attempt
21
+ # @option options [Proc] :before_wait
22
+ def initialize(options)
23
+ @client = options.fetch(:client)
24
+ @waiter = Aws::Waiters::Waiter.new({
25
+ max_attempts: 60,
26
+ delay: 5,
27
+ poller: Aws::Waiters::Poller.new(
28
+ operation_name: :describe_image_scan_findings,
29
+ acceptors: [
30
+ {
31
+ "state" => "success",
32
+ "matcher" => "path",
33
+ "argument" => "image_scan_status.status",
34
+ "expected" => "COMPLETE"
35
+ },
36
+ {
37
+ "state" => "failure",
38
+ "matcher" => "path",
39
+ "argument" => "image_scan_status.status",
40
+ "expected" => "FAILED"
41
+ }
42
+ ]
43
+ )
44
+ }.merge(options))
45
+ end
46
+
47
+ # @option (see Client#describe_image_scan_findings)
48
+ # @return (see Client#describe_image_scan_findings)
49
+ def wait(params = {})
50
+ @waiter.wait(client: @client, params: params)
51
+ end
52
+
53
+ # @api private
54
+ attr_reader :waiter
55
+
56
+ end
57
+
58
+ # Wait until a lifecycle policy preview request is complete and results can be accessed
59
+ class LifecyclePolicyPreviewComplete
60
+
61
+ # @param [Hash] options
62
+ # @option options [required, Client] :client
63
+ # @option options [Integer] :max_attempts (20)
64
+ # @option options [Integer] :delay (5)
65
+ # @option options [Proc] :before_attempt
66
+ # @option options [Proc] :before_wait
67
+ def initialize(options)
68
+ @client = options.fetch(:client)
69
+ @waiter = Aws::Waiters::Waiter.new({
70
+ max_attempts: 20,
71
+ delay: 5,
72
+ poller: Aws::Waiters::Poller.new(
73
+ operation_name: :get_lifecycle_policy_preview,
74
+ acceptors: [
75
+ {
76
+ "state" => "success",
77
+ "matcher" => "path",
78
+ "argument" => "status",
79
+ "expected" => "COMPLETE"
80
+ },
81
+ {
82
+ "state" => "failure",
83
+ "matcher" => "path",
84
+ "argument" => "status",
85
+ "expected" => "FAILED"
86
+ }
87
+ ]
88
+ )
89
+ }.merge(options))
90
+ end
91
+
92
+ # @option (see Client#get_lifecycle_policy_preview)
93
+ # @return (see Client#get_lifecycle_policy_preview)
94
+ def wait(params = {})
95
+ @waiter.wait(client: @client, params: params)
96
+ end
97
+
98
+ # @api private
99
+ attr_reader :waiter
100
+
101
+ end
102
+ end
103
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-ecr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.0
4
+ version: 1.24.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: 2019-11-08 00:00:00.000000000 Z
11
+ date: 2020-01-02 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-ecr/errors.rb
60
60
  - lib/aws-sdk-ecr/resource.rb
61
61
  - lib/aws-sdk-ecr/types.rb
62
+ - lib/aws-sdk-ecr/waiters.rb
62
63
  homepage: https://github.com/aws/aws-sdk-ruby
63
64
  licenses:
64
65
  - Apache-2.0