Struct aws_sdk_sagemakerruntime::Client
source · [−]pub struct Client { /* private fields */ }
Expand description
Client for Amazon SageMaker Runtime
Client for invoking operations on Amazon SageMaker Runtime. Each operation on Amazon SageMaker Runtime is a method on this
this struct. .send()
MUST be invoked on the generated operations to dispatch the request to the service.
Examples
Constructing a client and invoking an operation
// create a shared configuration. This can be used & shared between multiple service clients.
let shared_config = aws_config::load_from_env().await;
let client = aws_sdk_sagemakerruntime::Client::new(&shared_config);
// invoke an operation
/* let rsp = client
.<operation_name>().
.<param>("some value")
.send().await; */
Constructing a client with custom configuration
use aws_config::RetryConfig;
let shared_config = aws_config::load_from_env().await;
let config = aws_sdk_sagemakerruntime::config::Builder::from(&shared_config)
.retry_config(RetryConfig::disabled())
.build();
let client = aws_sdk_sagemakerruntime::Client::from_conf(config);
Implementations
sourceimpl Client
impl Client
sourcepub fn with_config(
client: Client<DynConnector, DynMiddleware<DynConnector>>,
conf: Config
) -> Self
pub fn with_config(
client: Client<DynConnector, DynMiddleware<DynConnector>>,
conf: Config
) -> Self
Creates a client with the given service configuration.
sourceimpl Client
impl Client
sourcepub fn invoke_endpoint(&self) -> InvokeEndpoint
pub fn invoke_endpoint(&self) -> InvokeEndpoint
Constructs a fluent builder for the InvokeEndpoint
operation.
- The fluent builder is configurable:
endpoint_name(impl Into<String>)
/set_endpoint_name(Option<String>)
:The name of the endpoint that you specified when you created the endpoint using the CreateEndpoint API.
body(Blob)
/set_body(Option<Blob>)
:Provides input data, in the format specified in the
ContentType
request header. Amazon SageMaker passes all of the data in the body to the model.For information about the format of the request body, see Common Data Formats-Inference.
content_type(impl Into<String>)
/set_content_type(Option<String>)
:The MIME type of the input data in the request body.
accept(impl Into<String>)
/set_accept(Option<String>)
:The desired MIME type of the inference in the response.
custom_attributes(impl Into<String>)
/set_custom_attributes(Option<String>)
:Provides additional information about a request for an inference submitted to a model hosted at an Amazon SageMaker endpoint. The information is an opaque value that is forwarded verbatim. You could use this value, for example, to provide an ID that you can use to track a request or to provide other metadata that a service endpoint was programmed to process. The value must consist of no more than 1024 visible US-ASCII characters as specified in Section 3.3.6. Field Value Components of the Hypertext Transfer Protocol (HTTP/1.1).
The code in your model is responsible for setting or updating any custom attributes in the response. If your code does not set this value in the response, an empty value is returned. For example, if a custom attribute represents the trace ID, your model can prepend the custom attribute with
Trace ID:
in your post-processing function.This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.
target_model(impl Into<String>)
/set_target_model(Option<String>)
:The model to request for inference when invoking a multi-model endpoint.
target_variant(impl Into<String>)
/set_target_variant(Option<String>)
:Specify the production variant to send the inference request to when invoking an endpoint that is running two or more variants. Note that this parameter overrides the default behavior for the endpoint, which is to distribute the invocation traffic based on the variant weights.
For information about how to use variant targeting to perform a/b testing, see Test models in production
target_container_hostname(impl Into<String>)
/set_target_container_hostname(Option<String>)
:If the endpoint hosts multiple containers and is configured to use direct invocation, this parameter specifies the host name of the container to invoke.
inference_id(impl Into<String>)
/set_inference_id(Option<String>)
:If you provide a value, it is added to the captured data when you enable data capture on the endpoint. For information about data capture, see Capture Data.
- On success, responds with
InvokeEndpointOutput
with field(s):body(Option<Blob>)
:Includes the inference provided by the model.
For information about the format of the response body, see Common Data Formats-Inference.
content_type(Option<String>)
:The MIME type of the inference returned in the response body.
invoked_production_variant(Option<String>)
:Identifies the production variant that was invoked.
custom_attributes(Option<String>)
:Provides additional information in the response about the inference returned by a model hosted at an Amazon SageMaker endpoint. The information is an opaque value that is forwarded verbatim. You could use this value, for example, to return an ID received in the
CustomAttributes
header of a request or other metadata that a service endpoint was programmed to produce. The value must consist of no more than 1024 visible US-ASCII characters as specified in Section 3.3.6. Field Value Components of the Hypertext Transfer Protocol (HTTP/1.1). If the customer wants the custom attribute returned, the model must set the custom attribute to be included on the way back.The code in your model is responsible for setting or updating any custom attributes in the response. If your code does not set this value in the response, an empty value is returned. For example, if a custom attribute represents the trace ID, your model can prepend the custom attribute with
Trace ID:
in your post-processing function.This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.
- On failure, responds with
SdkError<InvokeEndpointError>
sourcepub fn invoke_endpoint_async(&self) -> InvokeEndpointAsync
pub fn invoke_endpoint_async(&self) -> InvokeEndpointAsync
Constructs a fluent builder for the InvokeEndpointAsync
operation.
- The fluent builder is configurable:
endpoint_name(impl Into<String>)
/set_endpoint_name(Option<String>)
:The name of the endpoint that you specified when you created the endpoint using the
CreateEndpoint
API.content_type(impl Into<String>)
/set_content_type(Option<String>)
:The MIME type of the input data in the request body.
accept(impl Into<String>)
/set_accept(Option<String>)
:The desired MIME type of the inference in the response.
custom_attributes(impl Into<String>)
/set_custom_attributes(Option<String>)
:Provides additional information about a request for an inference submitted to a model hosted at an Amazon SageMaker endpoint. The information is an opaque value that is forwarded verbatim. You could use this value, for example, to provide an ID that you can use to track a request or to provide other metadata that a service endpoint was programmed to process. The value must consist of no more than 1024 visible US-ASCII characters as specified in Section 3.3.6. Field Value Components of the Hypertext Transfer Protocol (HTTP/1.1).
The code in your model is responsible for setting or updating any custom attributes in the response. If your code does not set this value in the response, an empty value is returned. For example, if a custom attribute represents the trace ID, your model can prepend the custom attribute with
Trace ID
: in your post-processing function.This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.
inference_id(impl Into<String>)
/set_inference_id(Option<String>)
:The identifier for the inference request. Amazon SageMaker will generate an identifier for you if none is specified.
input_location(impl Into<String>)
/set_input_location(Option<String>)
:The Amazon S3 URI where the inference request payload is stored.
request_ttl_seconds(i32)
/set_request_ttl_seconds(Option<i32>)
:Maximum age in seconds a request can be in the queue before it is marked as expired.
- On success, responds with
InvokeEndpointAsyncOutput
with field(s):inference_id(Option<String>)
:Identifier for an inference request. This will be the same as the
InferenceId
specified in the input. Amazon SageMaker will generate an identifier for you if you do not specify one.output_location(Option<String>)
:The Amazon S3 URI where the inference response payload is stored.
- On failure, responds with
SdkError<InvokeEndpointAsyncError>
sourceimpl Client
impl Client
sourcepub fn from_conf_conn<C, E>(conf: Config, conn: C) -> Self where
C: SmithyConnector<Error = E> + Send + 'static,
E: Into<ConnectorError>,
pub fn from_conf_conn<C, E>(conf: Config, conn: C) -> Self where
C: SmithyConnector<Error = E> + Send + 'static,
E: Into<ConnectorError>,
Creates a client with the given service config and connector override.
Trait Implementations
sourceimpl From<Client<DynConnector, DynMiddleware<DynConnector>, Standard>> for Client
impl From<Client<DynConnector, DynMiddleware<DynConnector>, Standard>> for Client
sourcefn from(client: Client<DynConnector, DynMiddleware<DynConnector>>) -> Self
fn from(client: Client<DynConnector, DynMiddleware<DynConnector>>) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more