aws-sdk-continuum 1.0.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.
@@ -0,0 +1,121 @@
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::Continuum
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
+ # | code_scan_succeeded | {Client#get_code_scan} | 60 | 480 |
73
+ #
74
+ module Waiters
75
+
76
+ # Waits until the scan reaches SUCCEEDED, at which point the scan has finished and its findings are available from ListCodeFindings (filter on scanRunId). Triage of those findings and creation of issues continue asynchronously after the scan succeeds. Fails if the scan reaches FAILED. Scans run a build followed by analysis and can take from minutes to several hours. SDKs that use exponential backoff wait at least 60 seconds between polls and back off to at most 8 hours between polls, until the caller's maximum wait time elapses. SDKs and the AWS CLI that use a fixed delay poll every 60 seconds for up to 480 attempts (8 hours).
77
+ class CodeScanSucceeded
78
+
79
+ # @param [Hash] options
80
+ # @option options [required, Client] :client
81
+ # @option options [Integer] :max_attempts (480)
82
+ # @option options [Integer] :delay (60)
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: 480,
89
+ delay: 60,
90
+ poller: Aws::Waiters::Poller.new(
91
+ operation_name: :get_code_scan,
92
+ acceptors: [
93
+ {
94
+ "matcher" => "path",
95
+ "argument" => "scan.status",
96
+ "state" => "success",
97
+ "expected" => "SUCCEEDED"
98
+ },
99
+ {
100
+ "matcher" => "path",
101
+ "argument" => "scan.status",
102
+ "state" => "failure",
103
+ "expected" => "FAILED"
104
+ }
105
+ ]
106
+ )
107
+ }.merge(options))
108
+ end
109
+
110
+ # @option (see Client#get_code_scan)
111
+ # @return (see Client#get_code_scan)
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
+ end
121
+ end
@@ -0,0 +1,62 @@
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
+
11
+ require 'aws-sdk-core'
12
+ require 'aws-sigv4'
13
+
14
+ Aws::Plugins::GlobalConfiguration.add_identifier(:continuum)
15
+
16
+ # This module provides support for AWS Continuum. This module is available in the
17
+ # `aws-sdk-continuum` gem.
18
+ #
19
+ # # Client
20
+ #
21
+ # The {Client} class provides one method for each API operation. Operation
22
+ # methods each accept a hash of request parameters and return a response
23
+ # structure.
24
+ #
25
+ # continuum = Aws::Continuum::Client.new
26
+ # resp = continuum.associate_collector(params)
27
+ #
28
+ # See {Client} for more information.
29
+ #
30
+ # # Errors
31
+ #
32
+ # Errors returned from AWS Continuum are defined in the
33
+ # {Errors} module and all extend {Errors::ServiceError}.
34
+ #
35
+ # begin
36
+ # # do stuff
37
+ # rescue Aws::Continuum::Errors::ServiceError
38
+ # # rescues all AWS Continuum API errors
39
+ # end
40
+ #
41
+ # See {Errors} for more information.
42
+ #
43
+ # @!group service
44
+ module Aws::Continuum
45
+ autoload :Types, 'aws-sdk-continuum/types'
46
+ autoload :ClientApi, 'aws-sdk-continuum/client_api'
47
+ module Plugins
48
+ autoload :Endpoints, 'aws-sdk-continuum/plugins/endpoints.rb'
49
+ end
50
+ autoload :Client, 'aws-sdk-continuum/client'
51
+ autoload :Errors, 'aws-sdk-continuum/errors'
52
+ autoload :Waiters, 'aws-sdk-continuum/waiters'
53
+ autoload :Resource, 'aws-sdk-continuum/resource'
54
+ autoload :EndpointParameters, 'aws-sdk-continuum/endpoint_parameters'
55
+ autoload :EndpointProvider, 'aws-sdk-continuum/endpoint_provider'
56
+ autoload :Endpoints, 'aws-sdk-continuum/endpoints'
57
+
58
+ GEM_VERSION = '1.0.0'
59
+
60
+ end
61
+
62
+ require_relative 'aws-sdk-continuum/customizations'