{-# 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.CreateModel
-- 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 a model in Amazon SageMaker. In the request, you name the model
-- and describe a primary container. For the primary container, you specify
-- the Docker image that contains inference code, artifacts (from prior
-- training), and a custom environment map that the inference code uses
-- when you deploy the model for predictions.
--
-- Use this API to create a model if you want to use Amazon SageMaker
-- hosting services or run a batch transform job.
--
-- To host your model, you create an endpoint configuration with the
-- @CreateEndpointConfig@ API, and then create an endpoint with the
-- @CreateEndpoint@ API. Amazon SageMaker then deploys all of the
-- containers that you defined for the model in the hosting environment.
--
-- For an example that calls this method when deploying a model to Amazon
-- SageMaker hosting services, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/ex1-deploy-model.html#ex1-deploy-model-boto Deploy the Model to Amazon SageMaker Hosting Services (Amazon Web Services SDK for Python (Boto 3)).>
--
-- To run a batch transform using your model, you start a job with the
-- @CreateTransformJob@ API. Amazon SageMaker uses your model and your
-- dataset to get inferences which are then saved to a specified S3
-- location.
--
-- In the @CreateModel@ request, you must define a container with the
-- @PrimaryContainer@ parameter.
--
-- In the request, you also provide an IAM role that Amazon SageMaker can
-- assume to access model artifacts and docker image for deployment on ML
-- compute hosting instances or for batch transform jobs. In addition, you
-- also use the IAM role to manage permissions the inference code needs.
-- For example, if the inference code access any other Amazon Web Services
-- resources, you grant necessary permissions via this role.
module Amazonka.SageMaker.CreateModel
  ( -- * Creating a Request
    CreateModel (..),
    newCreateModel,

    -- * Request Lenses
    createModel_primaryContainer,
    createModel_enableNetworkIsolation,
    createModel_containers,
    createModel_vpcConfig,
    createModel_inferenceExecutionConfig,
    createModel_tags,
    createModel_modelName,
    createModel_executionRoleArn,

    -- * Destructuring the Response
    CreateModelResponse (..),
    newCreateModelResponse,

    -- * Response Lenses
    createModelResponse_httpStatus,
    createModelResponse_modelArn,
  )
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:/ 'newCreateModel' smart constructor.
data CreateModel = CreateModel'
  { -- | The location of the primary docker image containing inference code,
    -- associated artifacts, and custom environment map that the inference code
    -- uses when the model is deployed for predictions.
    CreateModel -> Maybe ContainerDefinition
primaryContainer :: Prelude.Maybe ContainerDefinition,
    -- | Isolates the model container. No inbound or outbound network calls can
    -- be made to or from the model container.
    CreateModel -> Maybe Bool
enableNetworkIsolation :: Prelude.Maybe Prelude.Bool,
    -- | Specifies the containers in the inference pipeline.
    CreateModel -> Maybe [ContainerDefinition]
containers :: Prelude.Maybe [ContainerDefinition],
    -- | A VpcConfig object that specifies the VPC that you want your model to
    -- connect to. Control access to and from your model container by
    -- configuring the VPC. @VpcConfig@ is used in hosting services and in
    -- batch transform. For more information, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/host-vpc.html Protect Endpoints by Using an Amazon Virtual Private Cloud>
    -- and
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/batch-vpc.html Protect Data in Batch Transform Jobs by Using an Amazon Virtual Private Cloud>.
    CreateModel -> Maybe VpcConfig
vpcConfig :: Prelude.Maybe VpcConfig,
    -- | Specifies details of how containers in a multi-container endpoint are
    -- called.
    CreateModel -> Maybe InferenceExecutionConfig
inferenceExecutionConfig :: Prelude.Maybe InferenceExecutionConfig,
    -- | 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>.
    CreateModel -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the new model.
    CreateModel -> Text
modelName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker can
    -- assume to access model artifacts and docker image for deployment on ML
    -- compute instances or for batch transform jobs. Deploying on ML compute
    -- instances is part of model hosting. For more information, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html Amazon SageMaker Roles>.
    --
    -- To be able to pass this role to Amazon SageMaker, the caller of this API
    -- must have the @iam:PassRole@ permission.
    CreateModel -> Text
executionRoleArn :: Prelude.Text
  }
  deriving (CreateModel -> CreateModel -> Bool
(CreateModel -> CreateModel -> Bool)
-> (CreateModel -> CreateModel -> Bool) -> Eq CreateModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateModel -> CreateModel -> Bool
$c/= :: CreateModel -> CreateModel -> Bool
== :: CreateModel -> CreateModel -> Bool
$c== :: CreateModel -> CreateModel -> Bool
Prelude.Eq, ReadPrec [CreateModel]
ReadPrec CreateModel
Int -> ReadS CreateModel
ReadS [CreateModel]
(Int -> ReadS CreateModel)
-> ReadS [CreateModel]
-> ReadPrec CreateModel
-> ReadPrec [CreateModel]
-> Read CreateModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateModel]
$creadListPrec :: ReadPrec [CreateModel]
readPrec :: ReadPrec CreateModel
$creadPrec :: ReadPrec CreateModel
readList :: ReadS [CreateModel]
$creadList :: ReadS [CreateModel]
readsPrec :: Int -> ReadS CreateModel
$creadsPrec :: Int -> ReadS CreateModel
Prelude.Read, Int -> CreateModel -> ShowS
[CreateModel] -> ShowS
CreateModel -> String
(Int -> CreateModel -> ShowS)
-> (CreateModel -> String)
-> ([CreateModel] -> ShowS)
-> Show CreateModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateModel] -> ShowS
$cshowList :: [CreateModel] -> ShowS
show :: CreateModel -> String
$cshow :: CreateModel -> String
showsPrec :: Int -> CreateModel -> ShowS
$cshowsPrec :: Int -> CreateModel -> ShowS
Prelude.Show, (forall x. CreateModel -> Rep CreateModel x)
-> (forall x. Rep CreateModel x -> CreateModel)
-> Generic CreateModel
forall x. Rep CreateModel x -> CreateModel
forall x. CreateModel -> Rep CreateModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateModel x -> CreateModel
$cfrom :: forall x. CreateModel -> Rep CreateModel x
Prelude.Generic)

-- |
-- Create a value of 'CreateModel' 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:
--
-- 'primaryContainer', 'createModel_primaryContainer' - The location of the primary docker image containing inference code,
-- associated artifacts, and custom environment map that the inference code
-- uses when the model is deployed for predictions.
--
-- 'enableNetworkIsolation', 'createModel_enableNetworkIsolation' - Isolates the model container. No inbound or outbound network calls can
-- be made to or from the model container.
--
-- 'containers', 'createModel_containers' - Specifies the containers in the inference pipeline.
--
-- 'vpcConfig', 'createModel_vpcConfig' - A VpcConfig object that specifies the VPC that you want your model to
-- connect to. Control access to and from your model container by
-- configuring the VPC. @VpcConfig@ is used in hosting services and in
-- batch transform. For more information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/host-vpc.html Protect Endpoints by Using an Amazon Virtual Private Cloud>
-- and
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/batch-vpc.html Protect Data in Batch Transform Jobs by Using an Amazon Virtual Private Cloud>.
--
-- 'inferenceExecutionConfig', 'createModel_inferenceExecutionConfig' - Specifies details of how containers in a multi-container endpoint are
-- called.
--
-- 'tags', 'createModel_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>.
--
-- 'modelName', 'createModel_modelName' - The name of the new model.
--
-- 'executionRoleArn', 'createModel_executionRoleArn' - The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker can
-- assume to access model artifacts and docker image for deployment on ML
-- compute instances or for batch transform jobs. Deploying on ML compute
-- instances is part of model hosting. For more information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html Amazon SageMaker Roles>.
--
-- To be able to pass this role to Amazon SageMaker, the caller of this API
-- must have the @iam:PassRole@ permission.
newCreateModel ::
  -- | 'modelName'
  Prelude.Text ->
  -- | 'executionRoleArn'
  Prelude.Text ->
  CreateModel
newCreateModel :: Text -> Text -> CreateModel
newCreateModel Text
pModelName_ Text
pExecutionRoleArn_ =
  CreateModel' :: Maybe ContainerDefinition
-> Maybe Bool
-> Maybe [ContainerDefinition]
-> Maybe VpcConfig
-> Maybe InferenceExecutionConfig
-> Maybe [Tag]
-> Text
-> Text
-> CreateModel
CreateModel'
    { $sel:primaryContainer:CreateModel' :: Maybe ContainerDefinition
primaryContainer = Maybe ContainerDefinition
forall a. Maybe a
Prelude.Nothing,
      $sel:enableNetworkIsolation:CreateModel' :: Maybe Bool
enableNetworkIsolation = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:containers:CreateModel' :: Maybe [ContainerDefinition]
containers = Maybe [ContainerDefinition]
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfig:CreateModel' :: Maybe VpcConfig
vpcConfig = Maybe VpcConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:inferenceExecutionConfig:CreateModel' :: Maybe InferenceExecutionConfig
inferenceExecutionConfig = Maybe InferenceExecutionConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateModel' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:modelName:CreateModel' :: Text
modelName = Text
pModelName_,
      $sel:executionRoleArn:CreateModel' :: Text
executionRoleArn = Text
pExecutionRoleArn_
    }

-- | The location of the primary docker image containing inference code,
-- associated artifacts, and custom environment map that the inference code
-- uses when the model is deployed for predictions.
createModel_primaryContainer :: Lens.Lens' CreateModel (Prelude.Maybe ContainerDefinition)
createModel_primaryContainer :: (Maybe ContainerDefinition -> f (Maybe ContainerDefinition))
-> CreateModel -> f CreateModel
createModel_primaryContainer = (CreateModel -> Maybe ContainerDefinition)
-> (CreateModel -> Maybe ContainerDefinition -> CreateModel)
-> Lens
     CreateModel
     CreateModel
     (Maybe ContainerDefinition)
     (Maybe ContainerDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModel' {Maybe ContainerDefinition
primaryContainer :: Maybe ContainerDefinition
$sel:primaryContainer:CreateModel' :: CreateModel -> Maybe ContainerDefinition
primaryContainer} -> Maybe ContainerDefinition
primaryContainer) (\s :: CreateModel
s@CreateModel' {} Maybe ContainerDefinition
a -> CreateModel
s {$sel:primaryContainer:CreateModel' :: Maybe ContainerDefinition
primaryContainer = Maybe ContainerDefinition
a} :: CreateModel)

-- | Isolates the model container. No inbound or outbound network calls can
-- be made to or from the model container.
createModel_enableNetworkIsolation :: Lens.Lens' CreateModel (Prelude.Maybe Prelude.Bool)
createModel_enableNetworkIsolation :: (Maybe Bool -> f (Maybe Bool)) -> CreateModel -> f CreateModel
createModel_enableNetworkIsolation = (CreateModel -> Maybe Bool)
-> (CreateModel -> Maybe Bool -> CreateModel)
-> Lens CreateModel CreateModel (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModel' {Maybe Bool
enableNetworkIsolation :: Maybe Bool
$sel:enableNetworkIsolation:CreateModel' :: CreateModel -> Maybe Bool
enableNetworkIsolation} -> Maybe Bool
enableNetworkIsolation) (\s :: CreateModel
s@CreateModel' {} Maybe Bool
a -> CreateModel
s {$sel:enableNetworkIsolation:CreateModel' :: Maybe Bool
enableNetworkIsolation = Maybe Bool
a} :: CreateModel)

-- | Specifies the containers in the inference pipeline.
createModel_containers :: Lens.Lens' CreateModel (Prelude.Maybe [ContainerDefinition])
createModel_containers :: (Maybe [ContainerDefinition] -> f (Maybe [ContainerDefinition]))
-> CreateModel -> f CreateModel
createModel_containers = (CreateModel -> Maybe [ContainerDefinition])
-> (CreateModel -> Maybe [ContainerDefinition] -> CreateModel)
-> Lens
     CreateModel
     CreateModel
     (Maybe [ContainerDefinition])
     (Maybe [ContainerDefinition])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModel' {Maybe [ContainerDefinition]
containers :: Maybe [ContainerDefinition]
$sel:containers:CreateModel' :: CreateModel -> Maybe [ContainerDefinition]
containers} -> Maybe [ContainerDefinition]
containers) (\s :: CreateModel
s@CreateModel' {} Maybe [ContainerDefinition]
a -> CreateModel
s {$sel:containers:CreateModel' :: Maybe [ContainerDefinition]
containers = Maybe [ContainerDefinition]
a} :: CreateModel) ((Maybe [ContainerDefinition] -> f (Maybe [ContainerDefinition]))
 -> CreateModel -> f CreateModel)
-> ((Maybe [ContainerDefinition]
     -> f (Maybe [ContainerDefinition]))
    -> Maybe [ContainerDefinition] -> f (Maybe [ContainerDefinition]))
-> (Maybe [ContainerDefinition] -> f (Maybe [ContainerDefinition]))
-> CreateModel
-> f CreateModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ContainerDefinition]
  [ContainerDefinition]
  [ContainerDefinition]
  [ContainerDefinition]
-> Iso
     (Maybe [ContainerDefinition])
     (Maybe [ContainerDefinition])
     (Maybe [ContainerDefinition])
     (Maybe [ContainerDefinition])
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
  [ContainerDefinition]
  [ContainerDefinition]
  [ContainerDefinition]
  [ContainerDefinition]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A VpcConfig object that specifies the VPC that you want your model to
-- connect to. Control access to and from your model container by
-- configuring the VPC. @VpcConfig@ is used in hosting services and in
-- batch transform. For more information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/host-vpc.html Protect Endpoints by Using an Amazon Virtual Private Cloud>
-- and
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/batch-vpc.html Protect Data in Batch Transform Jobs by Using an Amazon Virtual Private Cloud>.
createModel_vpcConfig :: Lens.Lens' CreateModel (Prelude.Maybe VpcConfig)
createModel_vpcConfig :: (Maybe VpcConfig -> f (Maybe VpcConfig))
-> CreateModel -> f CreateModel
createModel_vpcConfig = (CreateModel -> Maybe VpcConfig)
-> (CreateModel -> Maybe VpcConfig -> CreateModel)
-> Lens CreateModel CreateModel (Maybe VpcConfig) (Maybe VpcConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModel' {Maybe VpcConfig
vpcConfig :: Maybe VpcConfig
$sel:vpcConfig:CreateModel' :: CreateModel -> Maybe VpcConfig
vpcConfig} -> Maybe VpcConfig
vpcConfig) (\s :: CreateModel
s@CreateModel' {} Maybe VpcConfig
a -> CreateModel
s {$sel:vpcConfig:CreateModel' :: Maybe VpcConfig
vpcConfig = Maybe VpcConfig
a} :: CreateModel)

-- | Specifies details of how containers in a multi-container endpoint are
-- called.
createModel_inferenceExecutionConfig :: Lens.Lens' CreateModel (Prelude.Maybe InferenceExecutionConfig)
createModel_inferenceExecutionConfig :: (Maybe InferenceExecutionConfig
 -> f (Maybe InferenceExecutionConfig))
-> CreateModel -> f CreateModel
createModel_inferenceExecutionConfig = (CreateModel -> Maybe InferenceExecutionConfig)
-> (CreateModel -> Maybe InferenceExecutionConfig -> CreateModel)
-> Lens
     CreateModel
     CreateModel
     (Maybe InferenceExecutionConfig)
     (Maybe InferenceExecutionConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModel' {Maybe InferenceExecutionConfig
inferenceExecutionConfig :: Maybe InferenceExecutionConfig
$sel:inferenceExecutionConfig:CreateModel' :: CreateModel -> Maybe InferenceExecutionConfig
inferenceExecutionConfig} -> Maybe InferenceExecutionConfig
inferenceExecutionConfig) (\s :: CreateModel
s@CreateModel' {} Maybe InferenceExecutionConfig
a -> CreateModel
s {$sel:inferenceExecutionConfig:CreateModel' :: Maybe InferenceExecutionConfig
inferenceExecutionConfig = Maybe InferenceExecutionConfig
a} :: CreateModel)

-- | 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>.
createModel_tags :: Lens.Lens' CreateModel (Prelude.Maybe [Tag])
createModel_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateModel -> f CreateModel
createModel_tags = (CreateModel -> Maybe [Tag])
-> (CreateModel -> Maybe [Tag] -> CreateModel)
-> Lens CreateModel CreateModel (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModel' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateModel' :: CreateModel -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateModel
s@CreateModel' {} Maybe [Tag]
a -> CreateModel
s {$sel:tags:CreateModel' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateModel) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateModel -> f CreateModel)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateModel
-> f CreateModel
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 new model.
createModel_modelName :: Lens.Lens' CreateModel Prelude.Text
createModel_modelName :: (Text -> f Text) -> CreateModel -> f CreateModel
createModel_modelName = (CreateModel -> Text)
-> (CreateModel -> Text -> CreateModel)
-> Lens CreateModel CreateModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModel' {Text
modelName :: Text
$sel:modelName:CreateModel' :: CreateModel -> Text
modelName} -> Text
modelName) (\s :: CreateModel
s@CreateModel' {} Text
a -> CreateModel
s {$sel:modelName:CreateModel' :: Text
modelName = Text
a} :: CreateModel)

-- | The Amazon Resource Name (ARN) of the IAM role that Amazon SageMaker can
-- assume to access model artifacts and docker image for deployment on ML
-- compute instances or for batch transform jobs. Deploying on ML compute
-- instances is part of model hosting. For more information, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html Amazon SageMaker Roles>.
--
-- To be able to pass this role to Amazon SageMaker, the caller of this API
-- must have the @iam:PassRole@ permission.
createModel_executionRoleArn :: Lens.Lens' CreateModel Prelude.Text
createModel_executionRoleArn :: (Text -> f Text) -> CreateModel -> f CreateModel
createModel_executionRoleArn = (CreateModel -> Text)
-> (CreateModel -> Text -> CreateModel)
-> Lens CreateModel CreateModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModel' {Text
executionRoleArn :: Text
$sel:executionRoleArn:CreateModel' :: CreateModel -> Text
executionRoleArn} -> Text
executionRoleArn) (\s :: CreateModel
s@CreateModel' {} Text
a -> CreateModel
s {$sel:executionRoleArn:CreateModel' :: Text
executionRoleArn = Text
a} :: CreateModel)

instance Core.AWSRequest CreateModel where
  type AWSResponse CreateModel = CreateModelResponse
  request :: CreateModel -> Request CreateModel
request = Service -> CreateModel -> Request CreateModel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateModel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateModel))
-> Logger
-> Service
-> Proxy CreateModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateModel)))
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 -> CreateModelResponse
CreateModelResponse'
            (Int -> Text -> CreateModelResponse)
-> Either String Int -> Either String (Text -> CreateModelResponse)
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 -> CreateModelResponse)
-> Either String Text -> Either String CreateModelResponse
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
"ModelArn")
      )

instance Prelude.Hashable CreateModel

instance Prelude.NFData CreateModel

instance Core.ToHeaders CreateModel where
  toHeaders :: CreateModel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateModel -> 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.CreateModel" :: 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 CreateModel where
  toJSON :: CreateModel -> Value
toJSON CreateModel' {Maybe Bool
Maybe [ContainerDefinition]
Maybe [Tag]
Maybe InferenceExecutionConfig
Maybe ContainerDefinition
Maybe VpcConfig
Text
executionRoleArn :: Text
modelName :: Text
tags :: Maybe [Tag]
inferenceExecutionConfig :: Maybe InferenceExecutionConfig
vpcConfig :: Maybe VpcConfig
containers :: Maybe [ContainerDefinition]
enableNetworkIsolation :: Maybe Bool
primaryContainer :: Maybe ContainerDefinition
$sel:executionRoleArn:CreateModel' :: CreateModel -> Text
$sel:modelName:CreateModel' :: CreateModel -> Text
$sel:tags:CreateModel' :: CreateModel -> Maybe [Tag]
$sel:inferenceExecutionConfig:CreateModel' :: CreateModel -> Maybe InferenceExecutionConfig
$sel:vpcConfig:CreateModel' :: CreateModel -> Maybe VpcConfig
$sel:containers:CreateModel' :: CreateModel -> Maybe [ContainerDefinition]
$sel:enableNetworkIsolation:CreateModel' :: CreateModel -> Maybe Bool
$sel:primaryContainer:CreateModel' :: CreateModel -> Maybe ContainerDefinition
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PrimaryContainer" Text -> ContainerDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ContainerDefinition -> Pair)
-> Maybe ContainerDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContainerDefinition
primaryContainer,
            (Text
"EnableNetworkIsolation" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableNetworkIsolation,
            (Text
"Containers" Text -> [ContainerDefinition] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ContainerDefinition] -> Pair)
-> Maybe [ContainerDefinition] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ContainerDefinition]
containers,
            (Text
"VpcConfig" Text -> VpcConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VpcConfig -> Pair) -> Maybe VpcConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VpcConfig
vpcConfig,
            (Text
"InferenceExecutionConfig" Text -> InferenceExecutionConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InferenceExecutionConfig -> Pair)
-> Maybe InferenceExecutionConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InferenceExecutionConfig
inferenceExecutionConfig,
            (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
"ModelName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
modelName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ExecutionRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
executionRoleArn)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateModelResponse' 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', 'createModelResponse_httpStatus' - The response's http status code.
--
-- 'modelArn', 'createModelResponse_modelArn' - The ARN of the model created in Amazon SageMaker.
newCreateModelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'modelArn'
  Prelude.Text ->
  CreateModelResponse
newCreateModelResponse :: Int -> Text -> CreateModelResponse
newCreateModelResponse Int
pHttpStatus_ Text
pModelArn_ =
  CreateModelResponse' :: Int -> Text -> CreateModelResponse
CreateModelResponse'
    { $sel:httpStatus:CreateModelResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:modelArn:CreateModelResponse' :: Text
modelArn = Text
pModelArn_
    }

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

-- | The ARN of the model created in Amazon SageMaker.
createModelResponse_modelArn :: Lens.Lens' CreateModelResponse Prelude.Text
createModelResponse_modelArn :: (Text -> f Text) -> CreateModelResponse -> f CreateModelResponse
createModelResponse_modelArn = (CreateModelResponse -> Text)
-> (CreateModelResponse -> Text -> CreateModelResponse)
-> Lens CreateModelResponse CreateModelResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelResponse' {Text
modelArn :: Text
$sel:modelArn:CreateModelResponse' :: CreateModelResponse -> Text
modelArn} -> Text
modelArn) (\s :: CreateModelResponse
s@CreateModelResponse' {} Text
a -> CreateModelResponse
s {$sel:modelArn:CreateModelResponse' :: Text
modelArn = Text
a} :: CreateModelResponse)

instance Prelude.NFData CreateModelResponse