{-# 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.SageMaker.CreateEndpointConfig
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an endpoint configuration that Amazon SageMaker hosting services
-- uses to deploy models. In the configuration, you identify one or more
-- models, created using the @CreateModel@ API, to deploy and the resources
-- that you want Amazon SageMaker to provision. Then you call the
-- CreateEndpoint API.
--
-- Use this API if you want to use Amazon SageMaker hosting services to
-- deploy models into production.
--
-- In the request, you define a @ProductionVariant@, for each model that
-- you want to deploy. Each @ProductionVariant@ parameter also describes
-- the resources that you want Amazon SageMaker to provision. This includes
-- the number and type of ML compute instances to deploy.
--
-- If you are hosting multiple models, you also assign a @VariantWeight@ to
-- specify how much traffic you want to allocate to each model. For
-- example, suppose that you want to host two models, A and B, and you
-- assign traffic weight 2 for model A and 1 for model B. Amazon SageMaker
-- distributes two-thirds of the traffic to Model A, and one-third to model
-- B.
--
-- When you call CreateEndpoint, a load call is made to DynamoDB to verify
-- that your endpoint configuration exists. When you read data from a
-- DynamoDB table supporting
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html Eventually Consistent Reads>
-- , the response might not reflect the results of a recently completed
-- write operation. The response might include some stale data. If the
-- dependent entities are not yet in DynamoDB, this causes a validation
-- error. If you repeat your read request after a short time, the response
-- should return the latest data. So retry logic is recommended to handle
-- these possible issues. We also recommend that customers call
-- DescribeEndpointConfig before calling CreateEndpoint to minimize the
-- potential impact of a DynamoDB eventually consistent read.
module Amazonka.SageMaker.CreateEndpointConfig
  ( -- * Creating a Request
    CreateEndpointConfig (..),
    newCreateEndpointConfig,

    -- * Request Lenses
    createEndpointConfig_asyncInferenceConfig,
    createEndpointConfig_kmsKeyId,
    createEndpointConfig_dataCaptureConfig,
    createEndpointConfig_tags,
    createEndpointConfig_endpointConfigName,
    createEndpointConfig_productionVariants,

    -- * Destructuring the Response
    CreateEndpointConfigResponse (..),
    newCreateEndpointConfigResponse,

    -- * Response Lenses
    createEndpointConfigResponse_httpStatus,
    createEndpointConfigResponse_endpointConfigArn,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SageMaker.Types

-- | /See:/ 'newCreateEndpointConfig' smart constructor.
data CreateEndpointConfig = CreateEndpointConfig'
  { -- | Specifies configuration for how an endpoint performs asynchronous
    -- inference. This is a required field in order for your Endpoint to be
    -- invoked using
    -- <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html InvokeEndpointAsync>
    -- .
    CreateEndpointConfig -> Maybe AsyncInferenceConfig
asyncInferenceConfig :: Prelude.Maybe AsyncInferenceConfig,
    -- | The Amazon Resource Name (ARN) of a Amazon Web Services Key Management
    -- Service key that Amazon SageMaker uses to encrypt data on the storage
    -- volume attached to the ML compute instance that hosts the endpoint.
    --
    -- The KmsKeyId can be any of the following formats:
    --
    -- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- -   Key ARN:
    --     @arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
    --
    -- -   Alias name: @alias\/ExampleAlias@
    --
    -- -   Alias name ARN:
    --     @arn:aws:kms:us-west-2:111122223333:alias\/ExampleAlias@
    --
    -- The KMS key policy must grant permission to the IAM role that you
    -- specify in your @CreateEndpoint@, @UpdateEndpoint@ requests. For more
    -- information, refer to the Amazon Web Services Key Management Service
    -- section
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Using Key Policies in Amazon Web Services KMS>
    --
    -- Certain Nitro-based instances include local storage, dependent on the
    -- instance type. Local storage volumes are encrypted using a hardware
    -- module on the instance. You can\'t request a @KmsKeyId@ when using an
    -- instance type with local storage. If any of the models that you specify
    -- in the @ProductionVariants@ parameter use nitro-based instances with
    -- local storage, do not specify a value for the @KmsKeyId@ parameter. If
    -- you specify a value for @KmsKeyId@ when using any nitro-based instances
    -- with local storage, the call to @CreateEndpointConfig@ fails.
    --
    -- For a list of instance types that support local instance storage, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#instance-store-volumes Instance Store Volumes>.
    --
    -- For more information about local instance storage encryption, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ssd-instance-store.html SSD Instance Store Volumes>.
    CreateEndpointConfig -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    CreateEndpointConfig -> Maybe DataCaptureConfig
dataCaptureConfig :: Prelude.Maybe DataCaptureConfig,
    -- | An array of key-value pairs. You can use tags to categorize your Amazon
    -- Web Services resources in different ways, for example, by purpose,
    -- owner, or environment. For more information, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>.
    CreateEndpointConfig -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the endpoint configuration. You specify this name in a
    -- CreateEndpoint request.
    CreateEndpointConfig -> Text
endpointConfigName :: Prelude.Text,
    -- | An list of @ProductionVariant@ objects, one for each model that you want
    -- to host at this endpoint.
    CreateEndpointConfig -> NonEmpty ProductionVariant
productionVariants :: Prelude.NonEmpty ProductionVariant
  }
  deriving (CreateEndpointConfig -> CreateEndpointConfig -> Bool
(CreateEndpointConfig -> CreateEndpointConfig -> Bool)
-> (CreateEndpointConfig -> CreateEndpointConfig -> Bool)
-> Eq CreateEndpointConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEndpointConfig -> CreateEndpointConfig -> Bool
$c/= :: CreateEndpointConfig -> CreateEndpointConfig -> Bool
== :: CreateEndpointConfig -> CreateEndpointConfig -> Bool
$c== :: CreateEndpointConfig -> CreateEndpointConfig -> Bool
Prelude.Eq, ReadPrec [CreateEndpointConfig]
ReadPrec CreateEndpointConfig
Int -> ReadS CreateEndpointConfig
ReadS [CreateEndpointConfig]
(Int -> ReadS CreateEndpointConfig)
-> ReadS [CreateEndpointConfig]
-> ReadPrec CreateEndpointConfig
-> ReadPrec [CreateEndpointConfig]
-> Read CreateEndpointConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEndpointConfig]
$creadListPrec :: ReadPrec [CreateEndpointConfig]
readPrec :: ReadPrec CreateEndpointConfig
$creadPrec :: ReadPrec CreateEndpointConfig
readList :: ReadS [CreateEndpointConfig]
$creadList :: ReadS [CreateEndpointConfig]
readsPrec :: Int -> ReadS CreateEndpointConfig
$creadsPrec :: Int -> ReadS CreateEndpointConfig
Prelude.Read, Int -> CreateEndpointConfig -> ShowS
[CreateEndpointConfig] -> ShowS
CreateEndpointConfig -> String
(Int -> CreateEndpointConfig -> ShowS)
-> (CreateEndpointConfig -> String)
-> ([CreateEndpointConfig] -> ShowS)
-> Show CreateEndpointConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEndpointConfig] -> ShowS
$cshowList :: [CreateEndpointConfig] -> ShowS
show :: CreateEndpointConfig -> String
$cshow :: CreateEndpointConfig -> String
showsPrec :: Int -> CreateEndpointConfig -> ShowS
$cshowsPrec :: Int -> CreateEndpointConfig -> ShowS
Prelude.Show, (forall x. CreateEndpointConfig -> Rep CreateEndpointConfig x)
-> (forall x. Rep CreateEndpointConfig x -> CreateEndpointConfig)
-> Generic CreateEndpointConfig
forall x. Rep CreateEndpointConfig x -> CreateEndpointConfig
forall x. CreateEndpointConfig -> Rep CreateEndpointConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateEndpointConfig x -> CreateEndpointConfig
$cfrom :: forall x. CreateEndpointConfig -> Rep CreateEndpointConfig x
Prelude.Generic)

-- |
-- Create a value of 'CreateEndpointConfig' 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:
--
-- 'asyncInferenceConfig', 'createEndpointConfig_asyncInferenceConfig' - Specifies configuration for how an endpoint performs asynchronous
-- inference. This is a required field in order for your Endpoint to be
-- invoked using
-- <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html InvokeEndpointAsync>
-- .
--
-- 'kmsKeyId', 'createEndpointConfig_kmsKeyId' - The Amazon Resource Name (ARN) of a Amazon Web Services Key Management
-- Service key that Amazon SageMaker uses to encrypt data on the storage
-- volume attached to the ML compute instance that hosts the endpoint.
--
-- The KmsKeyId can be any of the following formats:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Alias name: @alias\/ExampleAlias@
--
-- -   Alias name ARN:
--     @arn:aws:kms:us-west-2:111122223333:alias\/ExampleAlias@
--
-- The KMS key policy must grant permission to the IAM role that you
-- specify in your @CreateEndpoint@, @UpdateEndpoint@ requests. For more
-- information, refer to the Amazon Web Services Key Management Service
-- section
-- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Using Key Policies in Amazon Web Services KMS>
--
-- Certain Nitro-based instances include local storage, dependent on the
-- instance type. Local storage volumes are encrypted using a hardware
-- module on the instance. You can\'t request a @KmsKeyId@ when using an
-- instance type with local storage. If any of the models that you specify
-- in the @ProductionVariants@ parameter use nitro-based instances with
-- local storage, do not specify a value for the @KmsKeyId@ parameter. If
-- you specify a value for @KmsKeyId@ when using any nitro-based instances
-- with local storage, the call to @CreateEndpointConfig@ fails.
--
-- For a list of instance types that support local instance storage, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#instance-store-volumes Instance Store Volumes>.
--
-- For more information about local instance storage encryption, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ssd-instance-store.html SSD Instance Store Volumes>.
--
-- 'dataCaptureConfig', 'createEndpointConfig_dataCaptureConfig' - Undocumented member.
--
-- 'tags', 'createEndpointConfig_tags' - An array of key-value pairs. You can use tags to categorize your Amazon
-- Web Services resources in different ways, for example, by purpose,
-- owner, or environment. For more information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>.
--
-- 'endpointConfigName', 'createEndpointConfig_endpointConfigName' - The name of the endpoint configuration. You specify this name in a
-- CreateEndpoint request.
--
-- 'productionVariants', 'createEndpointConfig_productionVariants' - An list of @ProductionVariant@ objects, one for each model that you want
-- to host at this endpoint.
newCreateEndpointConfig ::
  -- | 'endpointConfigName'
  Prelude.Text ->
  -- | 'productionVariants'
  Prelude.NonEmpty ProductionVariant ->
  CreateEndpointConfig
newCreateEndpointConfig :: Text -> NonEmpty ProductionVariant -> CreateEndpointConfig
newCreateEndpointConfig
  Text
pEndpointConfigName_
  NonEmpty ProductionVariant
pProductionVariants_ =
    CreateEndpointConfig' :: Maybe AsyncInferenceConfig
-> Maybe Text
-> Maybe DataCaptureConfig
-> Maybe [Tag]
-> Text
-> NonEmpty ProductionVariant
-> CreateEndpointConfig
CreateEndpointConfig'
      { $sel:asyncInferenceConfig:CreateEndpointConfig' :: Maybe AsyncInferenceConfig
asyncInferenceConfig =
          Maybe AsyncInferenceConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:kmsKeyId:CreateEndpointConfig' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:dataCaptureConfig:CreateEndpointConfig' :: Maybe DataCaptureConfig
dataCaptureConfig = Maybe DataCaptureConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateEndpointConfig' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:endpointConfigName:CreateEndpointConfig' :: Text
endpointConfigName = Text
pEndpointConfigName_,
        $sel:productionVariants:CreateEndpointConfig' :: NonEmpty ProductionVariant
productionVariants =
          Tagged
  (NonEmpty ProductionVariant)
  (Identity (NonEmpty ProductionVariant))
-> Tagged
     (NonEmpty ProductionVariant)
     (Identity (NonEmpty ProductionVariant))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty ProductionVariant)
   (Identity (NonEmpty ProductionVariant))
 -> Tagged
      (NonEmpty ProductionVariant)
      (Identity (NonEmpty ProductionVariant)))
-> NonEmpty ProductionVariant -> NonEmpty ProductionVariant
forall t b. AReview t b -> b -> t
Lens.# NonEmpty ProductionVariant
pProductionVariants_
      }

-- | Specifies configuration for how an endpoint performs asynchronous
-- inference. This is a required field in order for your Endpoint to be
-- invoked using
-- <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html InvokeEndpointAsync>
-- .
createEndpointConfig_asyncInferenceConfig :: Lens.Lens' CreateEndpointConfig (Prelude.Maybe AsyncInferenceConfig)
createEndpointConfig_asyncInferenceConfig :: (Maybe AsyncInferenceConfig -> f (Maybe AsyncInferenceConfig))
-> CreateEndpointConfig -> f CreateEndpointConfig
createEndpointConfig_asyncInferenceConfig = (CreateEndpointConfig -> Maybe AsyncInferenceConfig)
-> (CreateEndpointConfig
    -> Maybe AsyncInferenceConfig -> CreateEndpointConfig)
-> Lens
     CreateEndpointConfig
     CreateEndpointConfig
     (Maybe AsyncInferenceConfig)
     (Maybe AsyncInferenceConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointConfig' {Maybe AsyncInferenceConfig
asyncInferenceConfig :: Maybe AsyncInferenceConfig
$sel:asyncInferenceConfig:CreateEndpointConfig' :: CreateEndpointConfig -> Maybe AsyncInferenceConfig
asyncInferenceConfig} -> Maybe AsyncInferenceConfig
asyncInferenceConfig) (\s :: CreateEndpointConfig
s@CreateEndpointConfig' {} Maybe AsyncInferenceConfig
a -> CreateEndpointConfig
s {$sel:asyncInferenceConfig:CreateEndpointConfig' :: Maybe AsyncInferenceConfig
asyncInferenceConfig = Maybe AsyncInferenceConfig
a} :: CreateEndpointConfig)

-- | The Amazon Resource Name (ARN) of a Amazon Web Services Key Management
-- Service key that Amazon SageMaker uses to encrypt data on the storage
-- volume attached to the ML compute instance that hosts the endpoint.
--
-- The KmsKeyId can be any of the following formats:
--
-- -   Key ID: @1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Key ARN:
--     @arn:aws:kms:us-west-2:111122223333:key\/1234abcd-12ab-34cd-56ef-1234567890ab@
--
-- -   Alias name: @alias\/ExampleAlias@
--
-- -   Alias name ARN:
--     @arn:aws:kms:us-west-2:111122223333:alias\/ExampleAlias@
--
-- The KMS key policy must grant permission to the IAM role that you
-- specify in your @CreateEndpoint@, @UpdateEndpoint@ requests. For more
-- information, refer to the Amazon Web Services Key Management Service
-- section
-- <https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html Using Key Policies in Amazon Web Services KMS>
--
-- Certain Nitro-based instances include local storage, dependent on the
-- instance type. Local storage volumes are encrypted using a hardware
-- module on the instance. You can\'t request a @KmsKeyId@ when using an
-- instance type with local storage. If any of the models that you specify
-- in the @ProductionVariants@ parameter use nitro-based instances with
-- local storage, do not specify a value for the @KmsKeyId@ parameter. If
-- you specify a value for @KmsKeyId@ when using any nitro-based instances
-- with local storage, the call to @CreateEndpointConfig@ fails.
--
-- For a list of instance types that support local instance storage, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#instance-store-volumes Instance Store Volumes>.
--
-- For more information about local instance storage encryption, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ssd-instance-store.html SSD Instance Store Volumes>.
createEndpointConfig_kmsKeyId :: Lens.Lens' CreateEndpointConfig (Prelude.Maybe Prelude.Text)
createEndpointConfig_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> CreateEndpointConfig -> f CreateEndpointConfig
createEndpointConfig_kmsKeyId = (CreateEndpointConfig -> Maybe Text)
-> (CreateEndpointConfig -> Maybe Text -> CreateEndpointConfig)
-> Lens
     CreateEndpointConfig CreateEndpointConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointConfig' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateEndpointConfig' :: CreateEndpointConfig -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateEndpointConfig
s@CreateEndpointConfig' {} Maybe Text
a -> CreateEndpointConfig
s {$sel:kmsKeyId:CreateEndpointConfig' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateEndpointConfig)

-- | Undocumented member.
createEndpointConfig_dataCaptureConfig :: Lens.Lens' CreateEndpointConfig (Prelude.Maybe DataCaptureConfig)
createEndpointConfig_dataCaptureConfig :: (Maybe DataCaptureConfig -> f (Maybe DataCaptureConfig))
-> CreateEndpointConfig -> f CreateEndpointConfig
createEndpointConfig_dataCaptureConfig = (CreateEndpointConfig -> Maybe DataCaptureConfig)
-> (CreateEndpointConfig
    -> Maybe DataCaptureConfig -> CreateEndpointConfig)
-> Lens
     CreateEndpointConfig
     CreateEndpointConfig
     (Maybe DataCaptureConfig)
     (Maybe DataCaptureConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointConfig' {Maybe DataCaptureConfig
dataCaptureConfig :: Maybe DataCaptureConfig
$sel:dataCaptureConfig:CreateEndpointConfig' :: CreateEndpointConfig -> Maybe DataCaptureConfig
dataCaptureConfig} -> Maybe DataCaptureConfig
dataCaptureConfig) (\s :: CreateEndpointConfig
s@CreateEndpointConfig' {} Maybe DataCaptureConfig
a -> CreateEndpointConfig
s {$sel:dataCaptureConfig:CreateEndpointConfig' :: Maybe DataCaptureConfig
dataCaptureConfig = Maybe DataCaptureConfig
a} :: CreateEndpointConfig)

-- | An array of key-value pairs. You can use tags to categorize your Amazon
-- Web Services resources in different ways, for example, by purpose,
-- owner, or environment. For more information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html Tagging Amazon Web Services Resources>.
createEndpointConfig_tags :: Lens.Lens' CreateEndpointConfig (Prelude.Maybe [Tag])
createEndpointConfig_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateEndpointConfig -> f CreateEndpointConfig
createEndpointConfig_tags = (CreateEndpointConfig -> Maybe [Tag])
-> (CreateEndpointConfig -> Maybe [Tag] -> CreateEndpointConfig)
-> Lens
     CreateEndpointConfig
     CreateEndpointConfig
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointConfig' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateEndpointConfig' :: CreateEndpointConfig -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateEndpointConfig
s@CreateEndpointConfig' {} Maybe [Tag]
a -> CreateEndpointConfig
s {$sel:tags:CreateEndpointConfig' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateEndpointConfig) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateEndpointConfig -> f CreateEndpointConfig)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateEndpointConfig
-> f CreateEndpointConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the endpoint configuration. You specify this name in a
-- CreateEndpoint request.
createEndpointConfig_endpointConfigName :: Lens.Lens' CreateEndpointConfig Prelude.Text
createEndpointConfig_endpointConfigName :: (Text -> f Text) -> CreateEndpointConfig -> f CreateEndpointConfig
createEndpointConfig_endpointConfigName = (CreateEndpointConfig -> Text)
-> (CreateEndpointConfig -> Text -> CreateEndpointConfig)
-> Lens CreateEndpointConfig CreateEndpointConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointConfig' {Text
endpointConfigName :: Text
$sel:endpointConfigName:CreateEndpointConfig' :: CreateEndpointConfig -> Text
endpointConfigName} -> Text
endpointConfigName) (\s :: CreateEndpointConfig
s@CreateEndpointConfig' {} Text
a -> CreateEndpointConfig
s {$sel:endpointConfigName:CreateEndpointConfig' :: Text
endpointConfigName = Text
a} :: CreateEndpointConfig)

-- | An list of @ProductionVariant@ objects, one for each model that you want
-- to host at this endpoint.
createEndpointConfig_productionVariants :: Lens.Lens' CreateEndpointConfig (Prelude.NonEmpty ProductionVariant)
createEndpointConfig_productionVariants :: (NonEmpty ProductionVariant -> f (NonEmpty ProductionVariant))
-> CreateEndpointConfig -> f CreateEndpointConfig
createEndpointConfig_productionVariants = (CreateEndpointConfig -> NonEmpty ProductionVariant)
-> (CreateEndpointConfig
    -> NonEmpty ProductionVariant -> CreateEndpointConfig)
-> Lens
     CreateEndpointConfig
     CreateEndpointConfig
     (NonEmpty ProductionVariant)
     (NonEmpty ProductionVariant)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointConfig' {NonEmpty ProductionVariant
productionVariants :: NonEmpty ProductionVariant
$sel:productionVariants:CreateEndpointConfig' :: CreateEndpointConfig -> NonEmpty ProductionVariant
productionVariants} -> NonEmpty ProductionVariant
productionVariants) (\s :: CreateEndpointConfig
s@CreateEndpointConfig' {} NonEmpty ProductionVariant
a -> CreateEndpointConfig
s {$sel:productionVariants:CreateEndpointConfig' :: NonEmpty ProductionVariant
productionVariants = NonEmpty ProductionVariant
a} :: CreateEndpointConfig) ((NonEmpty ProductionVariant -> f (NonEmpty ProductionVariant))
 -> CreateEndpointConfig -> f CreateEndpointConfig)
-> ((NonEmpty ProductionVariant -> f (NonEmpty ProductionVariant))
    -> NonEmpty ProductionVariant -> f (NonEmpty ProductionVariant))
-> (NonEmpty ProductionVariant -> f (NonEmpty ProductionVariant))
-> CreateEndpointConfig
-> f CreateEndpointConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty ProductionVariant -> f (NonEmpty ProductionVariant))
-> NonEmpty ProductionVariant -> f (NonEmpty ProductionVariant)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateEndpointConfig where
  type
    AWSResponse CreateEndpointConfig =
      CreateEndpointConfigResponse
  request :: CreateEndpointConfig -> Request CreateEndpointConfig
request = Service -> CreateEndpointConfig -> Request CreateEndpointConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateEndpointConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateEndpointConfig)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateEndpointConfig))
-> Logger
-> Service
-> Proxy CreateEndpointConfig
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateEndpointConfig)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> CreateEndpointConfigResponse
CreateEndpointConfigResponse'
            (Int -> Text -> CreateEndpointConfigResponse)
-> Either String Int
-> Either String (Text -> CreateEndpointConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (Text -> CreateEndpointConfigResponse)
-> Either String Text -> Either String CreateEndpointConfigResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"EndpointConfigArn")
      )

instance Prelude.Hashable CreateEndpointConfig

instance Prelude.NFData CreateEndpointConfig

instance Core.ToHeaders CreateEndpointConfig where
  toHeaders :: CreateEndpointConfig -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateEndpointConfig -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"SageMaker.CreateEndpointConfig" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateEndpointConfig where
  toJSON :: CreateEndpointConfig -> Value
toJSON CreateEndpointConfig' {Maybe [Tag]
Maybe Text
Maybe AsyncInferenceConfig
Maybe DataCaptureConfig
NonEmpty ProductionVariant
Text
productionVariants :: NonEmpty ProductionVariant
endpointConfigName :: Text
tags :: Maybe [Tag]
dataCaptureConfig :: Maybe DataCaptureConfig
kmsKeyId :: Maybe Text
asyncInferenceConfig :: Maybe AsyncInferenceConfig
$sel:productionVariants:CreateEndpointConfig' :: CreateEndpointConfig -> NonEmpty ProductionVariant
$sel:endpointConfigName:CreateEndpointConfig' :: CreateEndpointConfig -> Text
$sel:tags:CreateEndpointConfig' :: CreateEndpointConfig -> Maybe [Tag]
$sel:dataCaptureConfig:CreateEndpointConfig' :: CreateEndpointConfig -> Maybe DataCaptureConfig
$sel:kmsKeyId:CreateEndpointConfig' :: CreateEndpointConfig -> Maybe Text
$sel:asyncInferenceConfig:CreateEndpointConfig' :: CreateEndpointConfig -> Maybe AsyncInferenceConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AsyncInferenceConfig" Text -> AsyncInferenceConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AsyncInferenceConfig -> Pair)
-> Maybe AsyncInferenceConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AsyncInferenceConfig
asyncInferenceConfig,
            (Text
"KmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Text
"DataCaptureConfig" Text -> DataCaptureConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DataCaptureConfig -> Pair)
-> Maybe DataCaptureConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataCaptureConfig
dataCaptureConfig,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"EndpointConfigName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
endpointConfigName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ProductionVariants" Text -> NonEmpty ProductionVariant -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty ProductionVariant
productionVariants)
          ]
      )

instance Core.ToPath CreateEndpointConfig where
  toPath :: CreateEndpointConfig -> ByteString
toPath = ByteString -> CreateEndpointConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newCreateEndpointConfigResponse' smart constructor.
data CreateEndpointConfigResponse = CreateEndpointConfigResponse'
  { -- | The response's http status code.
    CreateEndpointConfigResponse -> Int
httpStatus :: Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the endpoint configuration.
    CreateEndpointConfigResponse -> Text
endpointConfigArn :: Prelude.Text
  }
  deriving (CreateEndpointConfigResponse
-> CreateEndpointConfigResponse -> Bool
(CreateEndpointConfigResponse
 -> CreateEndpointConfigResponse -> Bool)
-> (CreateEndpointConfigResponse
    -> CreateEndpointConfigResponse -> Bool)
-> Eq CreateEndpointConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEndpointConfigResponse
-> CreateEndpointConfigResponse -> Bool
$c/= :: CreateEndpointConfigResponse
-> CreateEndpointConfigResponse -> Bool
== :: CreateEndpointConfigResponse
-> CreateEndpointConfigResponse -> Bool
$c== :: CreateEndpointConfigResponse
-> CreateEndpointConfigResponse -> Bool
Prelude.Eq, ReadPrec [CreateEndpointConfigResponse]
ReadPrec CreateEndpointConfigResponse
Int -> ReadS CreateEndpointConfigResponse
ReadS [CreateEndpointConfigResponse]
(Int -> ReadS CreateEndpointConfigResponse)
-> ReadS [CreateEndpointConfigResponse]
-> ReadPrec CreateEndpointConfigResponse
-> ReadPrec [CreateEndpointConfigResponse]
-> Read CreateEndpointConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEndpointConfigResponse]
$creadListPrec :: ReadPrec [CreateEndpointConfigResponse]
readPrec :: ReadPrec CreateEndpointConfigResponse
$creadPrec :: ReadPrec CreateEndpointConfigResponse
readList :: ReadS [CreateEndpointConfigResponse]
$creadList :: ReadS [CreateEndpointConfigResponse]
readsPrec :: Int -> ReadS CreateEndpointConfigResponse
$creadsPrec :: Int -> ReadS CreateEndpointConfigResponse
Prelude.Read, Int -> CreateEndpointConfigResponse -> ShowS
[CreateEndpointConfigResponse] -> ShowS
CreateEndpointConfigResponse -> String
(Int -> CreateEndpointConfigResponse -> ShowS)
-> (CreateEndpointConfigResponse -> String)
-> ([CreateEndpointConfigResponse] -> ShowS)
-> Show CreateEndpointConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEndpointConfigResponse] -> ShowS
$cshowList :: [CreateEndpointConfigResponse] -> ShowS
show :: CreateEndpointConfigResponse -> String
$cshow :: CreateEndpointConfigResponse -> String
showsPrec :: Int -> CreateEndpointConfigResponse -> ShowS
$cshowsPrec :: Int -> CreateEndpointConfigResponse -> ShowS
Prelude.Show, (forall x.
 CreateEndpointConfigResponse -> Rep CreateEndpointConfigResponse x)
-> (forall x.
    Rep CreateEndpointConfigResponse x -> CreateEndpointConfigResponse)
-> Generic CreateEndpointConfigResponse
forall x.
Rep CreateEndpointConfigResponse x -> CreateEndpointConfigResponse
forall x.
CreateEndpointConfigResponse -> Rep CreateEndpointConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEndpointConfigResponse x -> CreateEndpointConfigResponse
$cfrom :: forall x.
CreateEndpointConfigResponse -> Rep CreateEndpointConfigResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateEndpointConfigResponse' 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:
--
-- 'httpStatus', 'createEndpointConfigResponse_httpStatus' - The response's http status code.
--
-- 'endpointConfigArn', 'createEndpointConfigResponse_endpointConfigArn' - The Amazon Resource Name (ARN) of the endpoint configuration.
newCreateEndpointConfigResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'endpointConfigArn'
  Prelude.Text ->
  CreateEndpointConfigResponse
newCreateEndpointConfigResponse :: Int -> Text -> CreateEndpointConfigResponse
newCreateEndpointConfigResponse
  Int
pHttpStatus_
  Text
pEndpointConfigArn_ =
    CreateEndpointConfigResponse' :: Int -> Text -> CreateEndpointConfigResponse
CreateEndpointConfigResponse'
      { $sel:httpStatus:CreateEndpointConfigResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:endpointConfigArn:CreateEndpointConfigResponse' :: Text
endpointConfigArn = Text
pEndpointConfigArn_
      }

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

-- | The Amazon Resource Name (ARN) of the endpoint configuration.
createEndpointConfigResponse_endpointConfigArn :: Lens.Lens' CreateEndpointConfigResponse Prelude.Text
createEndpointConfigResponse_endpointConfigArn :: (Text -> f Text)
-> CreateEndpointConfigResponse -> f CreateEndpointConfigResponse
createEndpointConfigResponse_endpointConfigArn = (CreateEndpointConfigResponse -> Text)
-> (CreateEndpointConfigResponse
    -> Text -> CreateEndpointConfigResponse)
-> Lens
     CreateEndpointConfigResponse CreateEndpointConfigResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEndpointConfigResponse' {Text
endpointConfigArn :: Text
$sel:endpointConfigArn:CreateEndpointConfigResponse' :: CreateEndpointConfigResponse -> Text
endpointConfigArn} -> Text
endpointConfigArn) (\s :: CreateEndpointConfigResponse
s@CreateEndpointConfigResponse' {} Text
a -> CreateEndpointConfigResponse
s {$sel:endpointConfigArn:CreateEndpointConfigResponse' :: Text
endpointConfigArn = Text
a} :: CreateEndpointConfigResponse)

instance Prelude.NFData CreateEndpointConfigResponse