aws-sdk-appmonetization 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.
File without changes
@@ -0,0 +1,59 @@
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::AppMonetization
11
+ # Endpoint parameters used to influence endpoints per request.
12
+ #
13
+ # @!attribute use_fips
14
+ # When true, send this request to the FIPS-compliant regional endpoint. If the configured endpoint does not have a FIPS compliant endpoint, dispatching the request will return an error.
15
+ #
16
+ # @return [boolean]
17
+ #
18
+ # @!attribute endpoint
19
+ # Override the endpoint used to send this request
20
+ #
21
+ # @return [string]
22
+ #
23
+ # @!attribute region
24
+ # The AWS region used to dispatch the request.
25
+ #
26
+ # @return [string]
27
+ #
28
+ EndpointParameters = Struct.new(
29
+ :use_fips,
30
+ :endpoint,
31
+ :region,
32
+ ) do
33
+ include Aws::Structure
34
+
35
+ # @api private
36
+ class << self
37
+ PARAM_MAP = {
38
+ 'UseFIPS' => :use_fips,
39
+ 'Endpoint' => :endpoint,
40
+ 'Region' => :region,
41
+ }.freeze
42
+ end
43
+
44
+ def initialize(options = {})
45
+ self[:use_fips] = options[:use_fips]
46
+ self[:use_fips] = false if self[:use_fips].nil?
47
+ self[:endpoint] = options[:endpoint]
48
+ self[:region] = options[:region]
49
+ end
50
+
51
+ def self.create(config, options={})
52
+ new({
53
+ use_fips: config.use_fips_endpoint,
54
+ endpoint: (config.endpoint.to_s unless config.regional_endpoint),
55
+ region: config.region,
56
+ }.merge(options))
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,32 @@
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::AppMonetization
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ if Aws::Endpoints::Matchers.set?(parameters.endpoint)
14
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
15
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
16
+ end
17
+ return Aws::Endpoints::Endpoint.new(url: parameters.endpoint, headers: {}, properties: {})
18
+ end
19
+ if Aws::Endpoints::Matchers.set?(parameters.region)
20
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(parameters.region))
21
+ if Aws::Endpoints::Matchers.boolean_equals?(parameters.use_fips, true)
22
+ return Aws::Endpoints::Endpoint.new(url: "https://appmonetization-fips.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
23
+ end
24
+ return Aws::Endpoints::Endpoint.new(url: "https://appmonetization.#{parameters.region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
25
+ end
26
+ end
27
+ raise ArgumentError, "Invalid Configuration: Missing Region"
28
+ raise ArgumentError, 'No endpoint could be resolved'
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,20 @@
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::AppMonetization
12
+ # @api private
13
+ module Endpoints
14
+
15
+
16
+ def self.parameters_for_operation(context)
17
+ Aws::AppMonetization::EndpointParameters.create(context.config)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,310 @@
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::AppMonetization
11
+
12
+ # When AppMonetization returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::AppMonetization::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all AppMonetization errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::AppMonetization::Errors::ServiceError
20
+ # # rescues all AppMonetization 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
+ # * {ConflictException}
32
+ # * {IdempotencyConflictException}
33
+ # * {InternalServerException}
34
+ # * {InvalidConfigurationException}
35
+ # * {ResourceNotFoundException}
36
+ # * {RevisionConflictException}
37
+ # * {ServiceQuotaExceededException}
38
+ # * {ServiceUnavailableException}
39
+ # * {ThrottlingException}
40
+ # * {ValidationException}
41
+ #
42
+ # Additionally, error classes are dynamically generated for service errors based on the error code
43
+ # if they are not defined above.
44
+ module Errors
45
+
46
+ extend Aws::Errors::DynamicErrors
47
+
48
+ class AccessDeniedException < ServiceError
49
+
50
+ # @param [Seahorse::Client::RequestContext] context
51
+ # @param [String] message
52
+ # @param [Aws::AppMonetization::Types::AccessDeniedException] data
53
+ def initialize(context, message, data = Aws::EmptyStructure.new)
54
+ super(context, message, data)
55
+ end
56
+
57
+ # @return [String]
58
+ def message
59
+ @message || @data[:message]
60
+ end
61
+ end
62
+
63
+ class ConflictException < ServiceError
64
+
65
+ # @param [Seahorse::Client::RequestContext] context
66
+ # @param [String] message
67
+ # @param [Aws::AppMonetization::Types::ConflictException] data
68
+ def initialize(context, message, data = Aws::EmptyStructure.new)
69
+ super(context, message, data)
70
+ end
71
+
72
+ # @return [String]
73
+ def message
74
+ @message || @data[:message]
75
+ end
76
+
77
+ # @return [String]
78
+ def resource_id
79
+ @data[:resource_id]
80
+ end
81
+
82
+ # @return [String]
83
+ def resource_type
84
+ @data[:resource_type]
85
+ end
86
+ end
87
+
88
+ class IdempotencyConflictException < ServiceError
89
+
90
+ # @param [Seahorse::Client::RequestContext] context
91
+ # @param [String] message
92
+ # @param [Aws::AppMonetization::Types::IdempotencyConflictException] data
93
+ def initialize(context, message, data = Aws::EmptyStructure.new)
94
+ super(context, message, data)
95
+ end
96
+
97
+ # @return [String]
98
+ def message
99
+ @message || @data[:message]
100
+ end
101
+ end
102
+
103
+ class InternalServerException < ServiceError
104
+
105
+ # @param [Seahorse::Client::RequestContext] context
106
+ # @param [String] message
107
+ # @param [Aws::AppMonetization::Types::InternalServerException] data
108
+ def initialize(context, message, data = Aws::EmptyStructure.new)
109
+ super(context, message, data)
110
+ end
111
+
112
+ # @return [String]
113
+ def message
114
+ @message || @data[:message]
115
+ end
116
+
117
+ # @return [String]
118
+ def retry_after_seconds
119
+ @data[:retry_after_seconds]
120
+ end
121
+
122
+ def retryable?
123
+ true
124
+ end
125
+ end
126
+
127
+ class InvalidConfigurationException < ServiceError
128
+
129
+ # @param [Seahorse::Client::RequestContext] context
130
+ # @param [String] message
131
+ # @param [Aws::AppMonetization::Types::InvalidConfigurationException] data
132
+ def initialize(context, message, data = Aws::EmptyStructure.new)
133
+ super(context, message, data)
134
+ end
135
+
136
+ # @return [String]
137
+ def message
138
+ @message || @data[:message]
139
+ end
140
+ end
141
+
142
+ class ResourceNotFoundException < ServiceError
143
+
144
+ # @param [Seahorse::Client::RequestContext] context
145
+ # @param [String] message
146
+ # @param [Aws::AppMonetization::Types::ResourceNotFoundException] data
147
+ def initialize(context, message, data = Aws::EmptyStructure.new)
148
+ super(context, message, data)
149
+ end
150
+
151
+ # @return [String]
152
+ def message
153
+ @message || @data[:message]
154
+ end
155
+
156
+ # @return [String]
157
+ def resource_id
158
+ @data[:resource_id]
159
+ end
160
+
161
+ # @return [String]
162
+ def resource_type
163
+ @data[:resource_type]
164
+ end
165
+ end
166
+
167
+ class RevisionConflictException < ServiceError
168
+
169
+ # @param [Seahorse::Client::RequestContext] context
170
+ # @param [String] message
171
+ # @param [Aws::AppMonetization::Types::RevisionConflictException] data
172
+ def initialize(context, message, data = Aws::EmptyStructure.new)
173
+ super(context, message, data)
174
+ end
175
+
176
+ # @return [String]
177
+ def message
178
+ @message || @data[:message]
179
+ end
180
+
181
+ # @return [String]
182
+ def current_revision
183
+ @data[:current_revision]
184
+ end
185
+ end
186
+
187
+ class ServiceQuotaExceededException < ServiceError
188
+
189
+ # @param [Seahorse::Client::RequestContext] context
190
+ # @param [String] message
191
+ # @param [Aws::AppMonetization::Types::ServiceQuotaExceededException] data
192
+ def initialize(context, message, data = Aws::EmptyStructure.new)
193
+ super(context, message, data)
194
+ end
195
+
196
+ # @return [String]
197
+ def message
198
+ @message || @data[:message]
199
+ end
200
+
201
+ # @return [String]
202
+ def resource_id
203
+ @data[:resource_id]
204
+ end
205
+
206
+ # @return [String]
207
+ def resource_type
208
+ @data[:resource_type]
209
+ end
210
+
211
+ # @return [String]
212
+ def service_code
213
+ @data[:service_code]
214
+ end
215
+
216
+ # @return [String]
217
+ def quota_code
218
+ @data[:quota_code]
219
+ end
220
+ end
221
+
222
+ class ServiceUnavailableException < ServiceError
223
+
224
+ # @param [Seahorse::Client::RequestContext] context
225
+ # @param [String] message
226
+ # @param [Aws::AppMonetization::Types::ServiceUnavailableException] data
227
+ def initialize(context, message, data = Aws::EmptyStructure.new)
228
+ super(context, message, data)
229
+ end
230
+
231
+ # @return [String]
232
+ def message
233
+ @message || @data[:message]
234
+ end
235
+
236
+ # @return [String]
237
+ def retry_after_seconds
238
+ @data[:retry_after_seconds]
239
+ end
240
+
241
+ def retryable?
242
+ true
243
+ end
244
+ end
245
+
246
+ class ThrottlingException < ServiceError
247
+
248
+ # @param [Seahorse::Client::RequestContext] context
249
+ # @param [String] message
250
+ # @param [Aws::AppMonetization::Types::ThrottlingException] data
251
+ def initialize(context, message, data = Aws::EmptyStructure.new)
252
+ super(context, message, data)
253
+ end
254
+
255
+ # @return [String]
256
+ def message
257
+ @message || @data[:message]
258
+ end
259
+
260
+ # @return [String]
261
+ def service_code
262
+ @data[:service_code]
263
+ end
264
+
265
+ # @return [String]
266
+ def quota_code
267
+ @data[:quota_code]
268
+ end
269
+
270
+ # @return [String]
271
+ def retry_after_seconds
272
+ @data[:retry_after_seconds]
273
+ end
274
+
275
+ def retryable?
276
+ true
277
+ end
278
+
279
+ def throttling?
280
+ true
281
+ end
282
+ end
283
+
284
+ class ValidationException < ServiceError
285
+
286
+ # @param [Seahorse::Client::RequestContext] context
287
+ # @param [String] message
288
+ # @param [Aws::AppMonetization::Types::ValidationException] data
289
+ def initialize(context, message, data = Aws::EmptyStructure.new)
290
+ super(context, message, data)
291
+ end
292
+
293
+ # @return [String]
294
+ def message
295
+ @message || @data[:message]
296
+ end
297
+
298
+ # @return [String]
299
+ def reason
300
+ @data[:reason]
301
+ end
302
+
303
+ # @return [String]
304
+ def field_list
305
+ @data[:field_list]
306
+ end
307
+ end
308
+
309
+ end
310
+ 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::AppMonetization
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::AppMonetization::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::AppMonetization::EndpointParameters`.
22
+ DOCS
23
+ Aws::AppMonetization::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::AppMonetization::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::AppMonetization
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