aws-sdk-sagemakergatewayruntime 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
+
11
+ module Aws::SageMakerGatewayRuntime
12
+ # @api private
13
+ module ClientApi
14
+
15
+ include Seahorse::Model
16
+
17
+ AccessDeniedException = Shapes::StructureShape.new(name: 'AccessDeniedException')
18
+ BadGatewayException = Shapes::StructureShape.new(name: 'BadGatewayException')
19
+ CustomerIdentityToken = Shapes::StringShape.new(name: 'CustomerIdentityToken')
20
+ GatewayId = Shapes::StringShape.new(name: 'GatewayId')
21
+ GatewayTimeoutException = Shapes::StructureShape.new(name: 'GatewayTimeoutException')
22
+ InternalServerException = Shapes::StructureShape.new(name: 'InternalServerException')
23
+ InternalStreamFailure = Shapes::StructureShape.new(name: 'InternalStreamFailure')
24
+ InvokeGlobalInferenceGatewayInput = Shapes::StructureShape.new(name: 'InvokeGlobalInferenceGatewayInput')
25
+ InvokeGlobalInferenceGatewayOutput = Shapes::StructureShape.new(name: 'InvokeGlobalInferenceGatewayOutput')
26
+ InvokeGlobalInferenceGatewayWithResponseStreamInput = Shapes::StructureShape.new(name: 'InvokeGlobalInferenceGatewayWithResponseStreamInput')
27
+ InvokeGlobalInferenceGatewayWithResponseStreamOutput = Shapes::StructureShape.new(name: 'InvokeGlobalInferenceGatewayWithResponseStreamOutput')
28
+ ModelStreamError = Shapes::StructureShape.new(name: 'ModelStreamError')
29
+ PayloadPart = Shapes::StructureShape.new(name: 'PayloadPart')
30
+ PayloadTooLargeException = Shapes::StructureShape.new(name: 'PayloadTooLargeException')
31
+ RequestContentType = Shapes::StringShape.new(name: 'RequestContentType')
32
+ RequestPayloadBlob = Shapes::BlobShape.new(name: 'RequestPayloadBlob')
33
+ ResourceNotFoundException = Shapes::StructureShape.new(name: 'ResourceNotFoundException')
34
+ ResponsePayloadBlob = Shapes::BlobShape.new(name: 'ResponsePayloadBlob')
35
+ ResponseStream = Shapes::StructureShape.new(name: 'ResponseStream')
36
+ ServiceUnavailableException = Shapes::StructureShape.new(name: 'ServiceUnavailableException')
37
+ StreamChunkBlob = Shapes::BlobShape.new(name: 'StreamChunkBlob')
38
+ StreamErrorCode = Shapes::StringShape.new(name: 'StreamErrorCode')
39
+ String = Shapes::StringShape.new(name: 'String')
40
+ ThrottlingException = Shapes::StructureShape.new(name: 'ThrottlingException')
41
+
42
+ AccessDeniedException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
43
+ AccessDeniedException.struct_class = Types::AccessDeniedException
44
+
45
+ BadGatewayException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
46
+ BadGatewayException.struct_class = Types::BadGatewayException
47
+
48
+ GatewayTimeoutException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
49
+ GatewayTimeoutException.struct_class = Types::GatewayTimeoutException
50
+
51
+ InternalServerException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
52
+ InternalServerException.struct_class = Types::InternalServerException
53
+
54
+ InternalStreamFailure.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
55
+ InternalStreamFailure.struct_class = Types::InternalStreamFailure
56
+
57
+ InvokeGlobalInferenceGatewayInput.add_member(:gateway_id, Shapes::ShapeRef.new(shape: GatewayId, required: true, location: "uri", location_name: "GatewayId"))
58
+ InvokeGlobalInferenceGatewayInput.add_member(:accept, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "Accept"))
59
+ InvokeGlobalInferenceGatewayInput.add_member(:content_type, Shapes::ShapeRef.new(shape: RequestContentType, required: true, location: "header", location_name: "Content-Type"))
60
+ InvokeGlobalInferenceGatewayInput.add_member(:customer_identity_token, Shapes::ShapeRef.new(shape: CustomerIdentityToken, location: "header", location_name: "X-Amzn-SageMaker-Customer-Identity-Token"))
61
+ InvokeGlobalInferenceGatewayInput.add_member(:body, Shapes::ShapeRef.new(shape: RequestPayloadBlob, required: true, location_name: "Body", metadata: {"jsonvalue" => true}))
62
+ InvokeGlobalInferenceGatewayInput.struct_class = Types::InvokeGlobalInferenceGatewayInput
63
+ InvokeGlobalInferenceGatewayInput[:payload] = :body
64
+ InvokeGlobalInferenceGatewayInput[:payload_member] = InvokeGlobalInferenceGatewayInput.member(:body)
65
+
66
+ InvokeGlobalInferenceGatewayOutput.add_member(:body, Shapes::ShapeRef.new(shape: ResponsePayloadBlob, location_name: "Body", metadata: {"jsonvalue" => true}))
67
+ InvokeGlobalInferenceGatewayOutput.struct_class = Types::InvokeGlobalInferenceGatewayOutput
68
+ InvokeGlobalInferenceGatewayOutput[:payload] = :body
69
+ InvokeGlobalInferenceGatewayOutput[:payload_member] = InvokeGlobalInferenceGatewayOutput.member(:body)
70
+
71
+ InvokeGlobalInferenceGatewayWithResponseStreamInput.add_member(:gateway_id, Shapes::ShapeRef.new(shape: GatewayId, required: true, location: "uri", location_name: "GatewayId"))
72
+ InvokeGlobalInferenceGatewayWithResponseStreamInput.add_member(:accept, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "Accept"))
73
+ InvokeGlobalInferenceGatewayWithResponseStreamInput.add_member(:content_type, Shapes::ShapeRef.new(shape: RequestContentType, required: true, location: "header", location_name: "Content-Type"))
74
+ InvokeGlobalInferenceGatewayWithResponseStreamInput.add_member(:customer_identity_token, Shapes::ShapeRef.new(shape: CustomerIdentityToken, location: "header", location_name: "X-Amzn-SageMaker-Customer-Identity-Token"))
75
+ InvokeGlobalInferenceGatewayWithResponseStreamInput.add_member(:body, Shapes::ShapeRef.new(shape: RequestPayloadBlob, required: true, location_name: "Body", metadata: {"jsonvalue" => true}))
76
+ InvokeGlobalInferenceGatewayWithResponseStreamInput.struct_class = Types::InvokeGlobalInferenceGatewayWithResponseStreamInput
77
+ InvokeGlobalInferenceGatewayWithResponseStreamInput[:payload] = :body
78
+ InvokeGlobalInferenceGatewayWithResponseStreamInput[:payload_member] = InvokeGlobalInferenceGatewayWithResponseStreamInput.member(:body)
79
+
80
+ InvokeGlobalInferenceGatewayWithResponseStreamOutput.add_member(:body, Shapes::ShapeRef.new(shape: ResponseStream, eventstream: true, location_name: "Body"))
81
+ InvokeGlobalInferenceGatewayWithResponseStreamOutput.struct_class = Types::InvokeGlobalInferenceGatewayWithResponseStreamOutput
82
+ InvokeGlobalInferenceGatewayWithResponseStreamOutput[:payload] = :body
83
+ InvokeGlobalInferenceGatewayWithResponseStreamOutput[:payload_member] = InvokeGlobalInferenceGatewayWithResponseStreamOutput.member(:body)
84
+
85
+ ModelStreamError.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
86
+ ModelStreamError.add_member(:error_code, Shapes::ShapeRef.new(shape: StreamErrorCode, location_name: "ErrorCode"))
87
+ ModelStreamError.struct_class = Types::ModelStreamError
88
+
89
+ PayloadPart.add_member(:bytes, Shapes::ShapeRef.new(shape: StreamChunkBlob, eventpayload: true, eventpayload_type: 'blob', location_name: "Bytes", metadata: {"eventpayload" => true}))
90
+ PayloadPart.struct_class = Types::PayloadPart
91
+
92
+ PayloadTooLargeException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
93
+ PayloadTooLargeException.struct_class = Types::PayloadTooLargeException
94
+
95
+ ResourceNotFoundException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
96
+ ResourceNotFoundException.add_member(:resource_id, Shapes::ShapeRef.new(shape: String, location_name: "ResourceId"))
97
+ ResourceNotFoundException.add_member(:resource_type, Shapes::ShapeRef.new(shape: String, location_name: "ResourceType"))
98
+ ResourceNotFoundException.struct_class = Types::ResourceNotFoundException
99
+
100
+ ResponseStream.add_member(:payload_part, Shapes::ShapeRef.new(shape: PayloadPart, event: true, location_name: "PayloadPart"))
101
+ ResponseStream.add_member(:model_stream_error, Shapes::ShapeRef.new(shape: ModelStreamError, location_name: "ModelStreamError"))
102
+ ResponseStream.add_member(:internal_stream_failure, Shapes::ShapeRef.new(shape: InternalStreamFailure, location_name: "InternalStreamFailure"))
103
+ ResponseStream.struct_class = Types::ResponseStream
104
+
105
+ ServiceUnavailableException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
106
+ ServiceUnavailableException.struct_class = Types::ServiceUnavailableException
107
+
108
+ ThrottlingException.add_member(:message, Shapes::ShapeRef.new(shape: String, required: true, location_name: "Message"))
109
+ ThrottlingException.struct_class = Types::ThrottlingException
110
+
111
+
112
+ # @api private
113
+ API = Seahorse::Model::Api.new.tap do |api|
114
+
115
+ api.version = "2026-10-01"
116
+
117
+ api.metadata = {
118
+ "apiVersion" => "2026-10-01",
119
+ "auth" => ["aws.auth#sigv4"],
120
+ "endpointPrefix" => "gateway-runtime.sagemaker",
121
+ "protocol" => "rest-json",
122
+ "protocols" => ["rest-json"],
123
+ "serviceFullName" => "Amazon SageMaker Gateway Runtime",
124
+ "serviceId" => "SageMaker Gateway Runtime",
125
+ "signatureVersion" => "v4",
126
+ "signingName" => "sagemaker",
127
+ "uid" => "sagemaker-gateway-runtime-2026-10-01",
128
+ }
129
+
130
+ api.add_operation(:invoke_global_inference_gateway, Seahorse::Model::Operation.new.tap do |o|
131
+ o.name = "InvokeGlobalInferenceGateway"
132
+ o.http_method = "POST"
133
+ o.http_request_uri = "/global-inference-gateway/{GatewayId}/invocations"
134
+ o.input = Shapes::ShapeRef.new(shape: InvokeGlobalInferenceGatewayInput)
135
+ o.output = Shapes::ShapeRef.new(shape: InvokeGlobalInferenceGatewayOutput)
136
+ o.errors << Shapes::ShapeRef.new(shape: GatewayTimeoutException)
137
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
138
+ o.errors << Shapes::ShapeRef.new(shape: BadGatewayException)
139
+ o.errors << Shapes::ShapeRef.new(shape: PayloadTooLargeException)
140
+ o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
141
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
142
+ o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
143
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
144
+ end)
145
+
146
+ api.add_operation(:invoke_global_inference_gateway_with_response_stream, Seahorse::Model::Operation.new.tap do |o|
147
+ o.name = "InvokeGlobalInferenceGatewayWithResponseStream"
148
+ o.http_method = "POST"
149
+ o.http_request_uri = "/global-inference-gateway/{GatewayId}/invocations-response-stream"
150
+ o.input = Shapes::ShapeRef.new(shape: InvokeGlobalInferenceGatewayWithResponseStreamInput)
151
+ o.output = Shapes::ShapeRef.new(shape: InvokeGlobalInferenceGatewayWithResponseStreamOutput)
152
+ o.errors << Shapes::ShapeRef.new(shape: GatewayTimeoutException)
153
+ o.errors << Shapes::ShapeRef.new(shape: ThrottlingException)
154
+ o.errors << Shapes::ShapeRef.new(shape: BadGatewayException)
155
+ o.errors << Shapes::ShapeRef.new(shape: ModelStreamError)
156
+ o.errors << Shapes::ShapeRef.new(shape: PayloadTooLargeException)
157
+ o.errors << Shapes::ShapeRef.new(shape: InternalStreamFailure)
158
+ o.errors << Shapes::ShapeRef.new(shape: ServiceUnavailableException)
159
+ o.errors << Shapes::ShapeRef.new(shape: InternalServerException)
160
+ o.errors << Shapes::ShapeRef.new(shape: ResourceNotFoundException)
161
+ o.errors << Shapes::ShapeRef.new(shape: AccessDeniedException)
162
+ end)
163
+ end
164
+
165
+ end
166
+ 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::SageMakerGatewayRuntime
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::SageMakerGatewayRuntime
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://gateway-runtime.sagemaker-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://gateway-runtime.sagemaker-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://gateway-runtime.sagemaker.#{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://gateway-runtime.sagemaker.#{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::SageMakerGatewayRuntime
12
+ # @api private
13
+ module Endpoints
14
+
15
+
16
+ def self.parameters_for_operation(context)
17
+ Aws::SageMakerGatewayRuntime::EndpointParameters.create(context.config)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,229 @@
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::SageMakerGatewayRuntime
11
+
12
+ # When SageMakerGatewayRuntime returns an error response, the Ruby SDK constructs and raises an error.
13
+ # These errors all extend Aws::SageMakerGatewayRuntime::Errors::ServiceError < {Aws::Errors::ServiceError}
14
+ #
15
+ # You can rescue all SageMakerGatewayRuntime errors using ServiceError:
16
+ #
17
+ # begin
18
+ # # do stuff
19
+ # rescue Aws::SageMakerGatewayRuntime::Errors::ServiceError
20
+ # # rescues all SageMakerGatewayRuntime 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
+ # * {GatewayTimeoutException}
33
+ # * {InternalServerException}
34
+ # * {InternalStreamFailure}
35
+ # * {ModelStreamError}
36
+ # * {PayloadTooLargeException}
37
+ # * {ResourceNotFoundException}
38
+ # * {ServiceUnavailableException}
39
+ # * {ThrottlingException}
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::SageMakerGatewayRuntime::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 BadGatewayException < ServiceError
63
+
64
+ # @param [Seahorse::Client::RequestContext] context
65
+ # @param [String] message
66
+ # @param [Aws::SageMakerGatewayRuntime::Types::BadGatewayException] 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 GatewayTimeoutException < ServiceError
78
+
79
+ # @param [Seahorse::Client::RequestContext] context
80
+ # @param [String] message
81
+ # @param [Aws::SageMakerGatewayRuntime::Types::GatewayTimeoutException] 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
+ end
91
+
92
+ class InternalServerException < ServiceError
93
+
94
+ # @param [Seahorse::Client::RequestContext] context
95
+ # @param [String] message
96
+ # @param [Aws::SageMakerGatewayRuntime::Types::InternalServerException] data
97
+ def initialize(context, message, data = Aws::EmptyStructure.new)
98
+ super(context, message, data)
99
+ end
100
+
101
+ # @return [String]
102
+ def message
103
+ @message || @data[:message]
104
+ end
105
+
106
+ def retryable?
107
+ true
108
+ end
109
+ end
110
+
111
+ class InternalStreamFailure < ServiceError
112
+
113
+ # @param [Seahorse::Client::RequestContext] context
114
+ # @param [String] message
115
+ # @param [Aws::SageMakerGatewayRuntime::Types::InternalStreamFailure] 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 ModelStreamError < ServiceError
127
+
128
+ # @param [Seahorse::Client::RequestContext] context
129
+ # @param [String] message
130
+ # @param [Aws::SageMakerGatewayRuntime::Types::ModelStreamError] 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
+
140
+ # @return [String]
141
+ def error_code
142
+ @data[:error_code]
143
+ end
144
+ end
145
+
146
+ class PayloadTooLargeException < ServiceError
147
+
148
+ # @param [Seahorse::Client::RequestContext] context
149
+ # @param [String] message
150
+ # @param [Aws::SageMakerGatewayRuntime::Types::PayloadTooLargeException] 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 ResourceNotFoundException < ServiceError
162
+
163
+ # @param [Seahorse::Client::RequestContext] context
164
+ # @param [String] message
165
+ # @param [Aws::SageMakerGatewayRuntime::Types::ResourceNotFoundException] 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
+
175
+ # @return [String]
176
+ def resource_id
177
+ @data[:resource_id]
178
+ end
179
+
180
+ # @return [String]
181
+ def resource_type
182
+ @data[:resource_type]
183
+ end
184
+ end
185
+
186
+ class ServiceUnavailableException < ServiceError
187
+
188
+ # @param [Seahorse::Client::RequestContext] context
189
+ # @param [String] message
190
+ # @param [Aws::SageMakerGatewayRuntime::Types::ServiceUnavailableException] data
191
+ def initialize(context, message, data = Aws::EmptyStructure.new)
192
+ super(context, message, data)
193
+ end
194
+
195
+ # @return [String]
196
+ def message
197
+ @message || @data[:message]
198
+ end
199
+
200
+ def retryable?
201
+ true
202
+ end
203
+ end
204
+
205
+ class ThrottlingException < ServiceError
206
+
207
+ # @param [Seahorse::Client::RequestContext] context
208
+ # @param [String] message
209
+ # @param [Aws::SageMakerGatewayRuntime::Types::ThrottlingException] 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
+
223
+ def throttling?
224
+ true
225
+ end
226
+ end
227
+
228
+ end
229
+ end
@@ -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::SageMakerGatewayRuntime
11
+ module EventStreams
12
+ class ResponseStream
13
+
14
+ def initialize
15
+ @event_emitter = Aws::EventEmitter.new
16
+ end
17
+
18
+ def on_payload_part_event(&block)
19
+ @event_emitter.on(:payload_part, block) if block_given?
20
+ end
21
+
22
+ def on_model_stream_error_event(&block)
23
+ @event_emitter.on(:model_stream_error, block) if block_given?
24
+ end
25
+
26
+ def on_internal_stream_failure_event(&block)
27
+ @event_emitter.on(:internal_stream_failure, block) if block_given?
28
+ end
29
+
30
+ def on_error_event(&block)
31
+ @event_emitter.on(:error, block) if block_given?
32
+ end
33
+
34
+ def on_initial_response_event(&block)
35
+ @event_emitter.on(:initial_response, block) if block_given?
36
+ end
37
+
38
+ def on_unknown_event(&block)
39
+ @event_emitter.on(:unknown_event, block) if block_given?
40
+ end
41
+
42
+ def on_event(&block)
43
+ on_payload_part_event(&block)
44
+ on_model_stream_error_event(&block)
45
+ on_internal_stream_failure_event(&block)
46
+ on_error_event(&block)
47
+ on_initial_response_event(&block)
48
+ on_unknown_event(&block)
49
+ end
50
+
51
+ # @api private
52
+ # @return Aws::EventEmitter
53
+ attr_reader :event_emitter
54
+
55
+ end
56
+
57
+ end
58
+ end
59
+
@@ -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::SageMakerGatewayRuntime
12
+ module Plugins
13
+ class Endpoints < Seahorse::Client::Plugin
14
+ option(
15
+ :endpoint_provider,
16
+ doc_type: 'Aws::SageMakerGatewayRuntime::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::SageMakerGatewayRuntime::EndpointParameters`.
22
+ DOCS
23
+ Aws::SageMakerGatewayRuntime::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::SageMakerGatewayRuntime::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