aws-sdk-bedrockruntime 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,166 @@
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::BedrockRuntime
11
+ # @api private
12
+ module ClientApi
13
+
14
+ include Seahorse::Model
15
+
16
+ AccessDeniedException = Shapes::StructureShape.new(name: 'AccessDeniedException')
17
+ Body = Shapes::BlobShape.new(name: 'Body')
18
+ InternalServerException = Shapes::StructureShape.new(name: 'InternalServerException')
19
+ InvokeModelIdentifier = Shapes::StringShape.new(name: 'InvokeModelIdentifier')
20
+ InvokeModelRequest = Shapes::StructureShape.new(name: 'InvokeModelRequest')
21
+ InvokeModelResponse = Shapes::StructureShape.new(name: 'InvokeModelResponse')
22
+ InvokeModelWithResponseStreamRequest = Shapes::StructureShape.new(name: 'InvokeModelWithResponseStreamRequest')
23
+ InvokeModelWithResponseStreamResponse = Shapes::StructureShape.new(name: 'InvokeModelWithResponseStreamResponse')
24
+ MimeType = Shapes::StringShape.new(name: 'MimeType')
25
+ ModelErrorException = Shapes::StructureShape.new(name: 'ModelErrorException')
26
+ ModelNotReadyException = Shapes::StructureShape.new(name: 'ModelNotReadyException')
27
+ ModelStreamErrorException = Shapes::StructureShape.new(name: 'ModelStreamErrorException')
28
+ ModelTimeoutException = Shapes::StructureShape.new(name: 'ModelTimeoutException')
29
+ NonBlankString = Shapes::StringShape.new(name: 'NonBlankString')
30
+ PartBody = Shapes::BlobShape.new(name: 'PartBody')
31
+ PayloadPart = Shapes::StructureShape.new(name: 'PayloadPart')
32
+ ResourceNotFoundException = Shapes::StructureShape.new(name: 'ResourceNotFoundException')
33
+ ResponseStream = Shapes::StructureShape.new(name: 'ResponseStream')
34
+ ServiceQuotaExceededException = Shapes::StructureShape.new(name: 'ServiceQuotaExceededException')
35
+ StatusCode = Shapes::IntegerShape.new(name: 'StatusCode')
36
+ ThrottlingException = Shapes::StructureShape.new(name: 'ThrottlingException')
37
+ ValidationException = Shapes::StructureShape.new(name: 'ValidationException')
38
+
39
+ AccessDeniedException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
40
+ AccessDeniedException.struct_class = Types::AccessDeniedException
41
+
42
+ InternalServerException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
43
+ InternalServerException.struct_class = Types::InternalServerException
44
+
45
+ InvokeModelRequest.add_member(:accept, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "Accept"))
46
+ InvokeModelRequest.add_member(:body, Shapes::ShapeRef.new(shape: Body, required: true, location_name: "body"))
47
+ InvokeModelRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "Content-Type"))
48
+ InvokeModelRequest.add_member(:model_id, Shapes::ShapeRef.new(shape: InvokeModelIdentifier, required: true, location: "uri", location_name: "modelId"))
49
+ InvokeModelRequest.struct_class = Types::InvokeModelRequest
50
+ InvokeModelRequest[:payload] = :body
51
+ InvokeModelRequest[:payload_member] = InvokeModelRequest.member(:body)
52
+
53
+ InvokeModelResponse.add_member(:body, Shapes::ShapeRef.new(shape: Body, required: true, location_name: "body"))
54
+ InvokeModelResponse.add_member(:content_type, Shapes::ShapeRef.new(shape: MimeType, required: true, location: "header", location_name: "Content-Type"))
55
+ InvokeModelResponse.struct_class = Types::InvokeModelResponse
56
+ InvokeModelResponse[:payload] = :body
57
+ InvokeModelResponse[:payload_member] = InvokeModelResponse.member(:body)
58
+
59
+ InvokeModelWithResponseStreamRequest.add_member(:accept, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "X-Amzn-Bedrock-Accept"))
60
+ InvokeModelWithResponseStreamRequest.add_member(:body, Shapes::ShapeRef.new(shape: Body, required: true, location_name: "body"))
61
+ InvokeModelWithResponseStreamRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: MimeType, location: "header", location_name: "Content-Type"))
62
+ InvokeModelWithResponseStreamRequest.add_member(:model_id, Shapes::ShapeRef.new(shape: InvokeModelIdentifier, required: true, location: "uri", location_name: "modelId"))
63
+ InvokeModelWithResponseStreamRequest.struct_class = Types::InvokeModelWithResponseStreamRequest
64
+ InvokeModelWithResponseStreamRequest[:payload] = :body
65
+ InvokeModelWithResponseStreamRequest[:payload_member] = InvokeModelWithResponseStreamRequest.member(:body)
66
+
67
+ InvokeModelWithResponseStreamResponse.add_member(:body, Shapes::ShapeRef.new(shape: ResponseStream, required: true, eventstream: true, location_name: "body"))
68
+ InvokeModelWithResponseStreamResponse.add_member(:content_type, Shapes::ShapeRef.new(shape: MimeType, required: true, location: "header", location_name: "X-Amzn-Bedrock-Content-Type"))
69
+ InvokeModelWithResponseStreamResponse.struct_class = Types::InvokeModelWithResponseStreamResponse
70
+ InvokeModelWithResponseStreamResponse[:payload] = :body
71
+ InvokeModelWithResponseStreamResponse[:payload_member] = InvokeModelWithResponseStreamResponse.member(:body)
72
+
73
+ ModelErrorException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
74
+ ModelErrorException.add_member(:original_status_code, Shapes::ShapeRef.new(shape: StatusCode, location_name: "originalStatusCode"))
75
+ ModelErrorException.add_member(:resource_name, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "resourceName"))
76
+ ModelErrorException.struct_class = Types::ModelErrorException
77
+
78
+ ModelNotReadyException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
79
+ ModelNotReadyException.struct_class = Types::ModelNotReadyException
80
+
81
+ ModelStreamErrorException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
82
+ ModelStreamErrorException.add_member(:original_message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "originalMessage"))
83
+ ModelStreamErrorException.add_member(:original_status_code, Shapes::ShapeRef.new(shape: StatusCode, location_name: "originalStatusCode"))
84
+ ModelStreamErrorException.struct_class = Types::ModelStreamErrorException
85
+
86
+ ModelTimeoutException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
87
+ ModelTimeoutException.struct_class = Types::ModelTimeoutException
88
+
89
+ PayloadPart.add_member(:bytes, Shapes::ShapeRef.new(shape: PartBody, location_name: "bytes"))
90
+ PayloadPart.struct_class = Types::PayloadPart
91
+
92
+ ResourceNotFoundException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
93
+ ResourceNotFoundException.struct_class = Types::ResourceNotFoundException
94
+
95
+ ResponseStream.add_member(:chunk, Shapes::ShapeRef.new(shape: PayloadPart, event: true, location_name: "chunk"))
96
+ ResponseStream.add_member(:internal_server_exception, Shapes::ShapeRef.new(shape: InternalServerException, location_name: "internalServerException"))
97
+ ResponseStream.add_member(:model_stream_error_exception, Shapes::ShapeRef.new(shape: ModelStreamErrorException, location_name: "modelStreamErrorException"))
98
+ ResponseStream.add_member(:throttling_exception, Shapes::ShapeRef.new(shape: ThrottlingException, location_name: "throttlingException"))
99
+ ResponseStream.add_member(:validation_exception, Shapes::ShapeRef.new(shape: ValidationException, location_name: "validationException"))
100
+ ResponseStream.struct_class = Types::ResponseStream
101
+
102
+ ServiceQuotaExceededException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
103
+ ServiceQuotaExceededException.struct_class = Types::ServiceQuotaExceededException
104
+
105
+ ThrottlingException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
106
+ ThrottlingException.struct_class = Types::ThrottlingException
107
+
108
+ ValidationException.add_member(:message, Shapes::ShapeRef.new(shape: NonBlankString, location_name: "message"))
109
+ ValidationException.struct_class = Types::ValidationException
110
+
111
+
112
+ # @api private
113
+ API = Seahorse::Model::Api.new.tap do |api|
114
+
115
+ api.version = "2023-09-30"
116
+
117
+ api.metadata = {
118
+ "apiVersion" => "2023-09-30",
119
+ "endpointPrefix" => "bedrock-runtime",
120
+ "jsonVersion" => "1.1",
121
+ "protocol" => "rest-json",
122
+ "serviceFullName" => "Amazon Bedrock Runtime",
123
+ "serviceId" => "Bedrock Runtime",
124
+ "signatureVersion" => "v4",
125
+ "signingName" => "bedrock",
126
+ "uid" => "bedrock-runtime-2023-09-30",
127
+ }
128
+
129
+ api.add_operation(:invoke_model, Seahorse::Model::Operation.new.tap do |o|
130
+ o.name = "InvokeModel"
131
+ o.http_method = "POST"
132
+ o.http_request_uri = "/model/{modelId}/invoke"
133
+ o.input = Shapes::ShapeRef.new(shape: InvokeModelRequest)
134
+ o.output = Shapes::ShapeRef.new(shape: InvokeModelResponse)
135
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
136
+ o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
137
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
138
+ o.errors << Shapes::ShapeRef.new(shape: ModelTimeoutException)
139
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
140
+ o.errors << Shapes::ShapeRef.new(shape: ValidationException)
141
+ o.errors << Shapes::ShapeRef.new(shape: ModelNotReadyException)
142
+ o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
143
+ o.errors << Shapes::ShapeRef.new(shape: ModelErrorException)
144
+ end)
145
+
146
+ api.add_operation(:invoke_model_with_response_stream, Seahorse::Model::Operation.new.tap do |o|
147
+ o.name = "InvokeModelWithResponseStream"
148
+ o.http_method = "POST"
149
+ o.http_request_uri = "/model/{modelId}/invoke-with-response-stream"
150
+ o.input = Shapes::ShapeRef.new(shape: InvokeModelWithResponseStreamRequest)
151
+ o.output = Shapes::ShapeRef.new(shape: InvokeModelWithResponseStreamResponse)
152
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
153
+ o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
154
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
155
+ o.errors << Shapes::ShapeRef.new(shape: ModelTimeoutException)
156
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
157
+ o.errors << Shapes::ShapeRef.new(shape: ModelStreamErrorException)
158
+ o.errors << Shapes::ShapeRef.new(shape: ValidationException)
159
+ o.errors << Shapes::ShapeRef.new(shape: ModelNotReadyException)
160
+ o.errors << Shapes::ShapeRef.new(shape: ServiceQuotaExceededException)
161
+ o.errors << Shapes::ShapeRef.new(shape: ModelErrorException)
162
+ end)
163
+ end
164
+
165
+ end
166
+ end
File without changes
@@ -0,0 +1,66 @@
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::BedrockRuntime
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
+ if self[:use_dual_stack].nil?
56
+ raise ArgumentError, "Missing required EndpointParameter: :use_dual_stack"
57
+ end
58
+ self[:use_fips] = options[:use_fips]
59
+ self[:use_fips] = false if self[:use_fips].nil?
60
+ if self[:use_fips].nil?
61
+ raise ArgumentError, "Missing required EndpointParameter: :use_fips"
62
+ end
63
+ self[:endpoint] = options[:endpoint]
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,54 @@
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::BedrockRuntime
11
+ class EndpointProvider
12
+ def resolve_endpoint(parameters)
13
+ region = parameters.region
14
+ use_dual_stack = parameters.use_dual_stack
15
+ use_fips = parameters.use_fips
16
+ endpoint = parameters.endpoint
17
+ if Aws::Endpoints::Matchers.set?(endpoint)
18
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
19
+ raise ArgumentError, "Invalid Configuration: FIPS and custom endpoint are not supported"
20
+ end
21
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
22
+ raise ArgumentError, "Invalid Configuration: Dualstack and custom endpoint are not supported"
23
+ end
24
+ return Aws::Endpoints::Endpoint.new(url: endpoint, headers: {}, properties: {})
25
+ end
26
+ if Aws::Endpoints::Matchers.set?(region)
27
+ if (partition_result = Aws::Endpoints::Matchers.aws_partition(region))
28
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true) && Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
29
+ 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"))
30
+ return Aws::Endpoints::Endpoint.new(url: "https://bedrock-runtime-fips.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
31
+ end
32
+ raise ArgumentError, "FIPS and DualStack are enabled, but this partition does not support one or both"
33
+ end
34
+ if Aws::Endpoints::Matchers.boolean_equals?(use_fips, true)
35
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsFIPS"))
36
+ return Aws::Endpoints::Endpoint.new(url: "https://bedrock-runtime-fips.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
37
+ end
38
+ raise ArgumentError, "FIPS is enabled but this partition does not support FIPS"
39
+ end
40
+ if Aws::Endpoints::Matchers.boolean_equals?(use_dual_stack, true)
41
+ if Aws::Endpoints::Matchers.boolean_equals?(true, Aws::Endpoints::Matchers.attr(partition_result, "supportsDualStack"))
42
+ return Aws::Endpoints::Endpoint.new(url: "https://bedrock-runtime.#{region}.#{partition_result['dualStackDnsSuffix']}", headers: {}, properties: {})
43
+ end
44
+ raise ArgumentError, "DualStack is enabled but this partition does not support DualStack"
45
+ end
46
+ return Aws::Endpoints::Endpoint.new(url: "https://bedrock-runtime.#{region}.#{partition_result['dnsSuffix']}", headers: {}, properties: {})
47
+ end
48
+ end
49
+ raise ArgumentError, "Invalid Configuration: Missing Region"
50
+ raise ArgumentError, 'No endpoint could be resolved'
51
+
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,44 @@
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::BedrockRuntime
12
+ # @api private
13
+ module Endpoints
14
+
15
+ class InvokeModel
16
+ def self.build(context)
17
+ unless context.config.regional_endpoint
18
+ endpoint = context.config.endpoint.to_s
19
+ end
20
+ Aws::BedrockRuntime::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 InvokeModelWithResponseStream
30
+ def self.build(context)
31
+ unless context.config.regional_endpoint
32
+ endpoint = context.config.endpoint.to_s
33
+ end
34
+ Aws::BedrockRuntime::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
+ end
44
+ end
@@ -0,0 +1,218 @@
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::BedrockRuntime
11
+
12
+ # When BedrockRuntime returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::BedrockRuntime::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all BedrockRuntime errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::BedrockRuntime::Errors::ServiceError
20
+ # # rescues all BedrockRuntime 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
+ # * {ModelErrorException}
33
+ # * {ModelNotReadyException}
34
+ # * {ModelStreamErrorException}
35
+ # * {ModelTimeoutException}
36
+ # * {ResourceNotFoundException}
37
+ # * {ServiceQuotaExceededException}
38
+ # * {ThrottlingException}
39
+ # * {ValidationException}
40
+ #
41
+ # Additionally, error classes are dynamically generated for service errors based on the error code
42
+ # if they are not defined above.
43
+ module Errors
44
+
45
+ extend Aws::Errors::DynamicErrors
46
+
47
+ class AccessDeniedException < ServiceError
48
+
49
+ # @param [Seahorse::Client::RequestContext] context
50
+ # @param [String] message
51
+ # @param [Aws::BedrockRuntime::Types::AccessDeniedException] data
52
+ def initialize(context, message, data = Aws::EmptyStructure.new)
53
+ super(context, message, data)
54
+ end
55
+
56
+ # @return [String]
57
+ def message
58
+ @message || @data[:message]
59
+ end
60
+ end
61
+
62
+ class InternalServerException < ServiceError
63
+
64
+ # @param [Seahorse::Client::RequestContext] context
65
+ # @param [String] message
66
+ # @param [Aws::BedrockRuntime::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
+ end
76
+
77
+ class ModelErrorException < ServiceError
78
+
79
+ # @param [Seahorse::Client::RequestContext] context
80
+ # @param [String] message
81
+ # @param [Aws::BedrockRuntime::Types::ModelErrorException] data
82
+ def initialize(context, message, data = Aws::EmptyStructure.new)
83
+ super(context, message, data)
84
+ end
85
+
86
+ # @return [String]
87
+ def message
88
+ @message || @data[:message]
89
+ end
90
+
91
+ # @return [String]
92
+ def original_status_code
93
+ @data[:original_status_code]
94
+ end
95
+
96
+ # @return [String]
97
+ def resource_name
98
+ @data[:resource_name]
99
+ end
100
+ end
101
+
102
+ class ModelNotReadyException < ServiceError
103
+
104
+ # @param [Seahorse::Client::RequestContext] context
105
+ # @param [String] message
106
+ # @param [Aws::BedrockRuntime::Types::ModelNotReadyException] data
107
+ def initialize(context, message, data = Aws::EmptyStructure.new)
108
+ super(context, message, data)
109
+ end
110
+
111
+ # @return [String]
112
+ def message
113
+ @message || @data[:message]
114
+ end
115
+ end
116
+
117
+ class ModelStreamErrorException < ServiceError
118
+
119
+ # @param [Seahorse::Client::RequestContext] context
120
+ # @param [String] message
121
+ # @param [Aws::BedrockRuntime::Types::ModelStreamErrorException] data
122
+ def initialize(context, message, data = Aws::EmptyStructure.new)
123
+ super(context, message, data)
124
+ end
125
+
126
+ # @return [String]
127
+ def message
128
+ @message || @data[:message]
129
+ end
130
+
131
+ # @return [String]
132
+ def original_message
133
+ @data[:original_message]
134
+ end
135
+
136
+ # @return [String]
137
+ def original_status_code
138
+ @data[:original_status_code]
139
+ end
140
+ end
141
+
142
+ class ModelTimeoutException < ServiceError
143
+
144
+ # @param [Seahorse::Client::RequestContext] context
145
+ # @param [String] message
146
+ # @param [Aws::BedrockRuntime::Types::ModelTimeoutException] 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
+ end
156
+
157
+ class ResourceNotFoundException < ServiceError
158
+
159
+ # @param [Seahorse::Client::RequestContext] context
160
+ # @param [String] message
161
+ # @param [Aws::BedrockRuntime::Types::ResourceNotFoundException] data
162
+ def initialize(context, message, data = Aws::EmptyStructure.new)
163
+ super(context, message, data)
164
+ end
165
+
166
+ # @return [String]
167
+ def message
168
+ @message || @data[:message]
169
+ end
170
+ end
171
+
172
+ class ServiceQuotaExceededException < ServiceError
173
+
174
+ # @param [Seahorse::Client::RequestContext] context
175
+ # @param [String] message
176
+ # @param [Aws::BedrockRuntime::Types::ServiceQuotaExceededException] data
177
+ def initialize(context, message, data = Aws::EmptyStructure.new)
178
+ super(context, message, data)
179
+ end
180
+
181
+ # @return [String]
182
+ def message
183
+ @message || @data[:message]
184
+ end
185
+ end
186
+
187
+ class ThrottlingException < ServiceError
188
+
189
+ # @param [Seahorse::Client::RequestContext] context
190
+ # @param [String] message
191
+ # @param [Aws::BedrockRuntime::Types::ThrottlingException] 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
+ end
201
+
202
+ class ValidationException < ServiceError
203
+
204
+ # @param [Seahorse::Client::RequestContext] context
205
+ # @param [String] message
206
+ # @param [Aws::BedrockRuntime::Types::ValidationException] data
207
+ def initialize(context, message, data = Aws::EmptyStructure.new)
208
+ super(context, message, data)
209
+ end
210
+
211
+ # @return [String]
212
+ def message
213
+ @message || @data[:message]
214
+ end
215
+ end
216
+
217
+ end
218
+ end
@@ -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::BedrockRuntime
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_internal_server_exception_event(&block)
23
+ @event_emitter.on(:internal_server_exception, block) if block_given?
24
+ end
25
+
26
+ def on_model_stream_error_exception_event(&block)
27
+ @event_emitter.on(:model_stream_error_exception, block) if block_given?
28
+ end
29
+
30
+ def on_throttling_exception_event(&block)
31
+ @event_emitter.on(:throttling_exception, block) if block_given?
32
+ end
33
+
34
+ def on_validation_exception_event(&block)
35
+ @event_emitter.on(:validation_exception, block) if block_given?
36
+ end
37
+
38
+ def on_error_event(&block)
39
+ @event_emitter.on(:error, block) if block_given?
40
+ end
41
+
42
+ def on_initial_response_event(&block)
43
+ @event_emitter.on(:initial_response, block) if block_given?
44
+ end
45
+
46
+ def on_unknown_event(&block)
47
+ @event_emitter.on(:unknown_event, block) if block_given?
48
+ end
49
+
50
+ def on_event(&block)
51
+ on_chunk_event(&block)
52
+ on_internal_server_exception_event(&block)
53
+ on_model_stream_error_exception_event(&block)
54
+ on_throttling_exception_event(&block)
55
+ on_validation_exception_event(&block)
56
+ on_error_event(&block)
57
+ on_initial_response_event(&block)
58
+ on_unknown_event(&block)
59
+ end
60
+
61
+ # @api private
62
+ # @return Aws::EventEmitter
63
+ attr_reader :event_emitter
64
+
65
+ end
66
+
67
+ end
68
+ end
69
+