aws-sdk-bedrockagentruntime 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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-bedrockagentruntime/client.rb +928 -0
- data/lib/aws-sdk-bedrockagentruntime/client_api.rb +503 -0
- data/lib/aws-sdk-bedrockagentruntime/customizations.rb +0 -0
- data/lib/aws-sdk-bedrockagentruntime/endpoint_parameters.rb +66 -0
- data/lib/aws-sdk-bedrockagentruntime/endpoint_provider.rb +54 -0
- data/lib/aws-sdk-bedrockagentruntime/endpoints.rb +58 -0
- data/lib/aws-sdk-bedrockagentruntime/errors.rb +192 -0
- data/lib/aws-sdk-bedrockagentruntime/event_streams.rb +99 -0
- data/lib/aws-sdk-bedrockagentruntime/plugins/endpoints.rb +75 -0
- data/lib/aws-sdk-bedrockagentruntime/resource.rb +26 -0
- data/lib/aws-sdk-bedrockagentruntime/types.rb +1272 -0
- data/lib/aws-sdk-bedrockagentruntime.rb +58 -0
- metadata +95 -0
@@ -0,0 +1,58 @@
|
|
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::BedrockAgentRuntime
|
12
|
+
# @api private
|
13
|
+
module Endpoints
|
14
|
+
|
15
|
+
class InvokeAgent
|
16
|
+
def self.build(context)
|
17
|
+
unless context.config.regional_endpoint
|
18
|
+
endpoint = context.config.endpoint.to_s
|
19
|
+
end
|
20
|
+
Aws::BedrockAgentRuntime::EndpointParameters.new(
|
21
|
+
region: context.config.region,
|
22
|
+
use_dual_stack: context.config.use_dualstack_endpoint,
|
23
|
+
use_fips: context.config.use_fips_endpoint,
|
24
|
+
endpoint: endpoint,
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Retrieve
|
30
|
+
def self.build(context)
|
31
|
+
unless context.config.regional_endpoint
|
32
|
+
endpoint = context.config.endpoint.to_s
|
33
|
+
end
|
34
|
+
Aws::BedrockAgentRuntime::EndpointParameters.new(
|
35
|
+
region: context.config.region,
|
36
|
+
use_dual_stack: context.config.use_dualstack_endpoint,
|
37
|
+
use_fips: context.config.use_fips_endpoint,
|
38
|
+
endpoint: endpoint,
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class RetrieveAndGenerate
|
44
|
+
def self.build(context)
|
45
|
+
unless context.config.regional_endpoint
|
46
|
+
endpoint = context.config.endpoint.to_s
|
47
|
+
end
|
48
|
+
Aws::BedrockAgentRuntime::EndpointParameters.new(
|
49
|
+
region: context.config.region,
|
50
|
+
use_dual_stack: context.config.use_dualstack_endpoint,
|
51
|
+
use_fips: context.config.use_fips_endpoint,
|
52
|
+
endpoint: endpoint,
|
53
|
+
)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,192 @@
|
|
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::BedrockAgentRuntime
|
11
|
+
|
12
|
+
# When BedrockAgentRuntime returns an error response, the Ruby SDK constructs and raises an error.
|
13
|
+
# These errors all extend Aws::BedrockAgentRuntime::Errors::ServiceError < {Aws::Errors::ServiceError}
|
14
|
+
#
|
15
|
+
# You can rescue all BedrockAgentRuntime errors using ServiceError:
|
16
|
+
#
|
17
|
+
# begin
|
18
|
+
# # do stuff
|
19
|
+
# rescue Aws::BedrockAgentRuntime::Errors::ServiceError
|
20
|
+
# # rescues all BedrockAgentRuntime 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
|
+
# * {BadGatewayException}
|
32
|
+
# * {ConflictException}
|
33
|
+
# * {DependencyFailedException}
|
34
|
+
# * {InternalServerException}
|
35
|
+
# * {ResourceNotFoundException}
|
36
|
+
# * {ServiceQuotaExceededException}
|
37
|
+
# * {ThrottlingException}
|
38
|
+
# * {ValidationException}
|
39
|
+
#
|
40
|
+
# Additionally, error classes are dynamically generated for service errors based on the error code
|
41
|
+
# if they are not defined above.
|
42
|
+
module Errors
|
43
|
+
|
44
|
+
extend Aws::Errors::DynamicErrors
|
45
|
+
|
46
|
+
class AccessDeniedException < ServiceError
|
47
|
+
|
48
|
+
# @param [Seahorse::Client::RequestContext] context
|
49
|
+
# @param [String] message
|
50
|
+
# @param [Aws::BedrockAgentRuntime::Types::AccessDeniedException] data
|
51
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
52
|
+
super(context, message, data)
|
53
|
+
end
|
54
|
+
|
55
|
+
# @return [String]
|
56
|
+
def message
|
57
|
+
@message || @data[:message]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
class BadGatewayException < ServiceError
|
62
|
+
|
63
|
+
# @param [Seahorse::Client::RequestContext] context
|
64
|
+
# @param [String] message
|
65
|
+
# @param [Aws::BedrockAgentRuntime::Types::BadGatewayException] data
|
66
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
67
|
+
super(context, message, data)
|
68
|
+
end
|
69
|
+
|
70
|
+
# @return [String]
|
71
|
+
def message
|
72
|
+
@message || @data[:message]
|
73
|
+
end
|
74
|
+
|
75
|
+
# @return [String]
|
76
|
+
def resource_name
|
77
|
+
@data[:resource_name]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class ConflictException < ServiceError
|
82
|
+
|
83
|
+
# @param [Seahorse::Client::RequestContext] context
|
84
|
+
# @param [String] message
|
85
|
+
# @param [Aws::BedrockAgentRuntime::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 DependencyFailedException < ServiceError
|
97
|
+
|
98
|
+
# @param [Seahorse::Client::RequestContext] context
|
99
|
+
# @param [String] message
|
100
|
+
# @param [Aws::BedrockAgentRuntime::Types::DependencyFailedException] 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
|
+
|
110
|
+
# @return [String]
|
111
|
+
def resource_name
|
112
|
+
@data[:resource_name]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
class InternalServerException < ServiceError
|
117
|
+
|
118
|
+
# @param [Seahorse::Client::RequestContext] context
|
119
|
+
# @param [String] message
|
120
|
+
# @param [Aws::BedrockAgentRuntime::Types::InternalServerException] data
|
121
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
122
|
+
super(context, message, data)
|
123
|
+
end
|
124
|
+
|
125
|
+
# @return [String]
|
126
|
+
def message
|
127
|
+
@message || @data[:message]
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
class ResourceNotFoundException < ServiceError
|
132
|
+
|
133
|
+
# @param [Seahorse::Client::RequestContext] context
|
134
|
+
# @param [String] message
|
135
|
+
# @param [Aws::BedrockAgentRuntime::Types::ResourceNotFoundException] data
|
136
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
137
|
+
super(context, message, data)
|
138
|
+
end
|
139
|
+
|
140
|
+
# @return [String]
|
141
|
+
def message
|
142
|
+
@message || @data[:message]
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
class ServiceQuotaExceededException < ServiceError
|
147
|
+
|
148
|
+
# @param [Seahorse::Client::RequestContext] context
|
149
|
+
# @param [String] message
|
150
|
+
# @param [Aws::BedrockAgentRuntime::Types::ServiceQuotaExceededException] data
|
151
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
152
|
+
super(context, message, data)
|
153
|
+
end
|
154
|
+
|
155
|
+
# @return [String]
|
156
|
+
def message
|
157
|
+
@message || @data[:message]
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
class ThrottlingException < ServiceError
|
162
|
+
|
163
|
+
# @param [Seahorse::Client::RequestContext] context
|
164
|
+
# @param [String] message
|
165
|
+
# @param [Aws::BedrockAgentRuntime::Types::ThrottlingException] data
|
166
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
167
|
+
super(context, message, data)
|
168
|
+
end
|
169
|
+
|
170
|
+
# @return [String]
|
171
|
+
def message
|
172
|
+
@message || @data[:message]
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
class ValidationException < ServiceError
|
177
|
+
|
178
|
+
# @param [Seahorse::Client::RequestContext] context
|
179
|
+
# @param [String] message
|
180
|
+
# @param [Aws::BedrockAgentRuntime::Types::ValidationException] data
|
181
|
+
def initialize(context, message, data = Aws::EmptyStructure.new)
|
182
|
+
super(context, message, data)
|
183
|
+
end
|
184
|
+
|
185
|
+
# @return [String]
|
186
|
+
def message
|
187
|
+
@message || @data[:message]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1,99 @@
|
|
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::BedrockAgentRuntime
|
11
|
+
module EventStreams
|
12
|
+
class ResponseStream
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@event_emitter = Aws::EventEmitter.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def on_chunk_event(&block)
|
19
|
+
@event_emitter.on(:chunk, block) if block_given?
|
20
|
+
end
|
21
|
+
|
22
|
+
def on_trace_event(&block)
|
23
|
+
@event_emitter.on(:trace, block) if block_given?
|
24
|
+
end
|
25
|
+
|
26
|
+
def on_internal_server_exception_event(&block)
|
27
|
+
@event_emitter.on(:internal_server_exception, block) if block_given?
|
28
|
+
end
|
29
|
+
|
30
|
+
def on_validation_exception_event(&block)
|
31
|
+
@event_emitter.on(:validation_exception, block) if block_given?
|
32
|
+
end
|
33
|
+
|
34
|
+
def on_resource_not_found_exception_event(&block)
|
35
|
+
@event_emitter.on(:resource_not_found_exception, block) if block_given?
|
36
|
+
end
|
37
|
+
|
38
|
+
def on_service_quota_exceeded_exception_event(&block)
|
39
|
+
@event_emitter.on(:service_quota_exceeded_exception, block) if block_given?
|
40
|
+
end
|
41
|
+
|
42
|
+
def on_throttling_exception_event(&block)
|
43
|
+
@event_emitter.on(:throttling_exception, block) if block_given?
|
44
|
+
end
|
45
|
+
|
46
|
+
def on_access_denied_exception_event(&block)
|
47
|
+
@event_emitter.on(:access_denied_exception, block) if block_given?
|
48
|
+
end
|
49
|
+
|
50
|
+
def on_conflict_exception_event(&block)
|
51
|
+
@event_emitter.on(:conflict_exception, block) if block_given?
|
52
|
+
end
|
53
|
+
|
54
|
+
def on_dependency_failed_exception_event(&block)
|
55
|
+
@event_emitter.on(:dependency_failed_exception, block) if block_given?
|
56
|
+
end
|
57
|
+
|
58
|
+
def on_bad_gateway_exception_event(&block)
|
59
|
+
@event_emitter.on(:bad_gateway_exception, block) if block_given?
|
60
|
+
end
|
61
|
+
|
62
|
+
def on_error_event(&block)
|
63
|
+
@event_emitter.on(:error, block) if block_given?
|
64
|
+
end
|
65
|
+
|
66
|
+
def on_initial_response_event(&block)
|
67
|
+
@event_emitter.on(:initial_response, block) if block_given?
|
68
|
+
end
|
69
|
+
|
70
|
+
def on_unknown_event(&block)
|
71
|
+
@event_emitter.on(:unknown_event, block) if block_given?
|
72
|
+
end
|
73
|
+
|
74
|
+
def on_event(&block)
|
75
|
+
on_chunk_event(&block)
|
76
|
+
on_trace_event(&block)
|
77
|
+
on_internal_server_exception_event(&block)
|
78
|
+
on_validation_exception_event(&block)
|
79
|
+
on_resource_not_found_exception_event(&block)
|
80
|
+
on_service_quota_exceeded_exception_event(&block)
|
81
|
+
on_throttling_exception_event(&block)
|
82
|
+
on_access_denied_exception_event(&block)
|
83
|
+
on_conflict_exception_event(&block)
|
84
|
+
on_dependency_failed_exception_event(&block)
|
85
|
+
on_bad_gateway_exception_event(&block)
|
86
|
+
on_error_event(&block)
|
87
|
+
on_initial_response_event(&block)
|
88
|
+
on_unknown_event(&block)
|
89
|
+
end
|
90
|
+
|
91
|
+
# @api private
|
92
|
+
# @return Aws::EventEmitter
|
93
|
+
attr_reader :event_emitter
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
@@ -0,0 +1,75 @@
|
|
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::BedrockAgentRuntime
|
12
|
+
module Plugins
|
13
|
+
class Endpoints < Seahorse::Client::Plugin
|
14
|
+
option(
|
15
|
+
:endpoint_provider,
|
16
|
+
doc_type: 'Aws::BedrockAgentRuntime::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::BedrockAgentRuntime::EndpointParameters`'
|
21
|
+
) do |cfg|
|
22
|
+
Aws::BedrockAgentRuntime::EndpointProvider.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# @api private
|
26
|
+
class Handler < Seahorse::Client::Handler
|
27
|
+
def call(context)
|
28
|
+
unless context[:discovered_endpoint]
|
29
|
+
params = parameters_for_operation(context)
|
30
|
+
endpoint = context.config.endpoint_provider.resolve_endpoint(params)
|
31
|
+
|
32
|
+
context.http_request.endpoint = endpoint.url
|
33
|
+
apply_endpoint_headers(context, endpoint.headers)
|
34
|
+
|
35
|
+
context[:endpoint_params] = params
|
36
|
+
context[:endpoint_properties] = endpoint.properties
|
37
|
+
end
|
38
|
+
|
39
|
+
context[:auth_scheme] =
|
40
|
+
Aws::Endpoints.resolve_auth_scheme(context, endpoint)
|
41
|
+
|
42
|
+
@handler.call(context)
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def apply_endpoint_headers(context, headers)
|
48
|
+
headers.each do |key, values|
|
49
|
+
value = values
|
50
|
+
.compact
|
51
|
+
.map { |s| Seahorse::Util.escape_header_list_string(s.to_s) }
|
52
|
+
.join(',')
|
53
|
+
|
54
|
+
context.http_request.headers[key] = value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def parameters_for_operation(context)
|
59
|
+
case context.operation_name
|
60
|
+
when :invoke_agent
|
61
|
+
Aws::BedrockAgentRuntime::Endpoints::InvokeAgent.build(context)
|
62
|
+
when :retrieve
|
63
|
+
Aws::BedrockAgentRuntime::Endpoints::Retrieve.build(context)
|
64
|
+
when :retrieve_and_generate
|
65
|
+
Aws::BedrockAgentRuntime::Endpoints::RetrieveAndGenerate.build(context)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_handlers(handlers, _config)
|
71
|
+
handlers.add(Handler, step: :build, priority: 75)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
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::BedrockAgentRuntime
|
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
|