aws-sdk-managedblockchainquery 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,206 @@
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::ManagedBlockchainQuery
11
+
12
+ # When ManagedBlockchainQuery returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::ManagedBlockchainQuery::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all ManagedBlockchainQuery errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::ManagedBlockchainQuery::Errors::ServiceError
20
+ # # rescues all ManagedBlockchainQuery 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
+ # * {ServiceQuotaExceededException}
34
+ # * {ThrottlingException}
35
+ # * {ValidationException}
36
+ #
37
+ # Additionally, error classes are dynamically generated for service errors based on the error code
38
+ # if they are not defined above.
39
+ module Errors
40
+
41
+ extend Aws::Errors::DynamicErrors
42
+
43
+ class AccessDeniedException < ServiceError
44
+
45
+ # @param [Seahorse::Client::RequestContext] context
46
+ # @param [String] message
47
+ # @param [Aws::ManagedBlockchainQuery::Types::AccessDeniedException] data
48
+ def initialize(context, message, data = Aws::EmptyStructure.new)
49
+ super(context, message, data)
50
+ end
51
+
52
+ # @return [String]
53
+ def message
54
+ @message || @data[:message]
55
+ end
56
+ end
57
+
58
+ class InternalServerException < ServiceError
59
+
60
+ # @param [Seahorse::Client::RequestContext] context
61
+ # @param [String] message
62
+ # @param [Aws::ManagedBlockchainQuery::Types::InternalServerException] data
63
+ def initialize(context, message, data = Aws::EmptyStructure.new)
64
+ super(context, message, data)
65
+ end
66
+
67
+ # @return [String]
68
+ def message
69
+ @message || @data[:message]
70
+ end
71
+
72
+ # @return [String]
73
+ def retry_after_seconds
74
+ @data[:retry_after_seconds]
75
+ end
76
+
77
+ def retryable?
78
+ true
79
+ end
80
+ end
81
+
82
+ class ResourceNotFoundException < ServiceError
83
+
84
+ # @param [Seahorse::Client::RequestContext] context
85
+ # @param [String] message
86
+ # @param [Aws::ManagedBlockchainQuery::Types::ResourceNotFoundException] data
87
+ def initialize(context, message, data = Aws::EmptyStructure.new)
88
+ super(context, message, data)
89
+ end
90
+
91
+ # @return [String]
92
+ def message
93
+ @message || @data[:message]
94
+ end
95
+
96
+ # @return [String]
97
+ def resource_id
98
+ @data[:resource_id]
99
+ end
100
+
101
+ # @return [String]
102
+ def resource_type
103
+ @data[:resource_type]
104
+ end
105
+ end
106
+
107
+ class ServiceQuotaExceededException < ServiceError
108
+
109
+ # @param [Seahorse::Client::RequestContext] context
110
+ # @param [String] message
111
+ # @param [Aws::ManagedBlockchainQuery::Types::ServiceQuotaExceededException] data
112
+ def initialize(context, message, data = Aws::EmptyStructure.new)
113
+ super(context, message, data)
114
+ end
115
+
116
+ # @return [String]
117
+ def message
118
+ @message || @data[:message]
119
+ end
120
+
121
+ # @return [String]
122
+ def resource_id
123
+ @data[:resource_id]
124
+ end
125
+
126
+ # @return [String]
127
+ def resource_type
128
+ @data[:resource_type]
129
+ end
130
+
131
+ # @return [String]
132
+ def service_code
133
+ @data[:service_code]
134
+ end
135
+
136
+ # @return [String]
137
+ def quota_code
138
+ @data[:quota_code]
139
+ end
140
+ end
141
+
142
+ class ThrottlingException < ServiceError
143
+
144
+ # @param [Seahorse::Client::RequestContext] context
145
+ # @param [String] message
146
+ # @param [Aws::ManagedBlockchainQuery::Types::ThrottlingException] 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 service_code
158
+ @data[:service_code]
159
+ end
160
+
161
+ # @return [String]
162
+ def quota_code
163
+ @data[:quota_code]
164
+ end
165
+
166
+ # @return [String]
167
+ def retry_after_seconds
168
+ @data[:retry_after_seconds]
169
+ end
170
+
171
+ def retryable?
172
+ true
173
+ end
174
+
175
+ def throttling?
176
+ true
177
+ end
178
+ end
179
+
180
+ class ValidationException < ServiceError
181
+
182
+ # @param [Seahorse::Client::RequestContext] context
183
+ # @param [String] message
184
+ # @param [Aws::ManagedBlockchainQuery::Types::ValidationException] data
185
+ def initialize(context, message, data = Aws::EmptyStructure.new)
186
+ super(context, message, data)
187
+ end
188
+
189
+ # @return [String]
190
+ def message
191
+ @message || @data[:message]
192
+ end
193
+
194
+ # @return [String]
195
+ def reason
196
+ @data[:reason]
197
+ end
198
+
199
+ # @return [String]
200
+ def field_list
201
+ @data[:field_list]
202
+ end
203
+ end
204
+
205
+ end
206
+ end
@@ -0,0 +1,80 @@
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::ManagedBlockchainQuery
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::ManagedBlockchainQuery::EndpointProvider',
17
+ docstring: 'The endpoint provider used to resolve endpoints. Any '\
18
+ 'object that responds to `#resolve_endpoint(parameters)` '\
19
+ 'where `parameters` is a Struct similar to '\
20
+ '`Aws::ManagedBlockchainQuery::EndpointParameters`'
21
+ ) do |cfg|
22
+ Aws::ManagedBlockchainQuery::EndpointProvider.new
23
+ end
24
+
25
+ # @api private
26
+ class Handler < Seahorse::Client::Handler
27
+ def call(context)
28
+ # If endpoint was discovered, do not resolve or apply the endpoint.
29
+ unless context[:discovered_endpoint]
30
+ params = 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
+ end
36
+
37
+ context[:endpoint_params] = params
38
+ context[:auth_scheme] =
39
+ Aws::Endpoints.resolve_auth_scheme(context, endpoint)
40
+
41
+ @handler.call(context)
42
+ end
43
+
44
+ private
45
+
46
+ def apply_endpoint_headers(context, headers)
47
+ headers.each do |key, values|
48
+ value = values
49
+ .compact
50
+ .map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
51
+ .join(',')
52
+
53
+ context.http_request.headers[key] = value
54
+ end
55
+ end
56
+
57
+ def parameters_for_operation(context)
58
+ case context.operation_name
59
+ when :batch_get_token_balance
60
+ Aws::ManagedBlockchainQuery::Endpoints::BatchGetTokenBalance.build(context)
61
+ when :get_token_balance
62
+ Aws::ManagedBlockchainQuery::Endpoints::GetTokenBalance.build(context)
63
+ when :get_transaction
64
+ Aws::ManagedBlockchainQuery::Endpoints::GetTransaction.build(context)
65
+ when :list_token_balances
66
+ Aws::ManagedBlockchainQuery::Endpoints::ListTokenBalances.build(context)
67
+ when :list_transaction_events
68
+ Aws::ManagedBlockchainQuery::Endpoints::ListTransactionEvents.build(context)
69
+ when :list_transactions
70
+ Aws::ManagedBlockchainQuery::Endpoints::ListTransactions.build(context)
71
+ end
72
+ end
73
+ end
74
+
75
+ def add_handlers(handlers, _config)
76
+ handlers.add(Handler, step: :build, priority: 75)
77
+ end
78
+ end
79
+ end
80
+ 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::ManagedBlockchainQuery
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