{-# 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-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)
--
-- Create a machine learning algorithm that you can use in Amazon SageMaker
-- and list in the Amazon Web Services Marketplace.
module Amazonka.SageMaker.CreateAlgorithm
  ( -- * Creating a Request
    CreateAlgorithm (..),
    newCreateAlgorithm,

    -- * Request Lenses
    createAlgorithm_validationSpecification,
    createAlgorithm_inferenceSpecification,
    createAlgorithm_algorithmDescription,
    createAlgorithm_certifyForMarketplace,
    createAlgorithm_tags,
    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.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:/ 'newCreateAlgorithm' smart constructor.
data CreateAlgorithm = CreateAlgorithm'
  { -- | Specifies configurations for one or more training jobs and that Amazon
    -- SageMaker runs to test the algorithm\'s training code and, optionally,
    -- one or more batch transform jobs that Amazon SageMaker runs to test the
    -- algorithm\'s inference code.
    CreateAlgorithm -> Maybe AlgorithmValidationSpecification
validationSpecification :: Prelude.Maybe AlgorithmValidationSpecification,
    -- | 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,
    -- | 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,
    -- | 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],
    -- | 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
(CreateAlgorithm -> CreateAlgorithm -> Bool)
-> (CreateAlgorithm -> CreateAlgorithm -> Bool)
-> Eq CreateAlgorithm
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]
(Int -> ReadS CreateAlgorithm)
-> ReadS [CreateAlgorithm]
-> ReadPrec CreateAlgorithm
-> ReadPrec [CreateAlgorithm]
-> Read 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
(Int -> CreateAlgorithm -> ShowS)
-> (CreateAlgorithm -> String)
-> ([CreateAlgorithm] -> ShowS)
-> Show CreateAlgorithm
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. CreateAlgorithm -> Rep CreateAlgorithm x)
-> (forall x. Rep CreateAlgorithm x -> CreateAlgorithm)
-> Generic CreateAlgorithm
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:
--
-- 'validationSpecification', 'createAlgorithm_validationSpecification' - Specifies configurations for one or more training jobs and that Amazon
-- SageMaker runs to test the algorithm\'s training code and, optionally,
-- one or more batch transform jobs that Amazon SageMaker runs to test the
-- algorithm\'s inference code.
--
-- '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.
--
-- '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.
--
-- '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>.
--
-- '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' :: Maybe AlgorithmValidationSpecification
-> Maybe InferenceSpecification
-> Maybe Text
-> Maybe Bool
-> Maybe [Tag]
-> Text
-> TrainingSpecification
-> CreateAlgorithm
CreateAlgorithm'
      { $sel:validationSpecification:CreateAlgorithm' :: Maybe AlgorithmValidationSpecification
validationSpecification =
          Maybe AlgorithmValidationSpecification
forall a. Maybe a
Prelude.Nothing,
        $sel:inferenceSpecification:CreateAlgorithm' :: Maybe InferenceSpecification
inferenceSpecification = Maybe InferenceSpecification
forall a. Maybe a
Prelude.Nothing,
        $sel:algorithmDescription:CreateAlgorithm' :: Maybe Text
algorithmDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:certifyForMarketplace:CreateAlgorithm' :: Maybe Bool
certifyForMarketplace = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateAlgorithm' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:algorithmName:CreateAlgorithm' :: Text
algorithmName = Text
pAlgorithmName_,
        $sel:trainingSpecification:CreateAlgorithm' :: TrainingSpecification
trainingSpecification = TrainingSpecification
pTrainingSpecification_
      }

-- | Specifies configurations for one or more training jobs and that Amazon
-- SageMaker runs to test the algorithm\'s training code and, optionally,
-- one or more batch transform jobs that Amazon SageMaker runs to test the
-- algorithm\'s inference code.
createAlgorithm_validationSpecification :: Lens.Lens' CreateAlgorithm (Prelude.Maybe AlgorithmValidationSpecification)
createAlgorithm_validationSpecification :: (Maybe AlgorithmValidationSpecification
 -> f (Maybe AlgorithmValidationSpecification))
-> CreateAlgorithm -> f CreateAlgorithm
createAlgorithm_validationSpecification = (CreateAlgorithm -> Maybe AlgorithmValidationSpecification)
-> (CreateAlgorithm
    -> Maybe AlgorithmValidationSpecification -> CreateAlgorithm)
-> Lens
     CreateAlgorithm
     CreateAlgorithm
     (Maybe AlgorithmValidationSpecification)
     (Maybe AlgorithmValidationSpecification)
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)

-- | 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 :: (Maybe InferenceSpecification -> f (Maybe InferenceSpecification))
-> CreateAlgorithm -> f CreateAlgorithm
createAlgorithm_inferenceSpecification = (CreateAlgorithm -> Maybe InferenceSpecification)
-> (CreateAlgorithm
    -> Maybe InferenceSpecification -> CreateAlgorithm)
-> Lens
     CreateAlgorithm
     CreateAlgorithm
     (Maybe InferenceSpecification)
     (Maybe 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)

-- | A description of the algorithm.
createAlgorithm_algorithmDescription :: Lens.Lens' CreateAlgorithm (Prelude.Maybe Prelude.Text)
createAlgorithm_algorithmDescription :: (Maybe Text -> f (Maybe Text))
-> CreateAlgorithm -> f CreateAlgorithm
createAlgorithm_algorithmDescription = (CreateAlgorithm -> Maybe Text)
-> (CreateAlgorithm -> Maybe Text -> CreateAlgorithm)
-> Lens CreateAlgorithm CreateAlgorithm (Maybe Text) (Maybe Text)
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 :: (Maybe Bool -> f (Maybe Bool))
-> CreateAlgorithm -> f CreateAlgorithm
createAlgorithm_certifyForMarketplace = (CreateAlgorithm -> Maybe Bool)
-> (CreateAlgorithm -> Maybe Bool -> CreateAlgorithm)
-> Lens CreateAlgorithm CreateAlgorithm (Maybe Bool) (Maybe Bool)
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)

-- | 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 :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAlgorithm -> f CreateAlgorithm
createAlgorithm_tags = (CreateAlgorithm -> Maybe [Tag])
-> (CreateAlgorithm -> Maybe [Tag] -> CreateAlgorithm)
-> Lens CreateAlgorithm CreateAlgorithm (Maybe [Tag]) (Maybe [Tag])
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) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateAlgorithm -> f CreateAlgorithm)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateAlgorithm
-> f CreateAlgorithm
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 algorithm.
createAlgorithm_algorithmName :: Lens.Lens' CreateAlgorithm Prelude.Text
createAlgorithm_algorithmName :: (Text -> f Text) -> CreateAlgorithm -> f CreateAlgorithm
createAlgorithm_algorithmName = (CreateAlgorithm -> Text)
-> (CreateAlgorithm -> Text -> CreateAlgorithm)
-> Lens CreateAlgorithm CreateAlgorithm Text Text
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 :: (TrainingSpecification -> f TrainingSpecification)
-> CreateAlgorithm -> f CreateAlgorithm
createAlgorithm_trainingSpecification = (CreateAlgorithm -> TrainingSpecification)
-> (CreateAlgorithm -> TrainingSpecification -> CreateAlgorithm)
-> Lens
     CreateAlgorithm
     CreateAlgorithm
     TrainingSpecification
     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 :: CreateAlgorithm -> Request CreateAlgorithm
request = Service -> CreateAlgorithm -> Request CreateAlgorithm
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateAlgorithm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAlgorithm)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateAlgorithm))
-> Logger
-> Service
-> Proxy CreateAlgorithm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAlgorithm)))
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 -> CreateAlgorithmResponse
CreateAlgorithmResponse'
            (Int -> Text -> CreateAlgorithmResponse)
-> Either String Int
-> Either String (Text -> CreateAlgorithmResponse)
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 -> CreateAlgorithmResponse)
-> Either String Text -> Either String CreateAlgorithmResponse
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
"AlgorithmArn")
      )

instance Prelude.Hashable CreateAlgorithm

instance Prelude.NFData CreateAlgorithm

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

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

instance Core.ToQuery CreateAlgorithm where
  toQuery :: CreateAlgorithm -> QueryString
toQuery = QueryString -> CreateAlgorithm -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(CreateAlgorithmResponse -> CreateAlgorithmResponse -> Bool)
-> (CreateAlgorithmResponse -> CreateAlgorithmResponse -> Bool)
-> Eq CreateAlgorithmResponse
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]
(Int -> ReadS CreateAlgorithmResponse)
-> ReadS [CreateAlgorithmResponse]
-> ReadPrec CreateAlgorithmResponse
-> ReadPrec [CreateAlgorithmResponse]
-> Read 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
(Int -> CreateAlgorithmResponse -> ShowS)
-> (CreateAlgorithmResponse -> String)
-> ([CreateAlgorithmResponse] -> ShowS)
-> Show CreateAlgorithmResponse
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.
 CreateAlgorithmResponse -> Rep CreateAlgorithmResponse x)
-> (forall x.
    Rep CreateAlgorithmResponse x -> CreateAlgorithmResponse)
-> Generic CreateAlgorithmResponse
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' :: Int -> Text -> CreateAlgorithmResponse
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 :: (Int -> f Int)
-> CreateAlgorithmResponse -> f CreateAlgorithmResponse
createAlgorithmResponse_httpStatus = (CreateAlgorithmResponse -> Int)
-> (CreateAlgorithmResponse -> Int -> CreateAlgorithmResponse)
-> Lens CreateAlgorithmResponse CreateAlgorithmResponse Int Int
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 :: (Text -> f Text)
-> CreateAlgorithmResponse -> f CreateAlgorithmResponse
createAlgorithmResponse_algorithmArn = (CreateAlgorithmResponse -> Text)
-> (CreateAlgorithmResponse -> Text -> CreateAlgorithmResponse)
-> Lens CreateAlgorithmResponse CreateAlgorithmResponse Text Text
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