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