{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a model in 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 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. 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
-- SageMaker hosting services, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints-deployment.html#realtime-endpoints-deployment-create-model Create a Model (Amazon Web Services SDK for Python (Boto 3)).>
--
-- To run a batch transform using your model, you start a job with the
-- @CreateTransformJob@ API. SageMaker uses your model and your dataset to
-- get inferences which are then saved to a specified S3 location.
--
-- In the request, you also provide an IAM role that 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_containers,
    createModel_enableNetworkIsolation,
    createModel_inferenceExecutionConfig,
    createModel_primaryContainer,
    createModel_tags,
    createModel_vpcConfig,
    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.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.SageMaker.Types

-- | /See:/ 'newCreateModel' smart constructor.
data CreateModel = CreateModel'
  { -- | Specifies the containers in the inference pipeline.
    CreateModel -> Maybe [ContainerDefinition]
containers :: 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 details of how containers in a multi-container endpoint are
    -- called.
    CreateModel -> Maybe InferenceExecutionConfig
inferenceExecutionConfig :: Prelude.Maybe InferenceExecutionConfig,
    -- | 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,
    -- | 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],
    -- | 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,
    -- | The name of the new model.
    CreateModel -> Text
modelName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role that 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 SageMaker Roles>.
    --
    -- To be able to pass this role to SageMaker, the caller of this API must
    -- have the @iam:PassRole@ permission.
    CreateModel -> Text
executionRoleArn :: Prelude.Text
  }
  deriving (CreateModel -> CreateModel -> Bool
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]
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
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. 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:
--
-- 'containers', 'createModel_containers' - Specifies the containers in the inference pipeline.
--
-- 'enableNetworkIsolation', 'createModel_enableNetworkIsolation' - Isolates the model container. No inbound or outbound network calls can
-- be made to or from the model container.
--
-- 'inferenceExecutionConfig', 'createModel_inferenceExecutionConfig' - Specifies details of how containers in a multi-container endpoint are
-- called.
--
-- '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.
--
-- '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>.
--
-- '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>.
--
-- 'modelName', 'createModel_modelName' - The name of the new model.
--
-- 'executionRoleArn', 'createModel_executionRoleArn' - The Amazon Resource Name (ARN) of the IAM role that 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 SageMaker Roles>.
--
-- To be able to pass this role to 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'
    { $sel:containers:CreateModel' :: Maybe [ContainerDefinition]
containers = forall a. Maybe a
Prelude.Nothing,
      $sel:enableNetworkIsolation:CreateModel' :: Maybe Bool
enableNetworkIsolation = forall a. Maybe a
Prelude.Nothing,
      $sel:inferenceExecutionConfig:CreateModel' :: Maybe InferenceExecutionConfig
inferenceExecutionConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:primaryContainer:CreateModel' :: Maybe ContainerDefinition
primaryContainer = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateModel' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfig:CreateModel' :: Maybe VpcConfig
vpcConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:modelName:CreateModel' :: Text
modelName = Text
pModelName_,
      $sel:executionRoleArn:CreateModel' :: Text
executionRoleArn = Text
pExecutionRoleArn_
    }

-- | Specifies the containers in the inference pipeline.
createModel_containers :: Lens.Lens' CreateModel (Prelude.Maybe [ContainerDefinition])
createModel_containers :: Lens' CreateModel (Maybe [ContainerDefinition])
createModel_containers = 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) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' CreateModel (Maybe Bool)
createModel_enableNetworkIsolation = 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 details of how containers in a multi-container endpoint are
-- called.
createModel_inferenceExecutionConfig :: Lens.Lens' CreateModel (Prelude.Maybe InferenceExecutionConfig)
createModel_inferenceExecutionConfig :: Lens' CreateModel (Maybe InferenceExecutionConfig)
createModel_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)

-- | 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 :: Lens' CreateModel (Maybe ContainerDefinition)
createModel_primaryContainer = 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)

-- | 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 :: Lens' CreateModel (Maybe [Tag])
createModel_tags = 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) 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 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 :: Lens' CreateModel (Maybe VpcConfig)
createModel_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)

-- | The name of the new model.
createModel_modelName :: Lens.Lens' CreateModel Prelude.Text
createModel_modelName :: Lens' CreateModel Text
createModel_modelName = 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 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 SageMaker Roles>.
--
-- To be able to pass this role to SageMaker, the caller of this API must
-- have the @iam:PassRole@ permission.
createModel_executionRoleArn :: Lens.Lens' CreateModel Prelude.Text
createModel_executionRoleArn :: Lens' CreateModel Text
createModel_executionRoleArn = 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 :: (Service -> Service) -> CreateModel -> Request CreateModel
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 CreateModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateModel)))
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 ->
          Int -> Text -> CreateModelResponse
CreateModelResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"ModelArn")
      )

instance Prelude.Hashable CreateModel where
  hashWithSalt :: Int -> CreateModel -> Int
hashWithSalt Int
_salt CreateModel' {Maybe Bool
Maybe [ContainerDefinition]
Maybe [Tag]
Maybe InferenceExecutionConfig
Maybe ContainerDefinition
Maybe VpcConfig
Text
executionRoleArn :: Text
modelName :: Text
vpcConfig :: Maybe VpcConfig
tags :: Maybe [Tag]
primaryContainer :: Maybe ContainerDefinition
inferenceExecutionConfig :: Maybe InferenceExecutionConfig
enableNetworkIsolation :: Maybe Bool
containers :: Maybe [ContainerDefinition]
$sel:executionRoleArn:CreateModel' :: CreateModel -> Text
$sel:modelName:CreateModel' :: CreateModel -> Text
$sel:vpcConfig:CreateModel' :: CreateModel -> Maybe VpcConfig
$sel:tags:CreateModel' :: CreateModel -> Maybe [Tag]
$sel:primaryContainer:CreateModel' :: CreateModel -> Maybe ContainerDefinition
$sel:inferenceExecutionConfig:CreateModel' :: CreateModel -> Maybe InferenceExecutionConfig
$sel:enableNetworkIsolation:CreateModel' :: CreateModel -> Maybe Bool
$sel:containers:CreateModel' :: CreateModel -> Maybe [ContainerDefinition]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ContainerDefinition]
containers
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enableNetworkIsolation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InferenceExecutionConfig
inferenceExecutionConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContainerDefinition
primaryContainer
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcConfig
vpcConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
modelName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
executionRoleArn

instance Prelude.NFData CreateModel where
  rnf :: CreateModel -> ()
rnf CreateModel' {Maybe Bool
Maybe [ContainerDefinition]
Maybe [Tag]
Maybe InferenceExecutionConfig
Maybe ContainerDefinition
Maybe VpcConfig
Text
executionRoleArn :: Text
modelName :: Text
vpcConfig :: Maybe VpcConfig
tags :: Maybe [Tag]
primaryContainer :: Maybe ContainerDefinition
inferenceExecutionConfig :: Maybe InferenceExecutionConfig
enableNetworkIsolation :: Maybe Bool
containers :: Maybe [ContainerDefinition]
$sel:executionRoleArn:CreateModel' :: CreateModel -> Text
$sel:modelName:CreateModel' :: CreateModel -> Text
$sel:vpcConfig:CreateModel' :: CreateModel -> Maybe VpcConfig
$sel:tags:CreateModel' :: CreateModel -> Maybe [Tag]
$sel:primaryContainer:CreateModel' :: CreateModel -> Maybe ContainerDefinition
$sel:inferenceExecutionConfig:CreateModel' :: CreateModel -> Maybe InferenceExecutionConfig
$sel:enableNetworkIsolation:CreateModel' :: CreateModel -> Maybe Bool
$sel:containers:CreateModel' :: CreateModel -> Maybe [ContainerDefinition]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ContainerDefinition]
containers
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enableNetworkIsolation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InferenceExecutionConfig
inferenceExecutionConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ContainerDefinition
primaryContainer
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcConfig
vpcConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
modelName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
executionRoleArn

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

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

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

instance Data.ToQuery CreateModel where
  toQuery :: CreateModel -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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 SageMaker.
    CreateModelResponse -> Text
modelArn :: Prelude.Text
  }
  deriving (CreateModelResponse -> CreateModelResponse -> Bool
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]
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
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. 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 SageMaker.
newCreateModelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'modelArn'
  Prelude.Text ->
  CreateModelResponse
newCreateModelResponse :: Int -> Text -> CreateModelResponse
newCreateModelResponse Int
pHttpStatus_ Text
pModelArn_ =
  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 :: Lens' CreateModelResponse Int
createModelResponse_httpStatus = 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 SageMaker.
createModelResponse_modelArn :: Lens.Lens' CreateModelResponse Prelude.Text
createModelResponse_modelArn :: Lens' CreateModelResponse Text
createModelResponse_modelArn = 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 where
  rnf :: CreateModelResponse -> ()
rnf CreateModelResponse' {Int
Text
modelArn :: Text
httpStatus :: Int
$sel:modelArn:CreateModelResponse' :: CreateModelResponse -> Text
$sel:httpStatus:CreateModelResponse' :: CreateModelResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
modelArn