{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMakerRuntime.InvokeEndpointAsync
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- 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 the 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
-- <https://docs.aws.amazon.com/https:/docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html Authenticating Requests (Amazon Web Services Signature Version 4)>
-- in the /Amazon S3 API Reference/.
module Amazonka.SageMakerRuntime.InvokeEndpointAsync
  ( -- * Creating a Request
    InvokeEndpointAsync (..),
    newInvokeEndpointAsync,

    -- * Request Lenses
    invokeEndpointAsync_accept,
    invokeEndpointAsync_contentType,
    invokeEndpointAsync_customAttributes,
    invokeEndpointAsync_inferenceId,
    invokeEndpointAsync_requestTTLSeconds,
    invokeEndpointAsync_endpointName,
    invokeEndpointAsync_inputLocation,

    -- * Destructuring the Response
    InvokeEndpointAsyncResponse (..),
    newInvokeEndpointAsyncResponse,

    -- * Response Lenses
    invokeEndpointAsyncResponse_inferenceId,
    invokeEndpointAsyncResponse_outputLocation,
    invokeEndpointAsyncResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMakerRuntime.Types

-- | /See:/ 'newInvokeEndpointAsync' smart constructor.
data InvokeEndpointAsync = InvokeEndpointAsync'
  { -- | The desired MIME type of the inference in the response.
    InvokeEndpointAsync -> Maybe Text
accept :: Prelude.Maybe Prelude.Text,
    -- | The MIME type of the input data in the request body.
    InvokeEndpointAsync -> Maybe Text
contentType :: Prelude.Maybe Prelude.Text,
    -- | 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
    -- <https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6 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.
    InvokeEndpointAsync -> Maybe (Sensitive Text)
customAttributes :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The identifier for the inference request. Amazon SageMaker will generate
    -- an identifier for you if none is specified.
    InvokeEndpointAsync -> Maybe Text
inferenceId :: Prelude.Maybe Prelude.Text,
    -- | Maximum age in seconds a request can be in the queue before it is marked
    -- as expired.
    InvokeEndpointAsync -> Maybe Natural
requestTTLSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The name of the endpoint that you specified when you created the
    -- endpoint using the
    -- <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html CreateEndpoint>
    -- API.
    InvokeEndpointAsync -> Text
endpointName :: Prelude.Text,
    -- | The Amazon S3 URI where the inference request payload is stored.
    InvokeEndpointAsync -> Text
inputLocation :: Prelude.Text
  }
  deriving (InvokeEndpointAsync -> InvokeEndpointAsync -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvokeEndpointAsync -> InvokeEndpointAsync -> Bool
$c/= :: InvokeEndpointAsync -> InvokeEndpointAsync -> Bool
== :: InvokeEndpointAsync -> InvokeEndpointAsync -> Bool
$c== :: InvokeEndpointAsync -> InvokeEndpointAsync -> Bool
Prelude.Eq, Int -> InvokeEndpointAsync -> ShowS
[InvokeEndpointAsync] -> ShowS
InvokeEndpointAsync -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvokeEndpointAsync] -> ShowS
$cshowList :: [InvokeEndpointAsync] -> ShowS
show :: InvokeEndpointAsync -> String
$cshow :: InvokeEndpointAsync -> String
showsPrec :: Int -> InvokeEndpointAsync -> ShowS
$cshowsPrec :: Int -> InvokeEndpointAsync -> ShowS
Prelude.Show, forall x. Rep InvokeEndpointAsync x -> InvokeEndpointAsync
forall x. InvokeEndpointAsync -> Rep InvokeEndpointAsync x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InvokeEndpointAsync x -> InvokeEndpointAsync
$cfrom :: forall x. InvokeEndpointAsync -> Rep InvokeEndpointAsync x
Prelude.Generic)

-- |
-- Create a value of 'InvokeEndpointAsync' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'accept', 'invokeEndpointAsync_accept' - The desired MIME type of the inference in the response.
--
-- 'contentType', 'invokeEndpointAsync_contentType' - The MIME type of the input data in the request body.
--
-- 'customAttributes', 'invokeEndpointAsync_customAttributes' - 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
-- <https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6 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.
--
-- 'inferenceId', 'invokeEndpointAsync_inferenceId' - The identifier for the inference request. Amazon SageMaker will generate
-- an identifier for you if none is specified.
--
-- 'requestTTLSeconds', 'invokeEndpointAsync_requestTTLSeconds' - Maximum age in seconds a request can be in the queue before it is marked
-- as expired.
--
-- 'endpointName', 'invokeEndpointAsync_endpointName' - The name of the endpoint that you specified when you created the
-- endpoint using the
-- <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html CreateEndpoint>
-- API.
--
-- 'inputLocation', 'invokeEndpointAsync_inputLocation' - The Amazon S3 URI where the inference request payload is stored.
newInvokeEndpointAsync ::
  -- | 'endpointName'
  Prelude.Text ->
  -- | 'inputLocation'
  Prelude.Text ->
  InvokeEndpointAsync
newInvokeEndpointAsync :: Text -> Text -> InvokeEndpointAsync
newInvokeEndpointAsync Text
pEndpointName_ Text
pInputLocation_ =
  InvokeEndpointAsync'
    { $sel:accept:InvokeEndpointAsync' :: Maybe Text
accept = forall a. Maybe a
Prelude.Nothing,
      $sel:contentType:InvokeEndpointAsync' :: Maybe Text
contentType = forall a. Maybe a
Prelude.Nothing,
      $sel:customAttributes:InvokeEndpointAsync' :: Maybe (Sensitive Text)
customAttributes = forall a. Maybe a
Prelude.Nothing,
      $sel:inferenceId:InvokeEndpointAsync' :: Maybe Text
inferenceId = forall a. Maybe a
Prelude.Nothing,
      $sel:requestTTLSeconds:InvokeEndpointAsync' :: Maybe Natural
requestTTLSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:endpointName:InvokeEndpointAsync' :: Text
endpointName = Text
pEndpointName_,
      $sel:inputLocation:InvokeEndpointAsync' :: Text
inputLocation = Text
pInputLocation_
    }

-- | The desired MIME type of the inference in the response.
invokeEndpointAsync_accept :: Lens.Lens' InvokeEndpointAsync (Prelude.Maybe Prelude.Text)
invokeEndpointAsync_accept :: Lens' InvokeEndpointAsync (Maybe Text)
invokeEndpointAsync_accept = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsync' {Maybe Text
accept :: Maybe Text
$sel:accept:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
accept} -> Maybe Text
accept) (\s :: InvokeEndpointAsync
s@InvokeEndpointAsync' {} Maybe Text
a -> InvokeEndpointAsync
s {$sel:accept:InvokeEndpointAsync' :: Maybe Text
accept = Maybe Text
a} :: InvokeEndpointAsync)

-- | The MIME type of the input data in the request body.
invokeEndpointAsync_contentType :: Lens.Lens' InvokeEndpointAsync (Prelude.Maybe Prelude.Text)
invokeEndpointAsync_contentType :: Lens' InvokeEndpointAsync (Maybe Text)
invokeEndpointAsync_contentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsync' {Maybe Text
contentType :: Maybe Text
$sel:contentType:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
contentType} -> Maybe Text
contentType) (\s :: InvokeEndpointAsync
s@InvokeEndpointAsync' {} Maybe Text
a -> InvokeEndpointAsync
s {$sel:contentType:InvokeEndpointAsync' :: Maybe Text
contentType = Maybe Text
a} :: InvokeEndpointAsync)

-- | 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
-- <https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6 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.
invokeEndpointAsync_customAttributes :: Lens.Lens' InvokeEndpointAsync (Prelude.Maybe Prelude.Text)
invokeEndpointAsync_customAttributes :: Lens' InvokeEndpointAsync (Maybe Text)
invokeEndpointAsync_customAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsync' {Maybe (Sensitive Text)
customAttributes :: Maybe (Sensitive Text)
$sel:customAttributes:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe (Sensitive Text)
customAttributes} -> Maybe (Sensitive Text)
customAttributes) (\s :: InvokeEndpointAsync
s@InvokeEndpointAsync' {} Maybe (Sensitive Text)
a -> InvokeEndpointAsync
s {$sel:customAttributes:InvokeEndpointAsync' :: Maybe (Sensitive Text)
customAttributes = Maybe (Sensitive Text)
a} :: InvokeEndpointAsync) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The identifier for the inference request. Amazon SageMaker will generate
-- an identifier for you if none is specified.
invokeEndpointAsync_inferenceId :: Lens.Lens' InvokeEndpointAsync (Prelude.Maybe Prelude.Text)
invokeEndpointAsync_inferenceId :: Lens' InvokeEndpointAsync (Maybe Text)
invokeEndpointAsync_inferenceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsync' {Maybe Text
inferenceId :: Maybe Text
$sel:inferenceId:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
inferenceId} -> Maybe Text
inferenceId) (\s :: InvokeEndpointAsync
s@InvokeEndpointAsync' {} Maybe Text
a -> InvokeEndpointAsync
s {$sel:inferenceId:InvokeEndpointAsync' :: Maybe Text
inferenceId = Maybe Text
a} :: InvokeEndpointAsync)

-- | Maximum age in seconds a request can be in the queue before it is marked
-- as expired.
invokeEndpointAsync_requestTTLSeconds :: Lens.Lens' InvokeEndpointAsync (Prelude.Maybe Prelude.Natural)
invokeEndpointAsync_requestTTLSeconds :: Lens' InvokeEndpointAsync (Maybe Natural)
invokeEndpointAsync_requestTTLSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsync' {Maybe Natural
requestTTLSeconds :: Maybe Natural
$sel:requestTTLSeconds:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Natural
requestTTLSeconds} -> Maybe Natural
requestTTLSeconds) (\s :: InvokeEndpointAsync
s@InvokeEndpointAsync' {} Maybe Natural
a -> InvokeEndpointAsync
s {$sel:requestTTLSeconds:InvokeEndpointAsync' :: Maybe Natural
requestTTLSeconds = Maybe Natural
a} :: InvokeEndpointAsync)

-- | The name of the endpoint that you specified when you created the
-- endpoint using the
-- <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateEndpoint.html CreateEndpoint>
-- API.
invokeEndpointAsync_endpointName :: Lens.Lens' InvokeEndpointAsync Prelude.Text
invokeEndpointAsync_endpointName :: Lens' InvokeEndpointAsync Text
invokeEndpointAsync_endpointName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsync' {Text
endpointName :: Text
$sel:endpointName:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
endpointName} -> Text
endpointName) (\s :: InvokeEndpointAsync
s@InvokeEndpointAsync' {} Text
a -> InvokeEndpointAsync
s {$sel:endpointName:InvokeEndpointAsync' :: Text
endpointName = Text
a} :: InvokeEndpointAsync)

-- | The Amazon S3 URI where the inference request payload is stored.
invokeEndpointAsync_inputLocation :: Lens.Lens' InvokeEndpointAsync Prelude.Text
invokeEndpointAsync_inputLocation :: Lens' InvokeEndpointAsync Text
invokeEndpointAsync_inputLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsync' {Text
inputLocation :: Text
$sel:inputLocation:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
inputLocation} -> Text
inputLocation) (\s :: InvokeEndpointAsync
s@InvokeEndpointAsync' {} Text
a -> InvokeEndpointAsync
s {$sel:inputLocation:InvokeEndpointAsync' :: Text
inputLocation = Text
a} :: InvokeEndpointAsync)

instance Core.AWSRequest InvokeEndpointAsync where
  type
    AWSResponse InvokeEndpointAsync =
      InvokeEndpointAsyncResponse
  request :: (Service -> Service)
-> InvokeEndpointAsync -> Request InvokeEndpointAsync
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy InvokeEndpointAsync
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse InvokeEndpointAsync)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Text -> Int -> InvokeEndpointAsyncResponse
InvokeEndpointAsyncResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"InferenceId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (ResponseHeaders
h forall a.
FromText a =>
ResponseHeaders -> HeaderName -> Either String (Maybe a)
Data..#? HeaderName
"X-Amzn-SageMaker-OutputLocation")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable InvokeEndpointAsync where
  hashWithSalt :: Int -> InvokeEndpointAsync -> Int
hashWithSalt Int
_salt InvokeEndpointAsync' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
inputLocation :: Text
endpointName :: Text
requestTTLSeconds :: Maybe Natural
inferenceId :: Maybe Text
customAttributes :: Maybe (Sensitive Text)
contentType :: Maybe Text
accept :: Maybe Text
$sel:inputLocation:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
$sel:endpointName:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
$sel:requestTTLSeconds:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Natural
$sel:inferenceId:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
$sel:customAttributes:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe (Sensitive Text)
$sel:contentType:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
$sel:accept:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accept
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contentType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
customAttributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inferenceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
requestTTLSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
inputLocation

instance Prelude.NFData InvokeEndpointAsync where
  rnf :: InvokeEndpointAsync -> ()
rnf InvokeEndpointAsync' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
inputLocation :: Text
endpointName :: Text
requestTTLSeconds :: Maybe Natural
inferenceId :: Maybe Text
customAttributes :: Maybe (Sensitive Text)
contentType :: Maybe Text
accept :: Maybe Text
$sel:inputLocation:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
$sel:endpointName:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
$sel:requestTTLSeconds:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Natural
$sel:inferenceId:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
$sel:customAttributes:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe (Sensitive Text)
$sel:contentType:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
$sel:accept:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accept
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
customAttributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inferenceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
requestTTLSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
endpointName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
inputLocation

instance Data.ToHeaders InvokeEndpointAsync where
  toHeaders :: InvokeEndpointAsync -> ResponseHeaders
toHeaders InvokeEndpointAsync' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
inputLocation :: Text
endpointName :: Text
requestTTLSeconds :: Maybe Natural
inferenceId :: Maybe Text
customAttributes :: Maybe (Sensitive Text)
contentType :: Maybe Text
accept :: Maybe Text
$sel:inputLocation:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
$sel:endpointName:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
$sel:requestTTLSeconds:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Natural
$sel:inferenceId:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
$sel:customAttributes:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe (Sensitive Text)
$sel:contentType:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
$sel:accept:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"X-Amzn-SageMaker-Accept" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
accept,
        HeaderName
"X-Amzn-SageMaker-Content-Type" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
contentType,
        HeaderName
"X-Amzn-SageMaker-Custom-Attributes"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe (Sensitive Text)
customAttributes,
        HeaderName
"X-Amzn-SageMaker-Inference-Id" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
inferenceId,
        HeaderName
"X-Amzn-SageMaker-RequestTTLSeconds"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Natural
requestTTLSeconds,
        HeaderName
"X-Amzn-SageMaker-InputLocation"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Text
inputLocation,
        HeaderName
"Content-Type"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Data.ToJSON InvokeEndpointAsync where
  toJSON :: InvokeEndpointAsync -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance Data.ToPath InvokeEndpointAsync where
  toPath :: InvokeEndpointAsync -> ByteString
toPath InvokeEndpointAsync' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
inputLocation :: Text
endpointName :: Text
requestTTLSeconds :: Maybe Natural
inferenceId :: Maybe Text
customAttributes :: Maybe (Sensitive Text)
contentType :: Maybe Text
accept :: Maybe Text
$sel:inputLocation:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
$sel:endpointName:InvokeEndpointAsync' :: InvokeEndpointAsync -> Text
$sel:requestTTLSeconds:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Natural
$sel:inferenceId:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
$sel:customAttributes:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe (Sensitive Text)
$sel:contentType:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
$sel:accept:InvokeEndpointAsync' :: InvokeEndpointAsync -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/endpoints/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
endpointName,
        ByteString
"/async-invocations"
      ]

instance Data.ToQuery InvokeEndpointAsync where
  toQuery :: InvokeEndpointAsync -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newInvokeEndpointAsyncResponse' smart constructor.
data InvokeEndpointAsyncResponse = InvokeEndpointAsyncResponse'
  { -- | 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.
    InvokeEndpointAsyncResponse -> Maybe Text
inferenceId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 URI where the inference response payload is stored.
    InvokeEndpointAsyncResponse -> Maybe Text
outputLocation :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    InvokeEndpointAsyncResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (InvokeEndpointAsyncResponse -> InvokeEndpointAsyncResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InvokeEndpointAsyncResponse -> InvokeEndpointAsyncResponse -> Bool
$c/= :: InvokeEndpointAsyncResponse -> InvokeEndpointAsyncResponse -> Bool
== :: InvokeEndpointAsyncResponse -> InvokeEndpointAsyncResponse -> Bool
$c== :: InvokeEndpointAsyncResponse -> InvokeEndpointAsyncResponse -> Bool
Prelude.Eq, ReadPrec [InvokeEndpointAsyncResponse]
ReadPrec InvokeEndpointAsyncResponse
Int -> ReadS InvokeEndpointAsyncResponse
ReadS [InvokeEndpointAsyncResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InvokeEndpointAsyncResponse]
$creadListPrec :: ReadPrec [InvokeEndpointAsyncResponse]
readPrec :: ReadPrec InvokeEndpointAsyncResponse
$creadPrec :: ReadPrec InvokeEndpointAsyncResponse
readList :: ReadS [InvokeEndpointAsyncResponse]
$creadList :: ReadS [InvokeEndpointAsyncResponse]
readsPrec :: Int -> ReadS InvokeEndpointAsyncResponse
$creadsPrec :: Int -> ReadS InvokeEndpointAsyncResponse
Prelude.Read, Int -> InvokeEndpointAsyncResponse -> ShowS
[InvokeEndpointAsyncResponse] -> ShowS
InvokeEndpointAsyncResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InvokeEndpointAsyncResponse] -> ShowS
$cshowList :: [InvokeEndpointAsyncResponse] -> ShowS
show :: InvokeEndpointAsyncResponse -> String
$cshow :: InvokeEndpointAsyncResponse -> String
showsPrec :: Int -> InvokeEndpointAsyncResponse -> ShowS
$cshowsPrec :: Int -> InvokeEndpointAsyncResponse -> ShowS
Prelude.Show, forall x.
Rep InvokeEndpointAsyncResponse x -> InvokeEndpointAsyncResponse
forall x.
InvokeEndpointAsyncResponse -> Rep InvokeEndpointAsyncResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InvokeEndpointAsyncResponse x -> InvokeEndpointAsyncResponse
$cfrom :: forall x.
InvokeEndpointAsyncResponse -> Rep InvokeEndpointAsyncResponse x
Prelude.Generic)

-- |
-- Create a value of 'InvokeEndpointAsyncResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'inferenceId', 'invokeEndpointAsyncResponse_inferenceId' - 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.
--
-- 'outputLocation', 'invokeEndpointAsyncResponse_outputLocation' - The Amazon S3 URI where the inference response payload is stored.
--
-- 'httpStatus', 'invokeEndpointAsyncResponse_httpStatus' - The response's http status code.
newInvokeEndpointAsyncResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  InvokeEndpointAsyncResponse
newInvokeEndpointAsyncResponse :: Int -> InvokeEndpointAsyncResponse
newInvokeEndpointAsyncResponse Int
pHttpStatus_ =
  InvokeEndpointAsyncResponse'
    { $sel:inferenceId:InvokeEndpointAsyncResponse' :: Maybe Text
inferenceId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:outputLocation:InvokeEndpointAsyncResponse' :: Maybe Text
outputLocation = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:InvokeEndpointAsyncResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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.
invokeEndpointAsyncResponse_inferenceId :: Lens.Lens' InvokeEndpointAsyncResponse (Prelude.Maybe Prelude.Text)
invokeEndpointAsyncResponse_inferenceId :: Lens' InvokeEndpointAsyncResponse (Maybe Text)
invokeEndpointAsyncResponse_inferenceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsyncResponse' {Maybe Text
inferenceId :: Maybe Text
$sel:inferenceId:InvokeEndpointAsyncResponse' :: InvokeEndpointAsyncResponse -> Maybe Text
inferenceId} -> Maybe Text
inferenceId) (\s :: InvokeEndpointAsyncResponse
s@InvokeEndpointAsyncResponse' {} Maybe Text
a -> InvokeEndpointAsyncResponse
s {$sel:inferenceId:InvokeEndpointAsyncResponse' :: Maybe Text
inferenceId = Maybe Text
a} :: InvokeEndpointAsyncResponse)

-- | The Amazon S3 URI where the inference response payload is stored.
invokeEndpointAsyncResponse_outputLocation :: Lens.Lens' InvokeEndpointAsyncResponse (Prelude.Maybe Prelude.Text)
invokeEndpointAsyncResponse_outputLocation :: Lens' InvokeEndpointAsyncResponse (Maybe Text)
invokeEndpointAsyncResponse_outputLocation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsyncResponse' {Maybe Text
outputLocation :: Maybe Text
$sel:outputLocation:InvokeEndpointAsyncResponse' :: InvokeEndpointAsyncResponse -> Maybe Text
outputLocation} -> Maybe Text
outputLocation) (\s :: InvokeEndpointAsyncResponse
s@InvokeEndpointAsyncResponse' {} Maybe Text
a -> InvokeEndpointAsyncResponse
s {$sel:outputLocation:InvokeEndpointAsyncResponse' :: Maybe Text
outputLocation = Maybe Text
a} :: InvokeEndpointAsyncResponse)

-- | The response's http status code.
invokeEndpointAsyncResponse_httpStatus :: Lens.Lens' InvokeEndpointAsyncResponse Prelude.Int
invokeEndpointAsyncResponse_httpStatus :: Lens' InvokeEndpointAsyncResponse Int
invokeEndpointAsyncResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InvokeEndpointAsyncResponse' {Int
httpStatus :: Int
$sel:httpStatus:InvokeEndpointAsyncResponse' :: InvokeEndpointAsyncResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: InvokeEndpointAsyncResponse
s@InvokeEndpointAsyncResponse' {} Int
a -> InvokeEndpointAsyncResponse
s {$sel:httpStatus:InvokeEndpointAsyncResponse' :: Int
httpStatus = Int
a} :: InvokeEndpointAsyncResponse)

instance Prelude.NFData InvokeEndpointAsyncResponse where
  rnf :: InvokeEndpointAsyncResponse -> ()
rnf InvokeEndpointAsyncResponse' {Int
Maybe Text
httpStatus :: Int
outputLocation :: Maybe Text
inferenceId :: Maybe Text
$sel:httpStatus:InvokeEndpointAsyncResponse' :: InvokeEndpointAsyncResponse -> Int
$sel:outputLocation:InvokeEndpointAsyncResponse' :: InvokeEndpointAsyncResponse -> Maybe Text
$sel:inferenceId:InvokeEndpointAsyncResponse' :: InvokeEndpointAsyncResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inferenceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outputLocation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus