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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-sagemakergatewayruntime/client.rb +903 -0
- data/lib/aws-sdk-sagemakergatewayruntime/client_api.rb +166 -0
- data/lib/aws-sdk-sagemakergatewayruntime/customizations.rb +0 -0
- data/lib/aws-sdk-sagemakergatewayruntime/endpoint_parameters.rb +69 -0
- data/lib/aws-sdk-sagemakergatewayruntime/endpoint_provider.rb +50 -0
- data/lib/aws-sdk-sagemakergatewayruntime/endpoints.rb +20 -0
- data/lib/aws-sdk-sagemakergatewayruntime/errors.rb +229 -0
- data/lib/aws-sdk-sagemakergatewayruntime/event_streams.rb +59 -0
- data/lib/aws-sdk-sagemakergatewayruntime/plugins/endpoints.rb +77 -0
- data/lib/aws-sdk-sagemakergatewayruntime/resource.rb +26 -0
- data/lib/aws-sdk-sagemakergatewayruntime/types.rb +440 -0
- data/lib/aws-sdk-sagemakergatewayruntime.rb +62 -0
- data/sig/client.rbs +115 -0
- data/sig/errors.rbs +49 -0
- data/sig/resource.rbs +89 -0
- data/sig/types.rbs +104 -0
- metadata +96 -0
|
@@ -0,0 +1,903 @@
|
|
|
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
|
+
require 'seahorse/client/plugins/content_length'
|
|
11
|
+
require 'aws-sdk-core/plugins/credentials_configuration'
|
|
12
|
+
require 'aws-sdk-core/plugins/logging'
|
|
13
|
+
require 'aws-sdk-core/plugins/param_converter'
|
|
14
|
+
require 'aws-sdk-core/plugins/param_validator'
|
|
15
|
+
require 'aws-sdk-core/plugins/user_agent'
|
|
16
|
+
require 'aws-sdk-core/plugins/helpful_socket_errors'
|
|
17
|
+
require 'aws-sdk-core/plugins/retry_errors'
|
|
18
|
+
require 'aws-sdk-core/plugins/global_configuration'
|
|
19
|
+
require 'aws-sdk-core/plugins/regional_endpoint'
|
|
20
|
+
require 'aws-sdk-core/plugins/endpoint_discovery'
|
|
21
|
+
require 'aws-sdk-core/plugins/endpoint_pattern'
|
|
22
|
+
require 'aws-sdk-core/plugins/response_paging'
|
|
23
|
+
require 'aws-sdk-core/plugins/stub_responses'
|
|
24
|
+
require 'aws-sdk-core/plugins/idempotency_token'
|
|
25
|
+
require 'aws-sdk-core/plugins/invocation_id'
|
|
26
|
+
require 'aws-sdk-core/plugins/jsonvalue_converter'
|
|
27
|
+
require 'aws-sdk-core/plugins/client_metrics_plugin'
|
|
28
|
+
require 'aws-sdk-core/plugins/client_metrics_send_plugin'
|
|
29
|
+
require 'aws-sdk-core/plugins/transfer_encoding'
|
|
30
|
+
require 'aws-sdk-core/plugins/http_checksum'
|
|
31
|
+
require 'aws-sdk-core/plugins/checksum_algorithm'
|
|
32
|
+
require 'aws-sdk-core/plugins/request_compression'
|
|
33
|
+
require 'aws-sdk-core/plugins/defaults_mode'
|
|
34
|
+
require 'aws-sdk-core/plugins/recursion_detection'
|
|
35
|
+
require 'aws-sdk-core/plugins/telemetry'
|
|
36
|
+
require 'aws-sdk-core/plugins/sign'
|
|
37
|
+
require 'aws-sdk-core/plugins/protocols/rest_json'
|
|
38
|
+
require 'aws-sdk-core/plugins/event_stream_configuration'
|
|
39
|
+
|
|
40
|
+
module Aws::SageMakerGatewayRuntime
|
|
41
|
+
# An API client for SageMakerGatewayRuntime. To construct a client, you need to configure a `:region` and `:credentials`.
|
|
42
|
+
#
|
|
43
|
+
# client = Aws::SageMakerGatewayRuntime::Client.new(
|
|
44
|
+
# region: region_name,
|
|
45
|
+
# credentials: credentials,
|
|
46
|
+
# # ...
|
|
47
|
+
# )
|
|
48
|
+
#
|
|
49
|
+
# For details on configuring region and credentials see
|
|
50
|
+
# the [developer guide](/sdk-for-ruby/v3/developer-guide/setup-config.html).
|
|
51
|
+
#
|
|
52
|
+
# See {#initialize} for a full list of supported configuration options.
|
|
53
|
+
class Client < Seahorse::Client::Base
|
|
54
|
+
|
|
55
|
+
include Aws::ClientStubs
|
|
56
|
+
|
|
57
|
+
@identifier = :sagemakergatewayruntime
|
|
58
|
+
|
|
59
|
+
set_api(ClientApi::API)
|
|
60
|
+
|
|
61
|
+
add_plugin(Seahorse::Client::Plugins::ContentLength)
|
|
62
|
+
add_plugin(Aws::Plugins::CredentialsConfiguration)
|
|
63
|
+
add_plugin(Aws::Plugins::Logging)
|
|
64
|
+
add_plugin(Aws::Plugins::ParamConverter)
|
|
65
|
+
add_plugin(Aws::Plugins::ParamValidator)
|
|
66
|
+
add_plugin(Aws::Plugins::UserAgent)
|
|
67
|
+
add_plugin(Aws::Plugins::HelpfulSocketErrors)
|
|
68
|
+
add_plugin(Aws::Plugins::RetryErrors)
|
|
69
|
+
add_plugin(Aws::Plugins::GlobalConfiguration)
|
|
70
|
+
add_plugin(Aws::Plugins::RegionalEndpoint)
|
|
71
|
+
add_plugin(Aws::Plugins::EndpointDiscovery)
|
|
72
|
+
add_plugin(Aws::Plugins::EndpointPattern)
|
|
73
|
+
add_plugin(Aws::Plugins::ResponsePaging)
|
|
74
|
+
add_plugin(Aws::Plugins::StubResponses)
|
|
75
|
+
add_plugin(Aws::Plugins::IdempotencyToken)
|
|
76
|
+
add_plugin(Aws::Plugins::InvocationId)
|
|
77
|
+
add_plugin(Aws::Plugins::JsonvalueConverter)
|
|
78
|
+
add_plugin(Aws::Plugins::ClientMetricsPlugin)
|
|
79
|
+
add_plugin(Aws::Plugins::ClientMetricsSendPlugin)
|
|
80
|
+
add_plugin(Aws::Plugins::TransferEncoding)
|
|
81
|
+
add_plugin(Aws::Plugins::HttpChecksum)
|
|
82
|
+
add_plugin(Aws::Plugins::ChecksumAlgorithm)
|
|
83
|
+
add_plugin(Aws::Plugins::RequestCompression)
|
|
84
|
+
add_plugin(Aws::Plugins::DefaultsMode)
|
|
85
|
+
add_plugin(Aws::Plugins::RecursionDetection)
|
|
86
|
+
add_plugin(Aws::Plugins::Telemetry)
|
|
87
|
+
add_plugin(Aws::Plugins::Sign)
|
|
88
|
+
add_plugin(Aws::Plugins::Protocols::RestJson)
|
|
89
|
+
add_plugin(Aws::Plugins::EventStreamConfiguration)
|
|
90
|
+
add_plugin(Aws::SageMakerGatewayRuntime::Plugins::Endpoints)
|
|
91
|
+
|
|
92
|
+
# @overload initialize(options)
|
|
93
|
+
# @param [Hash] options
|
|
94
|
+
#
|
|
95
|
+
# @option options [Array<Seahorse::Client::Plugin>] :plugins ([]])
|
|
96
|
+
# A list of plugins to apply to the client. Each plugin is either a
|
|
97
|
+
# class name or an instance of a plugin class.
|
|
98
|
+
#
|
|
99
|
+
# @option options [required, Aws::CredentialProvider] :credentials
|
|
100
|
+
# Your AWS credentials used for authentication. This can be any class that includes and implements
|
|
101
|
+
# `Aws::CredentialProvider`, or instance of any one of the following classes:
|
|
102
|
+
#
|
|
103
|
+
# * `Aws::Credentials` - Used for configuring static, non-refreshing
|
|
104
|
+
# credentials.
|
|
105
|
+
#
|
|
106
|
+
# * `Aws::SharedCredentials` - Used for loading static credentials from a
|
|
107
|
+
# shared file, such as `~/.aws/config`.
|
|
108
|
+
#
|
|
109
|
+
# * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
|
|
110
|
+
#
|
|
111
|
+
# * `Aws::AssumeRoleWebIdentityCredentials` - Used when you need to
|
|
112
|
+
# assume a role after providing credentials via the web.
|
|
113
|
+
#
|
|
114
|
+
# * `Aws::SSOCredentials` - Used for loading credentials from AWS SSO using an
|
|
115
|
+
# access token generated from `aws login`.
|
|
116
|
+
#
|
|
117
|
+
# * `Aws::ProcessCredentials` - Used for loading credentials from a
|
|
118
|
+
# process that outputs to stdout.
|
|
119
|
+
#
|
|
120
|
+
# * `Aws::InstanceProfileCredentials` - Used for loading credentials
|
|
121
|
+
# from an EC2 IMDS on an EC2 instance.
|
|
122
|
+
#
|
|
123
|
+
# * `Aws::ECSCredentials` - Used for loading credentials from
|
|
124
|
+
# instances running in ECS.
|
|
125
|
+
#
|
|
126
|
+
# * `Aws::CognitoIdentityCredentials` - Used for loading credentials
|
|
127
|
+
# from the Cognito Identity service.
|
|
128
|
+
#
|
|
129
|
+
# When `:credentials` are not configured directly, the following locations will be searched for credentials:
|
|
130
|
+
#
|
|
131
|
+
# * `Aws.config[:credentials]`
|
|
132
|
+
#
|
|
133
|
+
# * The `:access_key_id`, `:secret_access_key`, `:session_token`, and
|
|
134
|
+
# `:account_id` options.
|
|
135
|
+
#
|
|
136
|
+
# * `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`,
|
|
137
|
+
# `ENV['AWS_SESSION_TOKEN']`, and `ENV['AWS_ACCOUNT_ID']`.
|
|
138
|
+
#
|
|
139
|
+
# * `~/.aws/credentials`
|
|
140
|
+
#
|
|
141
|
+
# * `~/.aws/config`
|
|
142
|
+
#
|
|
143
|
+
# * EC2/ECS IMDS instance profile - When used by default, the timeouts are very aggressive.
|
|
144
|
+
# Construct and pass an instance of `Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
|
|
145
|
+
# enable retries and extended timeouts. Instance profile credential fetching can be disabled by
|
|
146
|
+
# setting `ENV['AWS_EC2_METADATA_DISABLED']` to `true`.
|
|
147
|
+
#
|
|
148
|
+
# @option options [required, String] :region
|
|
149
|
+
# The AWS region to connect to. The configured `:region` is
|
|
150
|
+
# used to determine the service `:endpoint`. When not passed,
|
|
151
|
+
# a default `:region` is searched for in the following locations:
|
|
152
|
+
#
|
|
153
|
+
# * `Aws.config[:region]`
|
|
154
|
+
# * `ENV['AWS_REGION']`
|
|
155
|
+
# * `ENV['AMAZON_REGION']`
|
|
156
|
+
# * `ENV['AWS_DEFAULT_REGION']`
|
|
157
|
+
# * `~/.aws/credentials`
|
|
158
|
+
# * `~/.aws/config`
|
|
159
|
+
#
|
|
160
|
+
# @option options [String] :access_key_id
|
|
161
|
+
#
|
|
162
|
+
# @option options [String] :account_id
|
|
163
|
+
#
|
|
164
|
+
# @option options [Boolean] :active_endpoint_cache (false)
|
|
165
|
+
# When set to `true`, a thread polling for endpoints will be running in
|
|
166
|
+
# the background every 60 secs (default). Defaults to `false`.
|
|
167
|
+
#
|
|
168
|
+
# @option options [Boolean] :adaptive_retry_wait_to_fill (true)
|
|
169
|
+
# Used only in `adaptive` retry mode. When true, the request will sleep
|
|
170
|
+
# until there is sufficent client side capacity to retry the request.
|
|
171
|
+
# When false, the request will raise a `RetryCapacityNotAvailableError` and will
|
|
172
|
+
# not retry instead of sleeping.
|
|
173
|
+
#
|
|
174
|
+
# @option options [Array<String>] :auth_scheme_preference
|
|
175
|
+
# A list of preferred authentication schemes to use when making a request. Supported values are:
|
|
176
|
+
# `sigv4`, `sigv4a`, `httpBearerAuth`, and `noAuth`. When set using `ENV['AWS_AUTH_SCHEME_PREFERENCE']` or in
|
|
177
|
+
# shared config as `auth_scheme_preference`, the value should be a comma-separated list.
|
|
178
|
+
#
|
|
179
|
+
# @option options [Boolean] :client_side_monitoring (false)
|
|
180
|
+
# When `true`, client-side metrics will be collected for all API requests from
|
|
181
|
+
# this client.
|
|
182
|
+
#
|
|
183
|
+
# @option options [String] :client_side_monitoring_client_id ("")
|
|
184
|
+
# Allows you to provide an identifier for this client which will be attached to
|
|
185
|
+
# all generated client side metrics. Defaults to an empty string.
|
|
186
|
+
#
|
|
187
|
+
# @option options [String] :client_side_monitoring_host ("127.0.0.1")
|
|
188
|
+
# Allows you to specify the DNS hostname or IPv4 or IPv6 address that the client
|
|
189
|
+
# side monitoring agent is running on, where client metrics will be published via UDP.
|
|
190
|
+
#
|
|
191
|
+
# @option options [Integer] :client_side_monitoring_port (31000)
|
|
192
|
+
# Required for publishing client metrics. The port that the client side monitoring
|
|
193
|
+
# agent is running on, where client metrics will be published via UDP.
|
|
194
|
+
#
|
|
195
|
+
# @option options [Aws::ClientSideMonitoring::Publisher] :client_side_monitoring_publisher (Aws::ClientSideMonitoring::Publisher)
|
|
196
|
+
# Allows you to provide a custom client-side monitoring publisher class. By default,
|
|
197
|
+
# will use the Client Side Monitoring Agent Publisher.
|
|
198
|
+
#
|
|
199
|
+
# @option options [Boolean] :convert_params (true)
|
|
200
|
+
# When `true`, an attempt is made to coerce request parameters into
|
|
201
|
+
# the required types.
|
|
202
|
+
#
|
|
203
|
+
# @option options [Boolean] :correct_clock_skew (true)
|
|
204
|
+
# Used only in `standard` and `adaptive` retry modes. Specifies whether
|
|
205
|
+
# to apply a clock skew correction and retry requests with skewed client
|
|
206
|
+
# clocks. Takes effect only when `disable_clock_skew_correction` is not set.
|
|
207
|
+
#
|
|
208
|
+
# @option options [String] :defaults_mode ("legacy")
|
|
209
|
+
# See {Aws::DefaultsModeConfiguration} for a list of the
|
|
210
|
+
# accepted modes and the configuration defaults that are included.
|
|
211
|
+
#
|
|
212
|
+
# @option options [Boolean] :disable_clock_skew_correction
|
|
213
|
+
# Used only in `standard` and `adaptive` retry modes. When `true`, the
|
|
214
|
+
# SDK does not apply a clock skew correction, does not update its stored
|
|
215
|
+
# skew from responses, and does not retry clock skew errors. Clock skew
|
|
216
|
+
# correction is enabled by default.
|
|
217
|
+
#
|
|
218
|
+
# @option options [Boolean] :disable_host_prefix_injection (false)
|
|
219
|
+
# When `true`, the SDK will not prepend the modeled host prefix to the endpoint.
|
|
220
|
+
#
|
|
221
|
+
# @option options [Boolean] :disable_request_compression (false)
|
|
222
|
+
# When set to 'true' the request body will not be compressed
|
|
223
|
+
# for supported operations.
|
|
224
|
+
#
|
|
225
|
+
# @option options [String, URI::HTTPS, URI::HTTP] :endpoint
|
|
226
|
+
# Normally you should not configure the `:endpoint` option
|
|
227
|
+
# directly. This is normally constructed from the `:region`
|
|
228
|
+
# option. Configuring `:endpoint` is normally reserved for
|
|
229
|
+
# connecting to test or custom endpoints. The endpoint should
|
|
230
|
+
# be a URI formatted like:
|
|
231
|
+
#
|
|
232
|
+
# 'http://example.com'
|
|
233
|
+
# 'https://example.com'
|
|
234
|
+
# 'http://example.com:123'
|
|
235
|
+
#
|
|
236
|
+
# @option options [Integer] :endpoint_cache_max_entries (1000)
|
|
237
|
+
# Used for the maximum size limit of the LRU cache storing endpoints data
|
|
238
|
+
# for endpoint discovery enabled operations. Defaults to 1000.
|
|
239
|
+
#
|
|
240
|
+
# @option options [Integer] :endpoint_cache_max_threads (10)
|
|
241
|
+
# Used for the maximum threads in use for polling endpoints to be cached, defaults to 10.
|
|
242
|
+
#
|
|
243
|
+
# @option options [Integer] :endpoint_cache_poll_interval (60)
|
|
244
|
+
# When :endpoint_discovery and :active_endpoint_cache is enabled,
|
|
245
|
+
# Use this option to config the time interval in seconds for making
|
|
246
|
+
# requests fetching endpoints information. Defaults to 60 sec.
|
|
247
|
+
#
|
|
248
|
+
# @option options [Boolean] :endpoint_discovery (false)
|
|
249
|
+
# When set to `true`, endpoint discovery will be enabled for operations when available.
|
|
250
|
+
#
|
|
251
|
+
# @option options [Proc] :event_stream_handler
|
|
252
|
+
# When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
|
|
253
|
+
#
|
|
254
|
+
# @option options [Boolean] :ignore_configured_endpoint_urls
|
|
255
|
+
# Setting to true disables use of endpoint URLs provided via environment
|
|
256
|
+
# variables and the shared configuration file.
|
|
257
|
+
#
|
|
258
|
+
# @option options [Proc] :input_event_stream_handler
|
|
259
|
+
# When an EventStream or Proc object is provided, it can be used for sending events for the event stream.
|
|
260
|
+
#
|
|
261
|
+
# @option options [Aws::Log::Formatter] :log_formatter (Aws::Log::Formatter.default)
|
|
262
|
+
# The log formatter.
|
|
263
|
+
#
|
|
264
|
+
# @option options [Symbol] :log_level (:info)
|
|
265
|
+
# The log level to send messages to the `:logger` at.
|
|
266
|
+
#
|
|
267
|
+
# @option options [Logger] :logger
|
|
268
|
+
# The Logger instance to send log messages to. If this option
|
|
269
|
+
# is not set, logging will be disabled.
|
|
270
|
+
#
|
|
271
|
+
# @option options [Integer] :max_attempts (3)
|
|
272
|
+
# An integer representing the maximum number attempts that will be made for
|
|
273
|
+
# a single request, including the initial attempt. For example,
|
|
274
|
+
# setting this value to 5 will result in a request being retried up to
|
|
275
|
+
# 4 times. Used in `standard` and `adaptive` retry modes. Defaults to 3,
|
|
276
|
+
# except for DynamoDB and DynamoDB Streams, which default to 4.
|
|
277
|
+
#
|
|
278
|
+
# @option options [Proc] :output_event_stream_handler
|
|
279
|
+
# When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
|
|
280
|
+
#
|
|
281
|
+
# @option options [String] :profile ("default")
|
|
282
|
+
# Used when loading credentials from the shared credentials file at `HOME/.aws/credentials`.
|
|
283
|
+
# When not specified, 'default' is used.
|
|
284
|
+
#
|
|
285
|
+
# @option options [String] :request_checksum_calculation ("when_supported")
|
|
286
|
+
# Determines when a checksum will be calculated for request payloads. Values are:
|
|
287
|
+
#
|
|
288
|
+
# * `when_supported` - (default) When set, a checksum will be
|
|
289
|
+
# calculated for all request payloads of operations modeled with the
|
|
290
|
+
# `httpChecksum` trait where `requestChecksumRequired` is `true` and/or a
|
|
291
|
+
# `requestAlgorithmMember` is modeled.
|
|
292
|
+
# * `when_required` - When set, a checksum will only be calculated for
|
|
293
|
+
# request payloads of operations modeled with the `httpChecksum` trait where
|
|
294
|
+
# `requestChecksumRequired` is `true` or where a `requestAlgorithmMember`
|
|
295
|
+
# is modeled and supplied.
|
|
296
|
+
#
|
|
297
|
+
# @option options [Integer] :request_min_compression_size_bytes (10240)
|
|
298
|
+
# The minimum size in bytes that triggers compression for request
|
|
299
|
+
# bodies. The value must be non-negative integer value between 0
|
|
300
|
+
# and 10485780 bytes inclusive.
|
|
301
|
+
#
|
|
302
|
+
# @option options [String] :response_checksum_validation ("when_supported")
|
|
303
|
+
# Determines when checksum validation will be performed on response payloads. Values are:
|
|
304
|
+
#
|
|
305
|
+
# * `when_supported` - (default) When set, checksum validation is performed on all
|
|
306
|
+
# response payloads of operations modeled with the `httpChecksum` trait where
|
|
307
|
+
# `responseAlgorithms` is modeled, except when no modeled checksum algorithms
|
|
308
|
+
# are supported.
|
|
309
|
+
# * `when_required` - When set, checksum validation is not performed on
|
|
310
|
+
# response payloads of operations unless the checksum algorithm is supported and
|
|
311
|
+
# the `requestValidationModeMember` member is set to `ENABLED`.
|
|
312
|
+
#
|
|
313
|
+
# @option options [Proc] :retry_backoff
|
|
314
|
+
# A proc or lambda used for backoff. Defaults to 2**retries * retry_base_delay.
|
|
315
|
+
# This option is only used in the `legacy` retry mode.
|
|
316
|
+
#
|
|
317
|
+
# @option options [Float] :retry_base_delay (0.3)
|
|
318
|
+
# The base delay in seconds used by the default backoff function. This option
|
|
319
|
+
# is only used in the `legacy` retry mode.
|
|
320
|
+
#
|
|
321
|
+
# @option options [Symbol] :retry_jitter (:none)
|
|
322
|
+
# A delay randomiser function used by the default backoff function.
|
|
323
|
+
# Some predefined functions can be referenced by name - :none, :equal, :full,
|
|
324
|
+
# otherwise a Proc that takes and returns a number. This option is only used
|
|
325
|
+
# in the `legacy` retry mode.
|
|
326
|
+
#
|
|
327
|
+
# @see https://www.awsarchitectureblog.com/2015/03/backoff.html
|
|
328
|
+
#
|
|
329
|
+
# @option options [Integer] :retry_limit (3)
|
|
330
|
+
# The maximum number of times to retry failed requests. Only
|
|
331
|
+
# ~ 500 level server errors and certain ~ 400 level client errors
|
|
332
|
+
# are retried. Generally, these are throttling errors, data
|
|
333
|
+
# checksum errors, networking errors, timeout errors, auth errors,
|
|
334
|
+
# endpoint discovery, and errors from expired credentials.
|
|
335
|
+
# This option is only used in the `legacy` retry mode.
|
|
336
|
+
#
|
|
337
|
+
# @option options [Integer] :retry_max_delay (0)
|
|
338
|
+
# The maximum number of seconds to delay between retries (0 for no limit)
|
|
339
|
+
# used by the default backoff function. This option is only used in the
|
|
340
|
+
# `legacy` retry mode.
|
|
341
|
+
#
|
|
342
|
+
# @option options [String] :retry_mode ("standard")
|
|
343
|
+
# Specifies which retry algorithm to use. Values are:
|
|
344
|
+
#
|
|
345
|
+
# * `legacy` - The pre-existing retry behavior.
|
|
346
|
+
#
|
|
347
|
+
# * `standard` - A standardized set of retry rules across the AWS SDKs.
|
|
348
|
+
# This includes support for retry quotas, which limit the number of
|
|
349
|
+
# unsuccessful retries a client can make. This is the default value
|
|
350
|
+
# if no retry mode is provided.
|
|
351
|
+
#
|
|
352
|
+
# * `adaptive` - A retry mode that includes all the functionality of
|
|
353
|
+
# `standard` mode along with automatic client side throttling.
|
|
354
|
+
#
|
|
355
|
+
# @option options [String] :sdk_ua_app_id
|
|
356
|
+
# A unique and opaque application ID that is appended to the
|
|
357
|
+
# User-Agent header as app/sdk_ua_app_id. It should have a
|
|
358
|
+
# maximum length of 50. This variable is sourced from environment
|
|
359
|
+
# variable AWS_SDK_UA_APP_ID or the shared config profile attribute sdk_ua_app_id.
|
|
360
|
+
#
|
|
361
|
+
# @option options [String] :secret_access_key
|
|
362
|
+
#
|
|
363
|
+
# @option options [String] :session_token
|
|
364
|
+
#
|
|
365
|
+
# @option options [Array] :sigv4a_signing_region_set
|
|
366
|
+
# A list of regions that should be signed with SigV4a signing. When
|
|
367
|
+
# not passed, a default `:sigv4a_signing_region_set` is searched for
|
|
368
|
+
# in the following locations:
|
|
369
|
+
#
|
|
370
|
+
# * `Aws.config[:sigv4a_signing_region_set]`
|
|
371
|
+
# * `ENV['AWS_SIGV4A_SIGNING_REGION_SET']`
|
|
372
|
+
# * `~/.aws/config`
|
|
373
|
+
#
|
|
374
|
+
# @option options [Boolean] :stub_responses (false)
|
|
375
|
+
# Causes the client to return stubbed responses. By default
|
|
376
|
+
# fake responses are generated and returned. You can specify
|
|
377
|
+
# the response data to return or errors to raise by calling
|
|
378
|
+
# {ClientStubs#stub_responses}. See {ClientStubs} for more information.
|
|
379
|
+
#
|
|
380
|
+
# ** Please note ** When response stubbing is enabled, no HTTP
|
|
381
|
+
# requests are made, and retries are disabled.
|
|
382
|
+
#
|
|
383
|
+
# @option options [Aws::Telemetry::TelemetryProviderBase] :telemetry_provider (Aws::Telemetry::NoOpTelemetryProvider)
|
|
384
|
+
# Allows you to provide a telemetry provider, which is used to
|
|
385
|
+
# emit telemetry data. By default, uses `NoOpTelemetryProvider` which
|
|
386
|
+
# will not record or emit any telemetry data. The SDK supports the
|
|
387
|
+
# following telemetry providers:
|
|
388
|
+
#
|
|
389
|
+
# * OpenTelemetry (OTel) - To use the OTel provider, install and require the
|
|
390
|
+
# `opentelemetry-sdk` gem and then, pass in an instance of a
|
|
391
|
+
# `Aws::Telemetry::OTelProvider` for telemetry provider.
|
|
392
|
+
#
|
|
393
|
+
# @option options [Aws::TokenProvider] :token_provider
|
|
394
|
+
# Your Bearer token used for authentication. This can be any class that includes and implements
|
|
395
|
+
# `Aws::TokenProvider`, or instance of any one of the following classes:
|
|
396
|
+
#
|
|
397
|
+
# * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
|
|
398
|
+
# tokens.
|
|
399
|
+
#
|
|
400
|
+
# * `Aws::SSOTokenProvider` - Used for loading tokens from AWS SSO using an
|
|
401
|
+
# access token generated from `aws login`.
|
|
402
|
+
#
|
|
403
|
+
# When `:token_provider` is not configured directly, the `Aws::TokenProviderChain`
|
|
404
|
+
# will be used to search for tokens configured for your profile in shared configuration files.
|
|
405
|
+
#
|
|
406
|
+
# @option options [Boolean] :use_dualstack_endpoint
|
|
407
|
+
# When set to `true`, dualstack enabled endpoints (with `.aws` TLD)
|
|
408
|
+
# will be used if available.
|
|
409
|
+
#
|
|
410
|
+
# @option options [Boolean] :use_fips_endpoint
|
|
411
|
+
# When set to `true`, fips compatible endpoints will be used if available.
|
|
412
|
+
# When a `fips` region is used, the region is normalized and this config
|
|
413
|
+
# is set to `true`.
|
|
414
|
+
#
|
|
415
|
+
# @option options [Boolean] :validate_params (true)
|
|
416
|
+
# When `true`, request parameters are validated before
|
|
417
|
+
# sending the request.
|
|
418
|
+
#
|
|
419
|
+
# @option options [Aws::SageMakerGatewayRuntime::EndpointProvider] :endpoint_provider
|
|
420
|
+
# The endpoint provider used to resolve endpoints. Any object that responds to
|
|
421
|
+
# `#resolve_endpoint(parameters)` where `parameters` is a Struct similar to
|
|
422
|
+
# `Aws::SageMakerGatewayRuntime::EndpointParameters`.
|
|
423
|
+
#
|
|
424
|
+
# @option options [Float] :http_continue_timeout (1)
|
|
425
|
+
# The number of seconds to wait for a 100-continue response before sending the
|
|
426
|
+
# request body. This option has no effect unless the request has "Expect"
|
|
427
|
+
# header set to "100-continue". Defaults to `nil` which disables this
|
|
428
|
+
# behaviour. This value can safely be set per request on the session.
|
|
429
|
+
#
|
|
430
|
+
# @option options [Float] :http_idle_timeout (5)
|
|
431
|
+
# The number of seconds a connection is allowed to sit idle before it
|
|
432
|
+
# is considered stale. Stale connections are closed and removed from the
|
|
433
|
+
# pool before making a request.
|
|
434
|
+
#
|
|
435
|
+
# @option options [Float] :http_open_timeout (15)
|
|
436
|
+
# The default number of seconds to wait for response data.
|
|
437
|
+
# This value can safely be set per-request on the session.
|
|
438
|
+
#
|
|
439
|
+
# @option options [URI::HTTP,String] :http_proxy
|
|
440
|
+
# A proxy to send requests through. Formatted like 'http://proxy.com:123'.
|
|
441
|
+
#
|
|
442
|
+
# @option options [Float] :http_read_timeout (60)
|
|
443
|
+
# The default number of seconds to wait for response data.
|
|
444
|
+
# This value can safely be set per-request on the session.
|
|
445
|
+
#
|
|
446
|
+
# @option options [Boolean] :http_wire_trace (false)
|
|
447
|
+
# When `true`, HTTP debug output will be sent to the `:logger`.
|
|
448
|
+
#
|
|
449
|
+
# @option options [Proc] :on_chunk_received
|
|
450
|
+
# When a Proc object is provided, it will be used as callback when each chunk
|
|
451
|
+
# of the response body is received. It provides three arguments: the chunk,
|
|
452
|
+
# the number of bytes received, and the total number of
|
|
453
|
+
# bytes in the response (or nil if the server did not send a `content-length`).
|
|
454
|
+
#
|
|
455
|
+
# @option options [Proc] :on_chunk_sent
|
|
456
|
+
# When a Proc object is provided, it will be used as callback when each chunk
|
|
457
|
+
# of the request body is sent. It provides three arguments: the chunk,
|
|
458
|
+
# the number of bytes read from the body, and the total number of
|
|
459
|
+
# bytes in the body.
|
|
460
|
+
#
|
|
461
|
+
# @option options [Boolean] :raise_response_errors (true)
|
|
462
|
+
# When `true`, response errors are raised.
|
|
463
|
+
#
|
|
464
|
+
# @option options [String] :ssl_ca_bundle
|
|
465
|
+
# Full path to the SSL certificate authority bundle file that should be used when
|
|
466
|
+
# verifying peer certificates. If you do not pass `:ssl_ca_bundle` or
|
|
467
|
+
# `:ssl_ca_directory` the the system default will be used if available.
|
|
468
|
+
#
|
|
469
|
+
# @option options [String] :ssl_ca_directory
|
|
470
|
+
# Full path of the directory that contains the unbundled SSL certificate
|
|
471
|
+
# authority files for verifying peer certificates. If you do
|
|
472
|
+
# not pass `:ssl_ca_bundle` or `:ssl_ca_directory` the the system
|
|
473
|
+
# default will be used if available.
|
|
474
|
+
#
|
|
475
|
+
# @option options [String] :ssl_ca_store
|
|
476
|
+
# Sets the X509::Store to verify peer certificate.
|
|
477
|
+
#
|
|
478
|
+
# @option options [OpenSSL::X509::Certificate] :ssl_cert
|
|
479
|
+
# Sets a client certificate when creating http connections.
|
|
480
|
+
#
|
|
481
|
+
# @option options [OpenSSL::PKey] :ssl_key
|
|
482
|
+
# Sets a client key when creating http connections.
|
|
483
|
+
#
|
|
484
|
+
# @option options [Float] :ssl_timeout
|
|
485
|
+
# Sets the SSL timeout in seconds
|
|
486
|
+
#
|
|
487
|
+
# @option options [Boolean] :ssl_verify_peer (true)
|
|
488
|
+
# When `true`, SSL peer certificates are verified when establishing a connection.
|
|
489
|
+
#
|
|
490
|
+
def initialize(*args)
|
|
491
|
+
super
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
# @!group API Operations
|
|
495
|
+
|
|
496
|
+
# Buffered (non-streaming) inference. Returns the full OpenAI completion
|
|
497
|
+
# body.
|
|
498
|
+
#
|
|
499
|
+
# Errors carry their origin in the `Message` prefix. Every typed
|
|
500
|
+
# error's text is in the `Message` member (JSON key `Message`), and
|
|
501
|
+
# starts with one of these prefixes:
|
|
502
|
+
#
|
|
503
|
+
# * `Global Inference Gateway:` -- the gateway rejected or failed the
|
|
504
|
+
# request itself: validation, authorization, throttling, routing (the
|
|
505
|
+
# gateway or model was not found, or no capacity is available), a
|
|
506
|
+
# gateway limit or time limit, or failing to reach the inference
|
|
507
|
+
# gateway (`Global Inference Gateway: could not reach the inference
|
|
508
|
+
# gateway: <reason>`, or `Global Inference Gateway: timed out waiting
|
|
509
|
+
# for the inference gateway`). This includes the 400 for an invalid
|
|
510
|
+
# request and the 413 for a request body that is too large.
|
|
511
|
+
# * `inference gateway:` -- the inference gateway serving the model
|
|
512
|
+
# returned an error status. The message gives that status code and up
|
|
513
|
+
# to 256 bytes of its error message, for example `inference gateway:
|
|
514
|
+
# 503 <message>`. A BadGatewayException can instead read `inference
|
|
515
|
+
# gateway: response ended unexpectedly`, with no status, when the
|
|
516
|
+
# inference gateway's connection failed while it was sending the
|
|
517
|
+
# response.
|
|
518
|
+
# * `inference gateway (<component>):` -- the same, when the inference
|
|
519
|
+
# gateway reports which of its components produced the error, for
|
|
520
|
+
# example `inference gateway (model server): 502 <message>`. The
|
|
521
|
+
# component is one of:
|
|
522
|
+
# * `config` -- the inference gateway's configuration and proxy
|
|
523
|
+
# layer.
|
|
524
|
+
# * `scheduler` -- the inference gateway's request scheduler.
|
|
525
|
+
# * `model selector` -- the inference gateway's model selector.
|
|
526
|
+
# * `model server` -- the model server.
|
|
527
|
+
#
|
|
528
|
+
# Every error status the inference gateway returns is a typed error,
|
|
529
|
+
# chosen by that status:
|
|
530
|
+
#
|
|
531
|
+
# * 400 and any other 4xx not listed here -- a 400 validation error.
|
|
532
|
+
# * 401 and 403 -- AccessDeniedException (403).
|
|
533
|
+
# * 404 -- ResourceNotFoundException.
|
|
534
|
+
# * 408 -- GatewayTimeoutException (504).
|
|
535
|
+
# * 429 -- ThrottlingException, with the `Retry-After` header.
|
|
536
|
+
# * 502, and 500, 503 or any other 5xx not listed here --
|
|
537
|
+
# BadGatewayException (502). A 500 or 503 from the inference gateway
|
|
538
|
+
# comes after the request was dispatched, so it is not modeled as
|
|
539
|
+
# retryable, and the gateway may already have tried another inference
|
|
540
|
+
# gateway. Standard SDK retry modes may still retry a 5xx status; set
|
|
541
|
+
# max attempts to 1 if a repeated inference is unacceptable.
|
|
542
|
+
# * 504 -- GatewayTimeoutException.
|
|
543
|
+
#
|
|
544
|
+
# @option params [required, String] :gateway_id
|
|
545
|
+
# The ID of the Global Inference Gateway to invoke. IAM policies refer
|
|
546
|
+
# to the gateway by its ARN,
|
|
547
|
+
# `arn:<partition>:sagemaker:<region>:<account>:global-inference-gateway/<id>`.
|
|
548
|
+
#
|
|
549
|
+
# @option params [String] :accept
|
|
550
|
+
# The MIME type you want for the response. It is passed to the model
|
|
551
|
+
# server.
|
|
552
|
+
#
|
|
553
|
+
# @option params [required, String] :content_type
|
|
554
|
+
# The MIME type of the request body. Pass `application/json` (parameters
|
|
555
|
+
# such as `charset=utf-8` are allowed): the body is one OpenAI JSON
|
|
556
|
+
# object. The Global Inference Gateway rejects other content types with
|
|
557
|
+
# a 415 error.
|
|
558
|
+
#
|
|
559
|
+
# @option params [String] :customer_identity_token
|
|
560
|
+
# Per-caller customer identity token (a JWT), forwarded unchanged to the
|
|
561
|
+
# inference gateway, which validates it. The gateway does not use it to
|
|
562
|
+
# authorize the request. Include it in the SigV4 signed headers so it
|
|
563
|
+
# cannot be altered in transit. Redacted from logs, metrics and traces.
|
|
564
|
+
#
|
|
565
|
+
# @option params [required, String, StringIO, File] :body
|
|
566
|
+
# The inference request body: one OpenAI JSON object, at most 10 MiB.
|
|
567
|
+
# Its content is passed to the model server unchanged, except that the
|
|
568
|
+
# request is always sent with `"stream": false`: this operation returns
|
|
569
|
+
# one JSON document, so a `"stream": true` in the body is overridden
|
|
570
|
+
# (use InvokeGlobalInferenceGatewayWithResponseStream to stream). A body
|
|
571
|
+
# that is not one JSON object, or that repeats the top-level `model` key
|
|
572
|
+
# with different values, is rejected with a 400 validation error. A body
|
|
573
|
+
# larger than 10 MiB is rejected with PayloadTooLargeException (413).
|
|
574
|
+
# The gateway reads only `model` and `stream`, and does not store the
|
|
575
|
+
# body.
|
|
576
|
+
#
|
|
577
|
+
# **SDK automatically handles json encoding and base64 encoding for you
|
|
578
|
+
# when the required value (Hash, Array, etc.) is provided according to
|
|
579
|
+
# the description.**
|
|
580
|
+
#
|
|
581
|
+
# @return [Types::InvokeGlobalInferenceGatewayOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
|
582
|
+
#
|
|
583
|
+
# * {Types::InvokeGlobalInferenceGatewayOutput#body #body} => String
|
|
584
|
+
#
|
|
585
|
+
# @example Request syntax with placeholder values
|
|
586
|
+
#
|
|
587
|
+
# resp = client.invoke_global_inference_gateway({
|
|
588
|
+
# gateway_id: "GatewayId", # required
|
|
589
|
+
# accept: "String",
|
|
590
|
+
# content_type: "RequestContentType", # required
|
|
591
|
+
# customer_identity_token: "CustomerIdentityToken",
|
|
592
|
+
# body: "data", # required
|
|
593
|
+
# })
|
|
594
|
+
#
|
|
595
|
+
# @example Response structure
|
|
596
|
+
#
|
|
597
|
+
# resp.body #=> String
|
|
598
|
+
#
|
|
599
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/sagemaker-gateway-runtime-2026-10-01/InvokeGlobalInferenceGateway AWS API Documentation
|
|
600
|
+
#
|
|
601
|
+
# @overload invoke_global_inference_gateway(params = {})
|
|
602
|
+
# @param [Hash] params ({})
|
|
603
|
+
def invoke_global_inference_gateway(params = {}, options = {})
|
|
604
|
+
req = build_request(:invoke_global_inference_gateway, params)
|
|
605
|
+
req.send_request(options)
|
|
606
|
+
end
|
|
607
|
+
|
|
608
|
+
# Streaming inference. Returns an AWS event stream of PayloadPart events
|
|
609
|
+
# that carry the model server's server-sent event (SSE) bytes, so SDKs
|
|
610
|
+
# decode the stream into events for you.
|
|
611
|
+
#
|
|
612
|
+
# The errors listed for this operation, other than ModelStreamError and
|
|
613
|
+
# InternalStreamFailure, are returned before the response starts (before
|
|
614
|
+
# the 200 status), so they end the request, not the stream. None of them
|
|
615
|
+
# can occur after the 200. ModelStreamError and InternalStreamFailure
|
|
616
|
+
# appear only as events in the stream, after the 200. Once the 200 is
|
|
617
|
+
# sent, the stream carries the response as PayloadPart events. If
|
|
618
|
+
# reading the inference gateway's response fails, the stream carries
|
|
619
|
+
# one InternalStreamFailure event and then ends. ModelStreamError is
|
|
620
|
+
# reserved and is not currently sent.
|
|
621
|
+
#
|
|
622
|
+
# Errors carry their origin in the `Message` prefix. Every typed
|
|
623
|
+
# error's text is in the `Message` member (JSON key `Message`), and
|
|
624
|
+
# starts with one of these prefixes:
|
|
625
|
+
#
|
|
626
|
+
# * `Global Inference Gateway:` -- the gateway rejected or failed the
|
|
627
|
+
# request itself: validation, authorization, throttling, routing (the
|
|
628
|
+
# gateway or model was not found, or no capacity is available), a
|
|
629
|
+
# gateway limit or time limit, or failing to reach the inference
|
|
630
|
+
# gateway (`Global Inference Gateway: could not reach the inference
|
|
631
|
+
# gateway: <reason>`, or `Global Inference Gateway: timed out waiting
|
|
632
|
+
# for the inference gateway`). This includes the 400 for an invalid
|
|
633
|
+
# request and the 413 for a request body that is too large.
|
|
634
|
+
# * `inference gateway:` -- the inference gateway serving the model
|
|
635
|
+
# returned an error status. The message gives that status code and up
|
|
636
|
+
# to 256 bytes of its error message, for example `inference gateway:
|
|
637
|
+
# 503 <message>`.
|
|
638
|
+
# * `inference gateway (<component>):` -- the same, when the inference
|
|
639
|
+
# gateway reports which of its components produced the error, for
|
|
640
|
+
# example `inference gateway (model server): 502 <message>`. The
|
|
641
|
+
# component is one of:
|
|
642
|
+
# * `config` -- the inference gateway's configuration and proxy
|
|
643
|
+
# layer.
|
|
644
|
+
# * `scheduler` -- the inference gateway's request scheduler.
|
|
645
|
+
# * `model selector` -- the inference gateway's model selector.
|
|
646
|
+
# * `model server` -- the model server.
|
|
647
|
+
#
|
|
648
|
+
# An InternalStreamFailure event's `Message` uses the same prefixes,
|
|
649
|
+
# with the same text the buffered operation uses for the same failure.
|
|
650
|
+
# Its `inference gateway:` message carries no status: `inference
|
|
651
|
+
# gateway: response ended unexpectedly` when the inference gateway's
|
|
652
|
+
# connection failed while it was sending the response.
|
|
653
|
+
#
|
|
654
|
+
# Every error status the inference gateway returns before the 200 is a
|
|
655
|
+
# typed error, chosen by that status as for
|
|
656
|
+
# InvokeGlobalInferenceGateway:
|
|
657
|
+
#
|
|
658
|
+
# * 400 and any other 4xx not listed here -- a 400 validation error.
|
|
659
|
+
# * 401 and 403 -- AccessDeniedException (403).
|
|
660
|
+
# * 404 -- ResourceNotFoundException.
|
|
661
|
+
# * 408 -- GatewayTimeoutException (504).
|
|
662
|
+
# * 429 -- ThrottlingException, with the `Retry-After` header.
|
|
663
|
+
# * 502, and 500, 503 or any other 5xx not listed here --
|
|
664
|
+
# BadGatewayException (502). A 500 or 503 from the inference gateway
|
|
665
|
+
# comes after the request was dispatched, so it is not modeled as
|
|
666
|
+
# retryable, and the gateway may already have tried another inference
|
|
667
|
+
# gateway. Standard SDK retry modes may still retry a 5xx status; set
|
|
668
|
+
# max attempts to 1 if a repeated inference is unacceptable.
|
|
669
|
+
# * 504 -- GatewayTimeoutException.
|
|
670
|
+
#
|
|
671
|
+
# @option params [required, String] :gateway_id
|
|
672
|
+
# The ID of the Global Inference Gateway to invoke, as for
|
|
673
|
+
# InvokeGlobalInferenceGateway.
|
|
674
|
+
#
|
|
675
|
+
# @option params [String] :accept
|
|
676
|
+
# The MIME type you want for the response. It is passed to the model
|
|
677
|
+
# server.
|
|
678
|
+
#
|
|
679
|
+
# @option params [required, String] :content_type
|
|
680
|
+
# The MIME type of the request body, as for
|
|
681
|
+
# InvokeGlobalInferenceGateway. Pass `application/json`.
|
|
682
|
+
#
|
|
683
|
+
# @option params [String] :customer_identity_token
|
|
684
|
+
# The customer identity token (a JWT), as for
|
|
685
|
+
# InvokeGlobalInferenceGateway. It is passed unchanged to the inference
|
|
686
|
+
# gateway, which validates it.
|
|
687
|
+
#
|
|
688
|
+
# @option params [required, String, StringIO, File] :body
|
|
689
|
+
# The inference request body, as for InvokeGlobalInferenceGateway,
|
|
690
|
+
# except that the request is always sent with `"stream": true`: this
|
|
691
|
+
# operation returns an event stream, so a `"stream": false` in the body
|
|
692
|
+
# (or no `stream` key) is overridden. A body larger than 10 MiB is
|
|
693
|
+
# rejected with PayloadTooLargeException (413).
|
|
694
|
+
#
|
|
695
|
+
# **SDK automatically handles json encoding and base64 encoding for you
|
|
696
|
+
# when the required value (Hash, Array, etc.) is provided according to
|
|
697
|
+
# the description.**
|
|
698
|
+
#
|
|
699
|
+
# @return [Types::InvokeGlobalInferenceGatewayWithResponseStreamOutput] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
|
700
|
+
#
|
|
701
|
+
# * {Types::InvokeGlobalInferenceGatewayWithResponseStreamOutput#body #body} => Types::ResponseStream
|
|
702
|
+
#
|
|
703
|
+
# @example EventStream Operation Example
|
|
704
|
+
#
|
|
705
|
+
# # You can process the event once it arrives immediately, or wait until the
|
|
706
|
+
# # full response is complete and iterate through the eventstream enumerator.
|
|
707
|
+
#
|
|
708
|
+
# # To interact with event immediately, you need to register invoke_global_inference_gateway_with_response_stream
|
|
709
|
+
# # with callbacks. Callbacks can be registered for specific events or for all
|
|
710
|
+
# # events, including error events.
|
|
711
|
+
#
|
|
712
|
+
# # Callbacks can be passed into the `:event_stream_handler` option or within a
|
|
713
|
+
# # block statement attached to the #invoke_global_inference_gateway_with_response_stream call directly. Hybrid
|
|
714
|
+
# # pattern of both is also supported.
|
|
715
|
+
#
|
|
716
|
+
# # `:event_stream_handler` option takes in either a Proc object or
|
|
717
|
+
# # Aws::SageMakerGatewayRuntime::EventStreams::ResponseStream object.
|
|
718
|
+
#
|
|
719
|
+
# # Usage pattern a): Callbacks with a block attached to #invoke_global_inference_gateway_with_response_stream
|
|
720
|
+
# # Example for registering callbacks for all event types and an error event
|
|
721
|
+
# client.invoke_global_inference_gateway_with_response_stream(
|
|
722
|
+
# # params input
|
|
723
|
+
# ) do |stream|
|
|
724
|
+
# stream.on_error_event do |event|
|
|
725
|
+
# # catch unmodeled error event in the stream
|
|
726
|
+
# raise event
|
|
727
|
+
# # => Aws::Errors::EventError
|
|
728
|
+
# # event.event_type => :error
|
|
729
|
+
# # event.error_code => String
|
|
730
|
+
# # event.error_message => String
|
|
731
|
+
# end
|
|
732
|
+
#
|
|
733
|
+
# stream.on_event do |event|
|
|
734
|
+
# # process all events arrive
|
|
735
|
+
# puts event.event_type
|
|
736
|
+
# # ...
|
|
737
|
+
# end
|
|
738
|
+
# end
|
|
739
|
+
#
|
|
740
|
+
# # Usage pattern b): Pass in `:event_stream_handler` for #invoke_global_inference_gateway_with_response_stream
|
|
741
|
+
# # 1) Create a Aws::SageMakerGatewayRuntime::EventStreams::ResponseStream object
|
|
742
|
+
# # Example for registering callbacks with specific events
|
|
743
|
+
#
|
|
744
|
+
# handler = Aws::SageMakerGatewayRuntime::EventStreams::ResponseStream.new
|
|
745
|
+
# handler.on_payload_part_event do |event|
|
|
746
|
+
# event # => Aws::SageMakerGatewayRuntime::Types::PayloadPart
|
|
747
|
+
# end
|
|
748
|
+
# handler.on_model_stream_error_event do |event|
|
|
749
|
+
# event # => Aws::SageMakerGatewayRuntime::Types::ModelStreamError
|
|
750
|
+
# end
|
|
751
|
+
# handler.on_internal_stream_failure_event do |event|
|
|
752
|
+
# event # => Aws::SageMakerGatewayRuntime::Types::InternalStreamFailure
|
|
753
|
+
# end
|
|
754
|
+
#
|
|
755
|
+
# client.invoke_global_inference_gateway_with_response_stream(
|
|
756
|
+
# # params inputs
|
|
757
|
+
# event_stream_handler: handler
|
|
758
|
+
# )
|
|
759
|
+
#
|
|
760
|
+
# # 2) Use a Ruby Proc object
|
|
761
|
+
# # Example for registering callbacks with specific events
|
|
762
|
+
# handler = Proc.new do |stream|
|
|
763
|
+
# stream.on_payload_part_event do |event|
|
|
764
|
+
# event # => Aws::SageMakerGatewayRuntime::Types::PayloadPart
|
|
765
|
+
# end
|
|
766
|
+
# stream.on_model_stream_error_event do |event|
|
|
767
|
+
# event # => Aws::SageMakerGatewayRuntime::Types::ModelStreamError
|
|
768
|
+
# end
|
|
769
|
+
# stream.on_internal_stream_failure_event do |event|
|
|
770
|
+
# event # => Aws::SageMakerGatewayRuntime::Types::InternalStreamFailure
|
|
771
|
+
# end
|
|
772
|
+
# end
|
|
773
|
+
#
|
|
774
|
+
# client.invoke_global_inference_gateway_with_response_stream(
|
|
775
|
+
# # params inputs
|
|
776
|
+
# event_stream_handler: handler
|
|
777
|
+
# )
|
|
778
|
+
#
|
|
779
|
+
# # Usage pattern c): Hybrid pattern of a) and b)
|
|
780
|
+
# handler = Aws::SageMakerGatewayRuntime::EventStreams::ResponseStream.new
|
|
781
|
+
# handler.on_payload_part_event do |event|
|
|
782
|
+
# event # => Aws::SageMakerGatewayRuntime::Types::PayloadPart
|
|
783
|
+
# end
|
|
784
|
+
# handler.on_model_stream_error_event do |event|
|
|
785
|
+
# event # => Aws::SageMakerGatewayRuntime::Types::ModelStreamError
|
|
786
|
+
# end
|
|
787
|
+
# handler.on_internal_stream_failure_event do |event|
|
|
788
|
+
# event # => Aws::SageMakerGatewayRuntime::Types::InternalStreamFailure
|
|
789
|
+
# end
|
|
790
|
+
#
|
|
791
|
+
# client.invoke_global_inference_gateway_with_response_stream(
|
|
792
|
+
# # params input
|
|
793
|
+
# event_stream_handler: handler
|
|
794
|
+
# ) do |stream|
|
|
795
|
+
# stream.on_error_event do |event|
|
|
796
|
+
# # catch unmodeled error event in the stream
|
|
797
|
+
# raise event
|
|
798
|
+
# # => Aws::Errors::EventError
|
|
799
|
+
# # event.event_type => :error
|
|
800
|
+
# # event.error_code => String
|
|
801
|
+
# # event.error_message => String
|
|
802
|
+
# end
|
|
803
|
+
# end
|
|
804
|
+
#
|
|
805
|
+
# # You can also iterate through events after the response complete.
|
|
806
|
+
# # Events are available at
|
|
807
|
+
# resp.body # => Enumerator
|
|
808
|
+
# # For parameter input example, please refer to following request syntax.
|
|
809
|
+
#
|
|
810
|
+
# @example Request syntax with placeholder values
|
|
811
|
+
#
|
|
812
|
+
# resp = client.invoke_global_inference_gateway_with_response_stream({
|
|
813
|
+
# gateway_id: "GatewayId", # required
|
|
814
|
+
# accept: "String",
|
|
815
|
+
# content_type: "RequestContentType", # required
|
|
816
|
+
# customer_identity_token: "CustomerIdentityToken",
|
|
817
|
+
# body: "data", # required
|
|
818
|
+
# })
|
|
819
|
+
#
|
|
820
|
+
# @example Response structure
|
|
821
|
+
#
|
|
822
|
+
# # All events are available at resp.body:
|
|
823
|
+
# resp.body #=> Enumerator
|
|
824
|
+
# resp.body.event_types #=> [:payload_part, :model_stream_error, :internal_stream_failure]
|
|
825
|
+
#
|
|
826
|
+
# # For :payload_part event available at #on_payload_part_event callback and response eventstream enumerator:
|
|
827
|
+
# event.bytes #=> String
|
|
828
|
+
#
|
|
829
|
+
# # For :model_stream_error event available at #on_model_stream_error_event callback and response eventstream enumerator:
|
|
830
|
+
# event.message #=> String
|
|
831
|
+
# event.error_code #=> String, one of "StreamBroken", "ModelInvocationTimeExceeded"
|
|
832
|
+
#
|
|
833
|
+
# # For :internal_stream_failure event available at #on_internal_stream_failure_event callback and response eventstream enumerator:
|
|
834
|
+
# event.message #=> String
|
|
835
|
+
#
|
|
836
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/sagemaker-gateway-runtime-2026-10-01/InvokeGlobalInferenceGatewayWithResponseStream AWS API Documentation
|
|
837
|
+
#
|
|
838
|
+
# @overload invoke_global_inference_gateway_with_response_stream(params = {})
|
|
839
|
+
# @param [Hash] params ({})
|
|
840
|
+
def invoke_global_inference_gateway_with_response_stream(params = {}, options = {}, &block)
|
|
841
|
+
params = params.dup
|
|
842
|
+
event_stream_handler = case handler = params.delete(:event_stream_handler)
|
|
843
|
+
when EventStreams::ResponseStream then handler
|
|
844
|
+
when Proc then EventStreams::ResponseStream.new.tap(&handler)
|
|
845
|
+
when nil then EventStreams::ResponseStream.new
|
|
846
|
+
else
|
|
847
|
+
msg = "expected :event_stream_handler to be a block or "\
|
|
848
|
+
"instance of Aws::SageMakerGatewayRuntime::EventStreams::ResponseStream"\
|
|
849
|
+
", got `#{handler.inspect}` instead"
|
|
850
|
+
raise ArgumentError, msg
|
|
851
|
+
end
|
|
852
|
+
|
|
853
|
+
yield(event_stream_handler) if block_given?
|
|
854
|
+
|
|
855
|
+
req = build_request(:invoke_global_inference_gateway_with_response_stream, params)
|
|
856
|
+
|
|
857
|
+
req.context[:event_stream_handler] = event_stream_handler
|
|
858
|
+
req.handlers.add(Aws::Binary::DecodeHandler, priority: 95)
|
|
859
|
+
|
|
860
|
+
req.send_request(options, &block)
|
|
861
|
+
end
|
|
862
|
+
|
|
863
|
+
# @!endgroup
|
|
864
|
+
|
|
865
|
+
# @param params ({})
|
|
866
|
+
# @api private
|
|
867
|
+
def build_request(operation_name, params = {})
|
|
868
|
+
handlers = @handlers.for(operation_name)
|
|
869
|
+
tracer = config.telemetry_provider.tracer_provider.tracer(
|
|
870
|
+
Aws::Telemetry.module_to_tracer_name('Aws::SageMakerGatewayRuntime')
|
|
871
|
+
)
|
|
872
|
+
context = Seahorse::Client::RequestContext.new(
|
|
873
|
+
operation_name: operation_name,
|
|
874
|
+
operation: config.api.operation(operation_name),
|
|
875
|
+
client: self,
|
|
876
|
+
params: params,
|
|
877
|
+
config: config,
|
|
878
|
+
tracer: tracer
|
|
879
|
+
)
|
|
880
|
+
context[:gem_name] = 'aws-sdk-sagemakergatewayruntime'
|
|
881
|
+
context[:gem_version] = '1.0.0'
|
|
882
|
+
Seahorse::Client::Request.new(handlers, context)
|
|
883
|
+
end
|
|
884
|
+
|
|
885
|
+
# @api private
|
|
886
|
+
# @deprecated
|
|
887
|
+
def waiter_names
|
|
888
|
+
[]
|
|
889
|
+
end
|
|
890
|
+
|
|
891
|
+
class << self
|
|
892
|
+
|
|
893
|
+
# @api private
|
|
894
|
+
attr_reader :identifier
|
|
895
|
+
|
|
896
|
+
# @api private
|
|
897
|
+
def errors_module
|
|
898
|
+
Errors
|
|
899
|
+
end
|
|
900
|
+
|
|
901
|
+
end
|
|
902
|
+
end
|
|
903
|
+
end
|