aws-sdk-payments 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,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
+ module Aws::Payments
11
+
12
+ # When Payments returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::Payments::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all Payments errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::Payments::Errors::ServiceError
20
+ # # rescues all Payments API errors
21
+ # end
22
+ #
23
+ #
24
+ # ## Request Context
25
+ # ServiceError objects have a {Aws::Errors::ServiceError#context #context} method that returns
26
+ # information about the request that generated the error.
27
+ # See {Seahorse::Client::RequestContext} for more information.
28
+ #
29
+ # ## Error Classes
30
+ # * {AccessDeniedException}
31
+ # * {InternalServerException}
32
+ # * {ResourceNotFoundException}
33
+ # * {ThrottlingException}
34
+ # * {ValidationException}
35
+ #
36
+ # Additionally, error classes are dynamically generated for service errors based on the error code
37
+ # if they are not defined above.
38
+ module Errors
39
+
40
+ extend Aws::Errors::DynamicErrors
41
+
42
+ class AccessDeniedException < ServiceError
43
+
44
+ # @param [Seahorse::Client::RequestContext] context
45
+ # @param [String] message
46
+ # @param [Aws::Payments::Types::AccessDeniedException] data
47
+ def initialize(context, message, data = Aws::EmptyStructure.new)
48
+ super(context, message, data)
49
+ end
50
+
51
+ # @return [String]
52
+ def message
53
+ @message || @data[:message]
54
+ end
55
+
56
+ # @return [String]
57
+ def reason
58
+ @data[:reason]
59
+ end
60
+ end
61
+
62
+ class InternalServerException < ServiceError
63
+
64
+ # @param [Seahorse::Client::RequestContext] context
65
+ # @param [String] message
66
+ # @param [Aws::Payments::Types::InternalServerException] data
67
+ def initialize(context, message, data = Aws::EmptyStructure.new)
68
+ super(context, message, data)
69
+ end
70
+
71
+ # @return [String]
72
+ def message
73
+ @message || @data[:message]
74
+ end
75
+
76
+ # @return [String]
77
+ def retry_after_seconds
78
+ @data[:retry_after_seconds]
79
+ end
80
+
81
+ def retryable?
82
+ true
83
+ end
84
+ end
85
+
86
+ class ResourceNotFoundException < ServiceError
87
+
88
+ # @param [Seahorse::Client::RequestContext] context
89
+ # @param [String] message
90
+ # @param [Aws::Payments::Types::ResourceNotFoundException] data
91
+ def initialize(context, message, data = Aws::EmptyStructure.new)
92
+ super(context, message, data)
93
+ end
94
+
95
+ # @return [String]
96
+ def message
97
+ @message || @data[:message]
98
+ end
99
+
100
+ # @return [String]
101
+ def resource_id
102
+ @data[:resource_id]
103
+ end
104
+
105
+ # @return [String]
106
+ def resource_type
107
+ @data[:resource_type]
108
+ end
109
+ end
110
+
111
+ class ThrottlingException < ServiceError
112
+
113
+ # @param [Seahorse::Client::RequestContext] context
114
+ # @param [String] message
115
+ # @param [Aws::Payments::Types::ThrottlingException] data
116
+ def initialize(context, message, data = Aws::EmptyStructure.new)
117
+ super(context, message, data)
118
+ end
119
+
120
+ # @return [String]
121
+ def message
122
+ @message || @data[:message]
123
+ end
124
+
125
+ # @return [String]
126
+ def retry_after_seconds
127
+ @data[:retry_after_seconds]
128
+ end
129
+
130
+ def retryable?
131
+ true
132
+ end
133
+
134
+ def throttling?
135
+ true
136
+ end
137
+ end
138
+
139
+ class ValidationException < ServiceError
140
+
141
+ # @param [Seahorse::Client::RequestContext] context
142
+ # @param [String] message
143
+ # @param [Aws::Payments::Types::ValidationException] data
144
+ def initialize(context, message, data = Aws::EmptyStructure.new)
145
+ super(context, message, data)
146
+ end
147
+
148
+ # @return [String]
149
+ def message
150
+ @message || @data[:message]
151
+ end
152
+
153
+ # @return [String]
154
+ def reason
155
+ @data[:reason]
156
+ end
157
+
158
+ # @return [String]
159
+ def field_list
160
+ @data[:field_list]
161
+ end
162
+ end
163
+
164
+ end
165
+ end
@@ -0,0 +1,77 @@
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
+ module Aws::Payments
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::Payments::EndpointProvider',
17
+ rbs_type: 'untyped',
18
+ docstring: <<~DOCS) do |_cfg|
19
+ The endpoint provider used to resolve endpoints. Any object that responds to
20
+ `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to
21
+ `Aws::Payments::EndpointParameters`.
22
+ DOCS
23
+ Aws::Payments::EndpointProvider.new
24
+ end
25
+
26
+ # @api private
27
+ class Handler < Seahorse::Client::Handler
28
+ def call(context)
29
+ unless context[:discovered_endpoint]
30
+ params = Aws::Payments::Endpoints.parameters_for_operation(context)
31
+ endpoint = context.config.endpoint_provider.resolve_endpoint(params)
32
+
33
+ context.http_request.endpoint = endpoint.url
34
+ apply_endpoint_headers(context, endpoint.headers)
35
+
36
+ context[:endpoint_params] = params
37
+ context[:endpoint_properties] = endpoint.properties
38
+ end
39
+
40
+ context[:auth_scheme] =
41
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
42
+
43
+ with_metrics(context) { @handler.call(context) }
44
+ end
45
+
46
+ private
47
+
48
+ def with_metrics(context, &block)
49
+ metrics = []
50
+ metrics << 'ENDPOINT_OVERRIDE' unless context.config.regional_endpoint
51
+ if context[:auth_scheme] && context[:auth_scheme]['name'] == 'sigv4a'
52
+ metrics << 'SIGV4A_SIGNING'
53
+ end
54
+ if context.config.credentials&.credentials&.account_id
55
+ metrics << 'RESOLVED_ACCOUNT_ID'
56
+ end
57
+ Aws::Plugins::UserAgent.metric(*metrics, &block)
58
+ end
59
+
60
+ def apply_endpoint_headers(context, headers)
61
+ headers.each do |key, values|
62
+ value = values
63
+ .compact
64
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
65
+ .join(',')
66
+
67
+ context.http_request.headers[key] = value
68
+ end
69
+ end
70
+ end
71
+
72
+ def add_handlers(handlers, _config)
73
+ handlers.add(Handler, step: :build, priority: 75)
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,26 @@
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
+ module Aws::Payments
11
+
12
+ class Resource
13
+
14
+ # @param options ({})
15
+ # @option options [Client] :client
16
+ def initialize(options = {})
17
+ @client = options[:client] || Client.new(options)
18
+ end
19
+
20
+ # @return [Client]
21
+ def client
22
+ @client
23
+ end
24
+
25
+ end
26
+ end