{-# 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.CreateAlgorithm
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Create a machine learning algorithm that you can use in SageMaker and
-- list in the Amazon Web Services Marketplace.
module Amazonka.SageMaker.CreateAlgorithm
  ( -- * Creating a Request
    CreateAlgorithm (..),
    newCreateAlgorithm,

    -- * Request Lenses
    createAlgorithm_algorithmDescription,
    createAlgorithm_certifyForMarketplace,
    createAlgorithm_inferenceSpecification,
    createAlgorithm_tags,
    createAlgorithm_validationSpecification,
    createAlgorithm_algorithmName,
    createAlgorithm_trainingSpecification,

    -- * Destructuring the Response
    CreateAlgorithmResponse (..),
    newCreateAlgorithmResponse,

    -- * Response Lenses
    createAlgorithmResponse_httpStatus,
    createAlgorithmResponse_algorithmArn,
  )
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:/ 'newCreateAlgorithm' smart constructor.
data CreateAlgorithm = CreateAlgorithm'
  { -- | A description of the algorithm.
    CreateAlgorithm -> Maybe Text
algorithmDescription :: Prelude.Maybe Prelude.Text,
    -- | Whether to certify the algorithm so that it can be listed in Amazon Web
    -- Services Marketplace.
    CreateAlgorithm -> Maybe Bool
certifyForMarketplace :: Prelude.Maybe Prelude.Bool,
    -- | Specifies details about inference jobs that the algorithm runs,
    -- including the following:
    --
    -- -   The Amazon ECR paths of containers that contain the inference code
    --     and model artifacts.
    --
    -- -   The instance types that the algorithm supports for transform jobs
    --     and real-time endpoints used for inference.
    --
    -- -   The input and output content formats that the algorithm supports for
    --     inference.
    CreateAlgorithm -> Maybe InferenceSpecification
inferenceSpecification :: Prelude.Maybe InferenceSpecification,
    -- | 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>.
    CreateAlgorithm -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | Specifies configurations for one or more training jobs and that
    -- SageMaker runs to test the algorithm\'s training code and, optionally,
    -- one or more batch transform jobs that SageMaker runs to test the
    -- algorithm\'s inference code.
    CreateAlgorithm -> Maybe AlgorithmValidationSpecification
validationSpecification :: Prelude.Maybe AlgorithmValidationSpecification,
    -- | The name of the algorithm.
    CreateAlgorithm -> Text
algorithmName :: Prelude.Text,
    -- | Specifies details about training jobs run by this algorithm, including
    -- the following:
    --
    -- -   The Amazon ECR path of the container and the version digest of the
    --     algorithm.
    --
    -- -   The hyperparameters that the algorithm supports.
    --
    -- -   The instance types that the algorithm supports for training.
    --
    -- -   Whether the algorithm supports distributed training.
    --
    -- -   The metrics that the algorithm emits to Amazon CloudWatch.
    --
    -- -   Which metrics that the algorithm emits can be used as the objective
    --     metric for hyperparameter tuning jobs.
    --
    -- -   The input channels that the algorithm supports for training data.
    --     For example, an algorithm might support @train@, @validation@, and
    --     @test@ channels.
    CreateAlgorithm -> TrainingSpecification
trainingSpecification :: TrainingSpecification
  }
  deriving (CreateAlgorithm -> CreateAlgorithm -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAlgorithm -> CreateAlgorithm -> Bool
$c/= :: CreateAlgorithm -> CreateAlgorithm -> Bool
== :: CreateAlgorithm -> CreateAlgorithm -> Bool
$c== :: CreateAlgorithm -> CreateAlgorithm -> Bool
Prelude.Eq, ReadPrec [CreateAlgorithm]
ReadPrec CreateAlgorithm
Int -> ReadS CreateAlgorithm
ReadS [CreateAlgorithm]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAlgorithm]
$creadListPrec :: ReadPrec [CreateAlgorithm]
readPrec :: ReadPrec CreateAlgorithm
$creadPrec :: ReadPrec CreateAlgorithm
readList :: ReadS [CreateAlgorithm]
$creadList :: ReadS [CreateAlgorithm]
readsPrec :: Int -> ReadS CreateAlgorithm
$creadsPrec :: Int -> ReadS CreateAlgorithm
Prelude.Read, Int -> CreateAlgorithm -> ShowS
[CreateAlgorithm] -> ShowS
CreateAlgorithm -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAlgorithm] -> ShowS
$cshowList :: [CreateAlgorithm] -> ShowS
show :: CreateAlgorithm -> String
$cshow :: CreateAlgorithm -> String
showsPrec :: Int -> CreateAlgorithm -> ShowS
$cshowsPrec :: Int -> CreateAlgorithm -> ShowS
Prelude.Show, forall x. Rep CreateAlgorithm x -> CreateAlgorithm
forall x. CreateAlgorithm -> Rep CreateAlgorithm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAlgorithm x -> CreateAlgorithm
$cfrom :: forall x. CreateAlgorithm -> Rep CreateAlgorithm x
Prelude.Generic)

-- |
-- Create a value of 'CreateAlgorithm' 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:
--
-- 'algorithmDescription', 'createAlgorithm_algorithmDescription' - A description of the algorithm.
--
-- 'certifyForMarketplace', 'createAlgorithm_certifyForMarketplace' - Whether to certify the algorithm so that it can be listed in Amazon Web
-- Services Marketplace.
--
-- 'inferenceSpecification', 'createAlgorithm_inferenceSpecification' - Specifies details about inference jobs that the algorithm runs,
-- including the following:
--
-- -   The Amazon ECR paths of containers that contain the inference code
--     and model artifacts.
--
-- -   The instance types that the algorithm supports for transform jobs
--     and real-time endpoints used for inference.
--
-- -   The input and output content formats that the algorithm supports for
--     inference.
--
-- 'tags', 'createAlgorithm_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>.
--
-- 'validationSpecification', 'createAlgorithm_validationSpecification' - Specifies configurations for one or more training jobs and that
-- SageMaker runs to test the algorithm\'s training code and, optionally,
-- one or more batch transform jobs that SageMaker runs to test the
-- algorithm\'s inference code.
--
-- 'algorithmName', 'createAlgorithm_algorithmName' - The name of the algorithm.
--
-- 'trainingSpecification', 'createAlgorithm_trainingSpecification' - Specifies details about training jobs run by this algorithm, including
-- the following:
--
-- -   The Amazon ECR path of the container and the version digest of the
--     algorithm.
--
-- -   The hyperparameters that the algorithm supports.
--
-- -   The instance types that the algorithm supports for training.
--
-- -   Whether the algorithm supports distributed training.
--
-- -   The metrics that the algorithm emits to Amazon CloudWatch.
--
-- -   Which metrics that the algorithm emits can be used as the objective
--     metric for hyperparameter tuning jobs.
--
-- -   The input channels that the algorithm supports for training data.
--     For example, an algorithm might support @train@, @validation@, and
--     @test@ channels.
newCreateAlgorithm ::
  -- | 'algorithmName'
  Prelude.Text ->
  -- | 'trainingSpecification'
  TrainingSpecification ->
  CreateAlgorithm
newCreateAlgorithm :: Text -> TrainingSpecification -> CreateAlgorithm
newCreateAlgorithm
  Text
pAlgorithmName_
  TrainingSpecification
pTrainingSpecification_ =
    CreateAlgorithm'
      { $sel:algorithmDescription:CreateAlgorithm' :: Maybe Text
algorithmDescription =
          forall a. Maybe a
Prelude.Nothing,
        $sel:certifyForMarketplace:CreateAlgorithm' :: Maybe Bool
certifyForMarketplace = forall a. Maybe a
Prelude.Nothing,
        $sel:inferenceSpecification:CreateAlgorithm' :: Maybe InferenceSpecification
inferenceSpecification = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateAlgorithm' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:validationSpecification:CreateAlgorithm' :: Maybe AlgorithmValidationSpecification
validationSpecification = forall a. Maybe a
Prelude.Nothing,
        $sel:algorithmName:CreateAlgorithm' :: Text
algorithmName = Text
pAlgorithmName_,
        $sel:trainingSpecification:CreateAlgorithm' :: TrainingSpecification
trainingSpecification = TrainingSpecification
pTrainingSpecification_
      }

-- | A description of the algorithm.
createAlgorithm_algorithmDescription :: Lens.Lens' CreateAlgorithm (Prelude.Maybe Prelude.Text)
createAlgorithm_algorithmDescription :: Lens' CreateAlgorithm (Maybe Text)
createAlgorithm_algorithmDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlgorithm' {Maybe Text
algorithmDescription :: Maybe Text
$sel:algorithmDescription:CreateAlgorithm' :: CreateAlgorithm -> Maybe Text
algorithmDescription} -> Maybe Text
algorithmDescription) (\s :: CreateAlgorithm
s@CreateAlgorithm' {} Maybe Text
a -> CreateAlgorithm
s {$sel:algorithmDescription:CreateAlgorithm' :: Maybe Text
algorithmDescription = Maybe Text
a} :: CreateAlgorithm)

-- | Whether to certify the algorithm so that it can be listed in Amazon Web
-- Services Marketplace.
createAlgorithm_certifyForMarketplace :: Lens.Lens' CreateAlgorithm (Prelude.Maybe Prelude.Bool)
createAlgorithm_certifyForMarketplace :: Lens' CreateAlgorithm (Maybe Bool)
createAlgorithm_certifyForMarketplace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlgorithm' {Maybe Bool
certifyForMarketplace :: Maybe Bool
$sel:certifyForMarketplace:CreateAlgorithm' :: CreateAlgorithm -> Maybe Bool
certifyForMarketplace} -> Maybe Bool
certifyForMarketplace) (\s :: CreateAlgorithm
s@CreateAlgorithm' {} Maybe Bool
a -> CreateAlgorithm
s {$sel:certifyForMarketplace:CreateAlgorithm' :: Maybe Bool
certifyForMarketplace = Maybe Bool
a} :: CreateAlgorithm)

-- | Specifies details about inference jobs that the algorithm runs,
-- including the following:
--
-- -   The Amazon ECR paths of containers that contain the inference code
--     and model artifacts.
--
-- -   The instance types that the algorithm supports for transform jobs
--     and real-time endpoints used for inference.
--
-- -   The input and output content formats that the algorithm supports for
--     inference.
createAlgorithm_inferenceSpecification :: Lens.Lens' CreateAlgorithm (Prelude.Maybe InferenceSpecification)
createAlgorithm_inferenceSpecification :: Lens' CreateAlgorithm (Maybe InferenceSpecification)
createAlgorithm_inferenceSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlgorithm' {Maybe InferenceSpecification
inferenceSpecification :: Maybe InferenceSpecification
$sel:inferenceSpecification:CreateAlgorithm' :: CreateAlgorithm -> Maybe InferenceSpecification
inferenceSpecification} -> Maybe InferenceSpecification
inferenceSpecification) (\s :: CreateAlgorithm
s@CreateAlgorithm' {} Maybe InferenceSpecification
a -> CreateAlgorithm
s {$sel:inferenceSpecification:CreateAlgorithm' :: Maybe InferenceSpecification
inferenceSpecification = Maybe InferenceSpecification
a} :: CreateAlgorithm)

-- | 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>.
createAlgorithm_tags :: Lens.Lens' CreateAlgorithm (Prelude.Maybe [Tag])
createAlgorithm_tags :: Lens' CreateAlgorithm (Maybe [Tag])
createAlgorithm_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlgorithm' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateAlgorithm' :: CreateAlgorithm -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateAlgorithm
s@CreateAlgorithm' {} Maybe [Tag]
a -> CreateAlgorithm
s {$sel:tags:CreateAlgorithm' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateAlgorithm) 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

-- | Specifies configurations for one or more training jobs and that
-- SageMaker runs to test the algorithm\'s training code and, optionally,
-- one or more batch transform jobs that SageMaker runs to test the
-- algorithm\'s inference code.
createAlgorithm_validationSpecification :: Lens.Lens' CreateAlgorithm (Prelude.Maybe AlgorithmValidationSpecification)
createAlgorithm_validationSpecification :: Lens' CreateAlgorithm (Maybe AlgorithmValidationSpecification)
createAlgorithm_validationSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlgorithm' {Maybe AlgorithmValidationSpecification
validationSpecification :: Maybe AlgorithmValidationSpecification
$sel:validationSpecification:CreateAlgorithm' :: CreateAlgorithm -> Maybe AlgorithmValidationSpecification
validationSpecification} -> Maybe AlgorithmValidationSpecification
validationSpecification) (\s :: CreateAlgorithm
s@CreateAlgorithm' {} Maybe AlgorithmValidationSpecification
a -> CreateAlgorithm
s {$sel:validationSpecification:CreateAlgorithm' :: Maybe AlgorithmValidationSpecification
validationSpecification = Maybe AlgorithmValidationSpecification
a} :: CreateAlgorithm)

-- | The name of the algorithm.
createAlgorithm_algorithmName :: Lens.Lens' CreateAlgorithm Prelude.Text
createAlgorithm_algorithmName :: Lens' CreateAlgorithm Text
createAlgorithm_algorithmName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlgorithm' {Text
algorithmName :: Text
$sel:algorithmName:CreateAlgorithm' :: CreateAlgorithm -> Text
algorithmName} -> Text
algorithmName) (\s :: CreateAlgorithm
s@CreateAlgorithm' {} Text
a -> CreateAlgorithm
s {$sel:algorithmName:CreateAlgorithm' :: Text
algorithmName = Text
a} :: CreateAlgorithm)

-- | Specifies details about training jobs run by this algorithm, including
-- the following:
--
-- -   The Amazon ECR path of the container and the version digest of the
--     algorithm.
--
-- -   The hyperparameters that the algorithm supports.
--
-- -   The instance types that the algorithm supports for training.
--
-- -   Whether the algorithm supports distributed training.
--
-- -   The metrics that the algorithm emits to Amazon CloudWatch.
--
-- -   Which metrics that the algorithm emits can be used as the objective
--     metric for hyperparameter tuning jobs.
--
-- -   The input channels that the algorithm supports for training data.
--     For example, an algorithm might support @train@, @validation@, and
--     @test@ channels.
createAlgorithm_trainingSpecification :: Lens.Lens' CreateAlgorithm TrainingSpecification
createAlgorithm_trainingSpecification :: Lens' CreateAlgorithm TrainingSpecification
createAlgorithm_trainingSpecification = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlgorithm' {TrainingSpecification
trainingSpecification :: TrainingSpecification
$sel:trainingSpecification:CreateAlgorithm' :: CreateAlgorithm -> TrainingSpecification
trainingSpecification} -> TrainingSpecification
trainingSpecification) (\s :: CreateAlgorithm
s@CreateAlgorithm' {} TrainingSpecification
a -> CreateAlgorithm
s {$sel:trainingSpecification:CreateAlgorithm' :: TrainingSpecification
trainingSpecification = TrainingSpecification
a} :: CreateAlgorithm)

instance Core.AWSRequest CreateAlgorithm where
  type
    AWSResponse CreateAlgorithm =
      CreateAlgorithmResponse
  request :: (Service -> Service) -> CreateAlgorithm -> Request CreateAlgorithm
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 CreateAlgorithm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAlgorithm)))
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 -> CreateAlgorithmResponse
CreateAlgorithmResponse'
            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
"AlgorithmArn")
      )

instance Prelude.Hashable CreateAlgorithm where
  hashWithSalt :: Int -> CreateAlgorithm -> Int
hashWithSalt Int
_salt CreateAlgorithm' {Maybe Bool
Maybe [Tag]
Maybe Text
Maybe InferenceSpecification
Maybe AlgorithmValidationSpecification
Text
TrainingSpecification
trainingSpecification :: TrainingSpecification
algorithmName :: Text
validationSpecification :: Maybe AlgorithmValidationSpecification
tags :: Maybe [Tag]
inferenceSpecification :: Maybe InferenceSpecification
certifyForMarketplace :: Maybe Bool
algorithmDescription :: Maybe Text
$sel:trainingSpecification:CreateAlgorithm' :: CreateAlgorithm -> TrainingSpecification
$sel:algorithmName:CreateAlgorithm' :: CreateAlgorithm -> Text
$sel:validationSpecification:CreateAlgorithm' :: CreateAlgorithm -> Maybe AlgorithmValidationSpecification
$sel:tags:CreateAlgorithm' :: CreateAlgorithm -> Maybe [Tag]
$sel:inferenceSpecification:CreateAlgorithm' :: CreateAlgorithm -> Maybe InferenceSpecification
$sel:certifyForMarketplace:CreateAlgorithm' :: CreateAlgorithm -> Maybe Bool
$sel:algorithmDescription:CreateAlgorithm' :: CreateAlgorithm -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
algorithmDescription
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
certifyForMarketplace
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InferenceSpecification
inferenceSpecification
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AlgorithmValidationSpecification
validationSpecification
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
algorithmName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TrainingSpecification
trainingSpecification

instance Prelude.NFData CreateAlgorithm where
  rnf :: CreateAlgorithm -> ()
rnf CreateAlgorithm' {Maybe Bool
Maybe [Tag]
Maybe Text
Maybe InferenceSpecification
Maybe AlgorithmValidationSpecification
Text
TrainingSpecification
trainingSpecification :: TrainingSpecification
algorithmName :: Text
validationSpecification :: Maybe AlgorithmValidationSpecification
tags :: Maybe [Tag]
inferenceSpecification :: Maybe InferenceSpecification
certifyForMarketplace :: Maybe Bool
algorithmDescription :: Maybe Text
$sel:trainingSpecification:CreateAlgorithm' :: CreateAlgorithm -> TrainingSpecification
$sel:algorithmName:CreateAlgorithm' :: CreateAlgorithm -> Text
$sel:validationSpecification:CreateAlgorithm' :: CreateAlgorithm -> Maybe AlgorithmValidationSpecification
$sel:tags:CreateAlgorithm' :: CreateAlgorithm -> Maybe [Tag]
$sel:inferenceSpecification:CreateAlgorithm' :: CreateAlgorithm -> Maybe InferenceSpecification
$sel:certifyForMarketplace:CreateAlgorithm' :: CreateAlgorithm -> Maybe Bool
$sel:algorithmDescription:CreateAlgorithm' :: CreateAlgorithm -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
algorithmDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
certifyForMarketplace
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InferenceSpecification
inferenceSpecification
      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 AlgorithmValidationSpecification
validationSpecification
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
algorithmName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TrainingSpecification
trainingSpecification

instance Data.ToHeaders CreateAlgorithm where
  toHeaders :: CreateAlgorithm -> 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.CreateAlgorithm" :: 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 CreateAlgorithm where
  toJSON :: CreateAlgorithm -> Value
toJSON CreateAlgorithm' {Maybe Bool
Maybe [Tag]
Maybe Text
Maybe InferenceSpecification
Maybe AlgorithmValidationSpecification
Text
TrainingSpecification
trainingSpecification :: TrainingSpecification
algorithmName :: Text
validationSpecification :: Maybe AlgorithmValidationSpecification
tags :: Maybe [Tag]
inferenceSpecification :: Maybe InferenceSpecification
certifyForMarketplace :: Maybe Bool
algorithmDescription :: Maybe Text
$sel:trainingSpecification:CreateAlgorithm' :: CreateAlgorithm -> TrainingSpecification
$sel:algorithmName:CreateAlgorithm' :: CreateAlgorithm -> Text
$sel:validationSpecification:CreateAlgorithm' :: CreateAlgorithm -> Maybe AlgorithmValidationSpecification
$sel:tags:CreateAlgorithm' :: CreateAlgorithm -> Maybe [Tag]
$sel:inferenceSpecification:CreateAlgorithm' :: CreateAlgorithm -> Maybe InferenceSpecification
$sel:certifyForMarketplace:CreateAlgorithm' :: CreateAlgorithm -> Maybe Bool
$sel:algorithmDescription:CreateAlgorithm' :: CreateAlgorithm -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AlgorithmDescription" 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 Text
algorithmDescription,
            (Key
"CertifyForMarketplace" 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
certifyForMarketplace,
            (Key
"InferenceSpecification" 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 InferenceSpecification
inferenceSpecification,
            (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
"ValidationSpecification" 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 AlgorithmValidationSpecification
validationSpecification,
            forall a. a -> Maybe a
Prelude.Just (Key
"AlgorithmName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
algorithmName),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"TrainingSpecification"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TrainingSpecification
trainingSpecification
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateAlgorithmResponse' 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', 'createAlgorithmResponse_httpStatus' - The response's http status code.
--
-- 'algorithmArn', 'createAlgorithmResponse_algorithmArn' - The Amazon Resource Name (ARN) of the new algorithm.
newCreateAlgorithmResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'algorithmArn'
  Prelude.Text ->
  CreateAlgorithmResponse
newCreateAlgorithmResponse :: Int -> Text -> CreateAlgorithmResponse
newCreateAlgorithmResponse
  Int
pHttpStatus_
  Text
pAlgorithmArn_ =
    CreateAlgorithmResponse'
      { $sel:httpStatus:CreateAlgorithmResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:algorithmArn:CreateAlgorithmResponse' :: Text
algorithmArn = Text
pAlgorithmArn_
      }

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

-- | The Amazon Resource Name (ARN) of the new algorithm.
createAlgorithmResponse_algorithmArn :: Lens.Lens' CreateAlgorithmResponse Prelude.Text
createAlgorithmResponse_algorithmArn :: Lens' CreateAlgorithmResponse Text
createAlgorithmResponse_algorithmArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAlgorithmResponse' {Text
algorithmArn :: Text
$sel:algorithmArn:CreateAlgorithmResponse' :: CreateAlgorithmResponse -> Text
algorithmArn} -> Text
algorithmArn) (\s :: CreateAlgorithmResponse
s@CreateAlgorithmResponse' {} Text
a -> CreateAlgorithmResponse
s {$sel:algorithmArn:CreateAlgorithmResponse' :: Text
algorithmArn = Text
a} :: CreateAlgorithmResponse)

instance Prelude.NFData CreateAlgorithmResponse where
  rnf :: CreateAlgorithmResponse -> ()
rnf CreateAlgorithmResponse' {Int
Text
algorithmArn :: Text
httpStatus :: Int
$sel:algorithmArn:CreateAlgorithmResponse' :: CreateAlgorithmResponse -> Text
$sel:httpStatus:CreateAlgorithmResponse' :: CreateAlgorithmResponse -> 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
algorithmArn