aws-sdk-ecr 1.3.0 → 1.69.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,167 @@
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::ECR
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
+ # | image_scan_complete | {Client#describe_image_scan_findings} | 5 | 60 |
73
+ # | lifecycle_policy_preview_complete | {Client#get_lifecycle_policy_preview} | 5 | 20 |
74
+ #
75
+ module Waiters
76
+
77
+ # Wait until an image scan is complete and findings can be accessed
78
+ class ImageScanComplete
79
+
80
+ # @param [Hash] options
81
+ # @option options [required, Client] :client
82
+ # @option options [Integer] :max_attempts (60)
83
+ # @option options [Integer] :delay (5)
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: 5,
91
+ poller: Aws::Waiters::Poller.new(
92
+ operation_name: :describe_image_scan_findings,
93
+ acceptors: [
94
+ {
95
+ "state" => "success",
96
+ "matcher" => "path",
97
+ "argument" => "image_scan_status.status",
98
+ "expected" => "COMPLETE"
99
+ },
100
+ {
101
+ "state" => "failure",
102
+ "matcher" => "path",
103
+ "argument" => "image_scan_status.status",
104
+ "expected" => "FAILED"
105
+ }
106
+ ]
107
+ )
108
+ }.merge(options))
109
+ end
110
+
111
+ # @option (see Client#describe_image_scan_findings)
112
+ # @return (see Client#describe_image_scan_findings)
113
+ def wait(params = {})
114
+ @waiter.wait(client: @client, params: params)
115
+ end
116
+
117
+ # @api private
118
+ attr_reader :waiter
119
+
120
+ end
121
+
122
+ # Wait until a lifecycle policy preview request is complete and results can be accessed
123
+ class LifecyclePolicyPreviewComplete
124
+
125
+ # @param [Hash] options
126
+ # @option options [required, Client] :client
127
+ # @option options [Integer] :max_attempts (20)
128
+ # @option options [Integer] :delay (5)
129
+ # @option options [Proc] :before_attempt
130
+ # @option options [Proc] :before_wait
131
+ def initialize(options)
132
+ @client = options.fetch(:client)
133
+ @waiter = Aws::Waiters::Waiter.new({
134
+ max_attempts: 20,
135
+ delay: 5,
136
+ poller: Aws::Waiters::Poller.new(
137
+ operation_name: :get_lifecycle_policy_preview,
138
+ acceptors: [
139
+ {
140
+ "state" => "success",
141
+ "matcher" => "path",
142
+ "argument" => "status",
143
+ "expected" => "COMPLETE"
144
+ },
145
+ {
146
+ "state" => "failure",
147
+ "matcher" => "path",
148
+ "argument" => "status",
149
+ "expected" => "FAILED"
150
+ }
151
+ ]
152
+ )
153
+ }.merge(options))
154
+ end
155
+
156
+ # @option (see Client#get_lifecycle_policy_preview)
157
+ # @return (see Client#get_lifecycle_policy_preview)
158
+ def wait(params = {})
159
+ @waiter.wait(client: @client, params: params)
160
+ end
161
+
162
+ # @api private
163
+ attr_reader :waiter
164
+
165
+ end
166
+ end
167
+ end
data/lib/aws-sdk-ecr.rb CHANGED
@@ -1,18 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # WARNING ABOUT GENERATED CODE
2
4
  #
3
5
  # This file is generated. See the contributing guide for more information:
4
- # https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
6
+ # https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
5
7
  #
6
8
  # WARNING ABOUT GENERATED CODE
7
9
 
10
+
8
11
  require 'aws-sdk-core'
9
12
  require 'aws-sigv4'
10
13
 
11
14
  require_relative 'aws-sdk-ecr/types'
12
15
  require_relative 'aws-sdk-ecr/client_api'
16
+ require_relative 'aws-sdk-ecr/plugins/endpoints.rb'
13
17
  require_relative 'aws-sdk-ecr/client'
14
18
  require_relative 'aws-sdk-ecr/errors'
19
+ require_relative 'aws-sdk-ecr/waiters'
15
20
  require_relative 'aws-sdk-ecr/resource'
21
+ require_relative 'aws-sdk-ecr/endpoint_parameters'
22
+ require_relative 'aws-sdk-ecr/endpoint_provider'
23
+ require_relative 'aws-sdk-ecr/endpoints'
16
24
  require_relative 'aws-sdk-ecr/customizations'
17
25
 
18
26
  # This module provides support for Amazon EC2 Container Registry. This module is available in the
@@ -24,24 +32,27 @@ require_relative 'aws-sdk-ecr/customizations'
24
32
  # methods each accept a hash of request parameters and return a response
25
33
  # structure.
26
34
  #
35
+ # ecr = Aws::ECR::Client.new
36
+ # resp = ecr.batch_check_layer_availability(params)
37
+ #
27
38
  # See {Client} for more information.
28
39
  #
29
40
  # # Errors
30
41
  #
31
- # Errors returned from Amazon EC2 Container Registry all
32
- # extend {Errors::ServiceError}.
42
+ # Errors returned from Amazon EC2 Container Registry are defined in the
43
+ # {Errors} module and all extend {Errors::ServiceError}.
33
44
  #
34
45
  # begin
35
46
  # # do stuff
36
47
  # rescue Aws::ECR::Errors::ServiceError
37
- # # rescues all service API errors
48
+ # # rescues all Amazon EC2 Container Registry API errors
38
49
  # end
39
50
  #
40
51
  # See {Errors} for more information.
41
52
  #
42
- # @service
53
+ # @!group service
43
54
  module Aws::ECR
44
55
 
45
- GEM_VERSION = '1.3.0'
56
+ GEM_VERSION = '1.69.0'
46
57
 
47
58
  end