/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include #include #include namespace Aws { namespace SageMakerRuntime { /** *

The Amazon SageMaker runtime API.

*/ class AWS_SAGEMAKERRUNTIME_API SageMakerRuntimeClient : public Aws::Client::AWSJsonClient, public Aws::Client::ClientWithAsyncTemplateMethods { public: typedef Aws::Client::AWSJsonClient BASECLASS; static const char* SERVICE_NAME; static const char* ALLOCATION_TAG; typedef SageMakerRuntimeClientConfiguration ClientConfigurationType; typedef SageMakerRuntimeEndpointProvider EndpointProviderType; /** * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ SageMakerRuntimeClient(const Aws::SageMakerRuntime::SageMakerRuntimeClientConfiguration& clientConfiguration = Aws::SageMakerRuntime::SageMakerRuntimeClientConfiguration(), std::shared_ptr endpointProvider = Aws::MakeShared(ALLOCATION_TAG)); /** * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ SageMakerRuntimeClient(const Aws::Auth::AWSCredentials& credentials, std::shared_ptr endpointProvider = Aws::MakeShared(ALLOCATION_TAG), const Aws::SageMakerRuntime::SageMakerRuntimeClientConfiguration& clientConfiguration = Aws::SageMakerRuntime::SageMakerRuntimeClientConfiguration()); /** * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, * the default http client factory will be used */ SageMakerRuntimeClient(const std::shared_ptr& credentialsProvider, std::shared_ptr endpointProvider = Aws::MakeShared(ALLOCATION_TAG), const Aws::SageMakerRuntime::SageMakerRuntimeClientConfiguration& clientConfiguration = Aws::SageMakerRuntime::SageMakerRuntimeClientConfiguration()); /* Legacy constructors due deprecation */ /** * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ SageMakerRuntimeClient(const Aws::Client::ClientConfiguration& clientConfiguration); /** * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ SageMakerRuntimeClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration); /** * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, * the default http client factory will be used */ SageMakerRuntimeClient(const std::shared_ptr& credentialsProvider, const Aws::Client::ClientConfiguration& clientConfiguration); /* End of legacy constructors due deprecation */ virtual ~SageMakerRuntimeClient(); /** *

After you deploy a model into production using Amazon SageMaker hosting * services, your client applications use this API to get inferences from the model * hosted at the specified endpoint.

For an overview of Amazon SageMaker, * see How It * Works.

Amazon SageMaker strips all POST headers except those * supported by the API. Amazon SageMaker might add additional headers. You should * not rely on the behavior of headers outside those enumerated in the request * syntax.

Calls to InvokeEndpoint are authenticated by using * Amazon Web Services Signature Version 4. For information, see Authenticating * Requests (Amazon Web Services Signature Version 4) in the Amazon S3 API * Reference.

A customer's model containers must respond to requests * within 60 seconds. The model itself can have a maximum processing time of 60 * seconds before responding to invocations. If your model is going to take 50-60 * seconds of processing time, the SDK socket timeout should be set to be 70 * seconds.

Endpoints are scoped to an individual account, and are * not public. The URL does not contain the account ID, but Amazon SageMaker * determines the account ID from the authentication token that is supplied by the * caller.

See Also:

AWS * API Reference

*/ virtual Model::InvokeEndpointOutcome InvokeEndpoint(const Model::InvokeEndpointRequest& request) const; /** * A Callable wrapper for InvokeEndpoint that returns a future to the operation so that it can be executed in parallel to other requests. */ template Model::InvokeEndpointOutcomeCallable InvokeEndpointCallable(const InvokeEndpointRequestT& request) const { return SubmitCallable(&SageMakerRuntimeClient::InvokeEndpoint, request); } /** * An Async wrapper for InvokeEndpoint that queues the request into a thread executor and triggers associated callback when operation has finished. */ template void InvokeEndpointAsync(const InvokeEndpointRequestT& request, const InvokeEndpointResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const { return SubmitAsync(&SageMakerRuntimeClient::InvokeEndpoint, request, handler, context); } /** *

After you deploy a model into production using Amazon SageMaker hosting * services, your client applications use this API to get inferences from the model * hosted at the specified endpoint in an asynchronous manner.

Inference * requests sent to this API are enqueued for asynchronous processing. The * processing of the inference request may or may not complete before you receive a * response from this API. The response from this API will not contain the result * of the inference request but contain information about where you can locate * it.

Amazon SageMaker strips all POST headers except those * supported by the API. Amazon SageMaker might add additional headers. You should * not rely on the behavior of headers outside those enumerated in the request * syntax.

Calls to InvokeEndpointAsync are authenticated by * using Amazon Web Services Signature Version 4. For information, see Authenticating * Requests (Amazon Web Services Signature Version 4) in the Amazon S3 API * Reference.

See Also:

AWS * API Reference

*/ virtual Model::InvokeEndpointAsyncOutcome InvokeEndpointAsync(const Model::InvokeEndpointAsyncRequest& request) const; /** * A Callable wrapper for InvokeEndpointAsync that returns a future to the operation so that it can be executed in parallel to other requests. */ template Model::InvokeEndpointAsyncOutcomeCallable InvokeEndpointAsyncCallable(const InvokeEndpointAsyncRequestT& request) const { return SubmitCallable(&SageMakerRuntimeClient::InvokeEndpointAsync, request); } /** * An Async wrapper for InvokeEndpointAsync that queues the request into a thread executor and triggers associated callback when operation has finished. */ template void InvokeEndpointAsyncAsync(const InvokeEndpointAsyncRequestT& request, const InvokeEndpointAsyncResponseReceivedHandler& handler, const std::shared_ptr& context = nullptr) const { return SubmitAsync(&SageMakerRuntimeClient::InvokeEndpointAsync, request, handler, context); } void OverrideEndpoint(const Aws::String& endpoint); std::shared_ptr& accessEndpointProvider(); private: friend class Aws::Client::ClientWithAsyncTemplateMethods; void init(const SageMakerRuntimeClientConfiguration& clientConfiguration); SageMakerRuntimeClientConfiguration m_clientConfiguration; std::shared_ptr m_executor; std::shared_ptr m_endpointProvider; }; } // namespace SageMakerRuntime } // namespace Aws