{-# 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.Rekognition.CreateProjectVersion
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a new version of a model and begins training. Models are managed
-- as part of an Amazon Rekognition Custom Labels project. You can specify
-- one training dataset and one testing dataset. The response from
-- @CreateProjectVersion@ is an Amazon Resource Name (ARN) for the version
-- of the model.
--
-- Training takes a while to complete. You can get the current status by
-- calling DescribeProjectVersions.
--
-- Once training has successfully completed, call DescribeProjectVersions
-- to get the training results and evaluate the model.
--
-- After evaluating the model, you start the model by calling
-- StartProjectVersion.
--
-- This operation requires permissions to perform the
-- @rekognition:CreateProjectVersion@ action.
module Amazonka.Rekognition.CreateProjectVersion
  ( -- * Creating a Request
    CreateProjectVersion (..),
    newCreateProjectVersion,

    -- * Request Lenses
    createProjectVersion_kmsKeyId,
    createProjectVersion_tags,
    createProjectVersion_projectArn,
    createProjectVersion_versionName,
    createProjectVersion_outputConfig,
    createProjectVersion_trainingData,
    createProjectVersion_testingData,

    -- * Destructuring the Response
    CreateProjectVersionResponse (..),
    newCreateProjectVersionResponse,

    -- * Response Lenses
    createProjectVersionResponse_projectVersionArn,
    createProjectVersionResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateProjectVersion' smart constructor.
data CreateProjectVersion = CreateProjectVersion'
  { -- | The identifier for your AWS Key Management Service (AWS KMS) customer
    -- master key (CMK). You can supply the Amazon Resource Name (ARN) of your
    -- CMK, the ID of your CMK, an alias for your CMK, or an alias ARN. The key
    -- is used to encrypt training and test images copied into the service for
    -- model training. Your source images are unaffected. The key is also used
    -- to encrypt training results and manifest files written to the output
    -- Amazon S3 bucket (@OutputConfig@).
    --
    -- If you choose to use your own CMK, you need the following permissions on
    -- the CMK.
    --
    -- -   kms:CreateGrant
    --
    -- -   kms:DescribeKey
    --
    -- -   kms:GenerateDataKey
    --
    -- -   kms:Decrypt
    --
    -- If you don\'t specify a value for @KmsKeyId@, images copied into the
    -- service are encrypted using a key that AWS owns and manages.
    CreateProjectVersion -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | A set of tags (key-value pairs) that you want to attach to the model.
    CreateProjectVersion -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ARN of the Amazon Rekognition Custom Labels project that manages the
    -- model that you want to train.
    CreateProjectVersion -> Text
projectArn :: Prelude.Text,
    -- | A name for the version of the model. This value must be unique.
    CreateProjectVersion -> Text
versionName :: Prelude.Text,
    -- | The Amazon S3 bucket location to store the results of training. The S3
    -- bucket can be in any AWS account as long as the caller has
    -- @s3:PutObject@ permissions on the S3 bucket.
    CreateProjectVersion -> OutputConfig
outputConfig :: OutputConfig,
    -- | The dataset to use for training.
    CreateProjectVersion -> TrainingData
trainingData :: TrainingData,
    -- | The dataset to use for testing.
    CreateProjectVersion -> TestingData
testingData :: TestingData
  }
  deriving (CreateProjectVersion -> CreateProjectVersion -> Bool
(CreateProjectVersion -> CreateProjectVersion -> Bool)
-> (CreateProjectVersion -> CreateProjectVersion -> Bool)
-> Eq CreateProjectVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProjectVersion -> CreateProjectVersion -> Bool
$c/= :: CreateProjectVersion -> CreateProjectVersion -> Bool
== :: CreateProjectVersion -> CreateProjectVersion -> Bool
$c== :: CreateProjectVersion -> CreateProjectVersion -> Bool
Prelude.Eq, ReadPrec [CreateProjectVersion]
ReadPrec CreateProjectVersion
Int -> ReadS CreateProjectVersion
ReadS [CreateProjectVersion]
(Int -> ReadS CreateProjectVersion)
-> ReadS [CreateProjectVersion]
-> ReadPrec CreateProjectVersion
-> ReadPrec [CreateProjectVersion]
-> Read CreateProjectVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProjectVersion]
$creadListPrec :: ReadPrec [CreateProjectVersion]
readPrec :: ReadPrec CreateProjectVersion
$creadPrec :: ReadPrec CreateProjectVersion
readList :: ReadS [CreateProjectVersion]
$creadList :: ReadS [CreateProjectVersion]
readsPrec :: Int -> ReadS CreateProjectVersion
$creadsPrec :: Int -> ReadS CreateProjectVersion
Prelude.Read, Int -> CreateProjectVersion -> ShowS
[CreateProjectVersion] -> ShowS
CreateProjectVersion -> String
(Int -> CreateProjectVersion -> ShowS)
-> (CreateProjectVersion -> String)
-> ([CreateProjectVersion] -> ShowS)
-> Show CreateProjectVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProjectVersion] -> ShowS
$cshowList :: [CreateProjectVersion] -> ShowS
show :: CreateProjectVersion -> String
$cshow :: CreateProjectVersion -> String
showsPrec :: Int -> CreateProjectVersion -> ShowS
$cshowsPrec :: Int -> CreateProjectVersion -> ShowS
Prelude.Show, (forall x. CreateProjectVersion -> Rep CreateProjectVersion x)
-> (forall x. Rep CreateProjectVersion x -> CreateProjectVersion)
-> Generic CreateProjectVersion
forall x. Rep CreateProjectVersion x -> CreateProjectVersion
forall x. CreateProjectVersion -> Rep CreateProjectVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateProjectVersion x -> CreateProjectVersion
$cfrom :: forall x. CreateProjectVersion -> Rep CreateProjectVersion x
Prelude.Generic)

-- |
-- Create a value of 'CreateProjectVersion' 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:
--
-- 'kmsKeyId', 'createProjectVersion_kmsKeyId' - The identifier for your AWS Key Management Service (AWS KMS) customer
-- master key (CMK). You can supply the Amazon Resource Name (ARN) of your
-- CMK, the ID of your CMK, an alias for your CMK, or an alias ARN. The key
-- is used to encrypt training and test images copied into the service for
-- model training. Your source images are unaffected. The key is also used
-- to encrypt training results and manifest files written to the output
-- Amazon S3 bucket (@OutputConfig@).
--
-- If you choose to use your own CMK, you need the following permissions on
-- the CMK.
--
-- -   kms:CreateGrant
--
-- -   kms:DescribeKey
--
-- -   kms:GenerateDataKey
--
-- -   kms:Decrypt
--
-- If you don\'t specify a value for @KmsKeyId@, images copied into the
-- service are encrypted using a key that AWS owns and manages.
--
-- 'tags', 'createProjectVersion_tags' - A set of tags (key-value pairs) that you want to attach to the model.
--
-- 'projectArn', 'createProjectVersion_projectArn' - The ARN of the Amazon Rekognition Custom Labels project that manages the
-- model that you want to train.
--
-- 'versionName', 'createProjectVersion_versionName' - A name for the version of the model. This value must be unique.
--
-- 'outputConfig', 'createProjectVersion_outputConfig' - The Amazon S3 bucket location to store the results of training. The S3
-- bucket can be in any AWS account as long as the caller has
-- @s3:PutObject@ permissions on the S3 bucket.
--
-- 'trainingData', 'createProjectVersion_trainingData' - The dataset to use for training.
--
-- 'testingData', 'createProjectVersion_testingData' - The dataset to use for testing.
newCreateProjectVersion ::
  -- | 'projectArn'
  Prelude.Text ->
  -- | 'versionName'
  Prelude.Text ->
  -- | 'outputConfig'
  OutputConfig ->
  -- | 'trainingData'
  TrainingData ->
  -- | 'testingData'
  TestingData ->
  CreateProjectVersion
newCreateProjectVersion :: Text
-> Text
-> OutputConfig
-> TrainingData
-> TestingData
-> CreateProjectVersion
newCreateProjectVersion
  Text
pProjectArn_
  Text
pVersionName_
  OutputConfig
pOutputConfig_
  TrainingData
pTrainingData_
  TestingData
pTestingData_ =
    CreateProjectVersion' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> OutputConfig
-> TrainingData
-> TestingData
-> CreateProjectVersion
CreateProjectVersion'
      { $sel:kmsKeyId:CreateProjectVersion' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateProjectVersion' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:projectArn:CreateProjectVersion' :: Text
projectArn = Text
pProjectArn_,
        $sel:versionName:CreateProjectVersion' :: Text
versionName = Text
pVersionName_,
        $sel:outputConfig:CreateProjectVersion' :: OutputConfig
outputConfig = OutputConfig
pOutputConfig_,
        $sel:trainingData:CreateProjectVersion' :: TrainingData
trainingData = TrainingData
pTrainingData_,
        $sel:testingData:CreateProjectVersion' :: TestingData
testingData = TestingData
pTestingData_
      }

-- | The identifier for your AWS Key Management Service (AWS KMS) customer
-- master key (CMK). You can supply the Amazon Resource Name (ARN) of your
-- CMK, the ID of your CMK, an alias for your CMK, or an alias ARN. The key
-- is used to encrypt training and test images copied into the service for
-- model training. Your source images are unaffected. The key is also used
-- to encrypt training results and manifest files written to the output
-- Amazon S3 bucket (@OutputConfig@).
--
-- If you choose to use your own CMK, you need the following permissions on
-- the CMK.
--
-- -   kms:CreateGrant
--
-- -   kms:DescribeKey
--
-- -   kms:GenerateDataKey
--
-- -   kms:Decrypt
--
-- If you don\'t specify a value for @KmsKeyId@, images copied into the
-- service are encrypted using a key that AWS owns and manages.
createProjectVersion_kmsKeyId :: Lens.Lens' CreateProjectVersion (Prelude.Maybe Prelude.Text)
createProjectVersion_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> CreateProjectVersion -> f CreateProjectVersion
createProjectVersion_kmsKeyId = (CreateProjectVersion -> Maybe Text)
-> (CreateProjectVersion -> Maybe Text -> CreateProjectVersion)
-> Lens
     CreateProjectVersion CreateProjectVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectVersion' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateProjectVersion' :: CreateProjectVersion -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateProjectVersion
s@CreateProjectVersion' {} Maybe Text
a -> CreateProjectVersion
s {$sel:kmsKeyId:CreateProjectVersion' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateProjectVersion)

-- | A set of tags (key-value pairs) that you want to attach to the model.
createProjectVersion_tags :: Lens.Lens' CreateProjectVersion (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createProjectVersion_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateProjectVersion -> f CreateProjectVersion
createProjectVersion_tags = (CreateProjectVersion -> Maybe (HashMap Text Text))
-> (CreateProjectVersion
    -> Maybe (HashMap Text Text) -> CreateProjectVersion)
-> Lens
     CreateProjectVersion
     CreateProjectVersion
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectVersion' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateProjectVersion' :: CreateProjectVersion -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateProjectVersion
s@CreateProjectVersion' {} Maybe (HashMap Text Text)
a -> CreateProjectVersion
s {$sel:tags:CreateProjectVersion' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateProjectVersion) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateProjectVersion -> f CreateProjectVersion)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateProjectVersion
-> f CreateProjectVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN of the Amazon Rekognition Custom Labels project that manages the
-- model that you want to train.
createProjectVersion_projectArn :: Lens.Lens' CreateProjectVersion Prelude.Text
createProjectVersion_projectArn :: (Text -> f Text) -> CreateProjectVersion -> f CreateProjectVersion
createProjectVersion_projectArn = (CreateProjectVersion -> Text)
-> (CreateProjectVersion -> Text -> CreateProjectVersion)
-> Lens CreateProjectVersion CreateProjectVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectVersion' {Text
projectArn :: Text
$sel:projectArn:CreateProjectVersion' :: CreateProjectVersion -> Text
projectArn} -> Text
projectArn) (\s :: CreateProjectVersion
s@CreateProjectVersion' {} Text
a -> CreateProjectVersion
s {$sel:projectArn:CreateProjectVersion' :: Text
projectArn = Text
a} :: CreateProjectVersion)

-- | A name for the version of the model. This value must be unique.
createProjectVersion_versionName :: Lens.Lens' CreateProjectVersion Prelude.Text
createProjectVersion_versionName :: (Text -> f Text) -> CreateProjectVersion -> f CreateProjectVersion
createProjectVersion_versionName = (CreateProjectVersion -> Text)
-> (CreateProjectVersion -> Text -> CreateProjectVersion)
-> Lens CreateProjectVersion CreateProjectVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectVersion' {Text
versionName :: Text
$sel:versionName:CreateProjectVersion' :: CreateProjectVersion -> Text
versionName} -> Text
versionName) (\s :: CreateProjectVersion
s@CreateProjectVersion' {} Text
a -> CreateProjectVersion
s {$sel:versionName:CreateProjectVersion' :: Text
versionName = Text
a} :: CreateProjectVersion)

-- | The Amazon S3 bucket location to store the results of training. The S3
-- bucket can be in any AWS account as long as the caller has
-- @s3:PutObject@ permissions on the S3 bucket.
createProjectVersion_outputConfig :: Lens.Lens' CreateProjectVersion OutputConfig
createProjectVersion_outputConfig :: (OutputConfig -> f OutputConfig)
-> CreateProjectVersion -> f CreateProjectVersion
createProjectVersion_outputConfig = (CreateProjectVersion -> OutputConfig)
-> (CreateProjectVersion -> OutputConfig -> CreateProjectVersion)
-> Lens
     CreateProjectVersion CreateProjectVersion OutputConfig OutputConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectVersion' {OutputConfig
outputConfig :: OutputConfig
$sel:outputConfig:CreateProjectVersion' :: CreateProjectVersion -> OutputConfig
outputConfig} -> OutputConfig
outputConfig) (\s :: CreateProjectVersion
s@CreateProjectVersion' {} OutputConfig
a -> CreateProjectVersion
s {$sel:outputConfig:CreateProjectVersion' :: OutputConfig
outputConfig = OutputConfig
a} :: CreateProjectVersion)

-- | The dataset to use for training.
createProjectVersion_trainingData :: Lens.Lens' CreateProjectVersion TrainingData
createProjectVersion_trainingData :: (TrainingData -> f TrainingData)
-> CreateProjectVersion -> f CreateProjectVersion
createProjectVersion_trainingData = (CreateProjectVersion -> TrainingData)
-> (CreateProjectVersion -> TrainingData -> CreateProjectVersion)
-> Lens
     CreateProjectVersion CreateProjectVersion TrainingData TrainingData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectVersion' {TrainingData
trainingData :: TrainingData
$sel:trainingData:CreateProjectVersion' :: CreateProjectVersion -> TrainingData
trainingData} -> TrainingData
trainingData) (\s :: CreateProjectVersion
s@CreateProjectVersion' {} TrainingData
a -> CreateProjectVersion
s {$sel:trainingData:CreateProjectVersion' :: TrainingData
trainingData = TrainingData
a} :: CreateProjectVersion)

-- | The dataset to use for testing.
createProjectVersion_testingData :: Lens.Lens' CreateProjectVersion TestingData
createProjectVersion_testingData :: (TestingData -> f TestingData)
-> CreateProjectVersion -> f CreateProjectVersion
createProjectVersion_testingData = (CreateProjectVersion -> TestingData)
-> (CreateProjectVersion -> TestingData -> CreateProjectVersion)
-> Lens
     CreateProjectVersion CreateProjectVersion TestingData TestingData
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectVersion' {TestingData
testingData :: TestingData
$sel:testingData:CreateProjectVersion' :: CreateProjectVersion -> TestingData
testingData} -> TestingData
testingData) (\s :: CreateProjectVersion
s@CreateProjectVersion' {} TestingData
a -> CreateProjectVersion
s {$sel:testingData:CreateProjectVersion' :: TestingData
testingData = TestingData
a} :: CreateProjectVersion)

instance Core.AWSRequest CreateProjectVersion where
  type
    AWSResponse CreateProjectVersion =
      CreateProjectVersionResponse
  request :: CreateProjectVersion -> Request CreateProjectVersion
request = Service -> CreateProjectVersion -> Request CreateProjectVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateProjectVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateProjectVersion)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateProjectVersion))
-> Logger
-> Service
-> Proxy CreateProjectVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateProjectVersion)))
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 ->
          Maybe Text -> Int -> CreateProjectVersionResponse
CreateProjectVersionResponse'
            (Maybe Text -> Int -> CreateProjectVersionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateProjectVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProjectVersionArn")
            Either String (Int -> CreateProjectVersionResponse)
-> Either String Int -> Either String CreateProjectVersionResponse
forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable CreateProjectVersion

instance Prelude.NFData CreateProjectVersion

instance Core.ToHeaders CreateProjectVersion where
  toHeaders :: CreateProjectVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateProjectVersion -> 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
"RekognitionService.CreateProjectVersion" ::
                          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 CreateProjectVersion where
  toJSON :: CreateProjectVersion -> Value
toJSON CreateProjectVersion' {Maybe Text
Maybe (HashMap Text Text)
Text
OutputConfig
TestingData
TrainingData
testingData :: TestingData
trainingData :: TrainingData
outputConfig :: OutputConfig
versionName :: Text
projectArn :: Text
tags :: Maybe (HashMap Text Text)
kmsKeyId :: Maybe Text
$sel:testingData:CreateProjectVersion' :: CreateProjectVersion -> TestingData
$sel:trainingData:CreateProjectVersion' :: CreateProjectVersion -> TrainingData
$sel:outputConfig:CreateProjectVersion' :: CreateProjectVersion -> OutputConfig
$sel:versionName:CreateProjectVersion' :: CreateProjectVersion -> Text
$sel:projectArn:CreateProjectVersion' :: CreateProjectVersion -> Text
$sel:tags:CreateProjectVersion' :: CreateProjectVersion -> Maybe (HashMap Text Text)
$sel:kmsKeyId:CreateProjectVersion' :: CreateProjectVersion -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"KmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProjectArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
projectArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VersionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
versionName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"OutputConfig" Text -> OutputConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= OutputConfig
outputConfig),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TrainingData" Text -> TrainingData -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TrainingData
trainingData),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TestingData" Text -> TestingData -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TestingData
testingData)
          ]
      )

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

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

-- | /See:/ 'newCreateProjectVersionResponse' smart constructor.
data CreateProjectVersionResponse = CreateProjectVersionResponse'
  { -- | The ARN of the model version that was created. Use
    -- @DescribeProjectVersion@ to get the current status of the training
    -- operation.
    CreateProjectVersionResponse -> Maybe Text
projectVersionArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateProjectVersionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateProjectVersionResponse
-> CreateProjectVersionResponse -> Bool
(CreateProjectVersionResponse
 -> CreateProjectVersionResponse -> Bool)
-> (CreateProjectVersionResponse
    -> CreateProjectVersionResponse -> Bool)
-> Eq CreateProjectVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProjectVersionResponse
-> CreateProjectVersionResponse -> Bool
$c/= :: CreateProjectVersionResponse
-> CreateProjectVersionResponse -> Bool
== :: CreateProjectVersionResponse
-> CreateProjectVersionResponse -> Bool
$c== :: CreateProjectVersionResponse
-> CreateProjectVersionResponse -> Bool
Prelude.Eq, ReadPrec [CreateProjectVersionResponse]
ReadPrec CreateProjectVersionResponse
Int -> ReadS CreateProjectVersionResponse
ReadS [CreateProjectVersionResponse]
(Int -> ReadS CreateProjectVersionResponse)
-> ReadS [CreateProjectVersionResponse]
-> ReadPrec CreateProjectVersionResponse
-> ReadPrec [CreateProjectVersionResponse]
-> Read CreateProjectVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProjectVersionResponse]
$creadListPrec :: ReadPrec [CreateProjectVersionResponse]
readPrec :: ReadPrec CreateProjectVersionResponse
$creadPrec :: ReadPrec CreateProjectVersionResponse
readList :: ReadS [CreateProjectVersionResponse]
$creadList :: ReadS [CreateProjectVersionResponse]
readsPrec :: Int -> ReadS CreateProjectVersionResponse
$creadsPrec :: Int -> ReadS CreateProjectVersionResponse
Prelude.Read, Int -> CreateProjectVersionResponse -> ShowS
[CreateProjectVersionResponse] -> ShowS
CreateProjectVersionResponse -> String
(Int -> CreateProjectVersionResponse -> ShowS)
-> (CreateProjectVersionResponse -> String)
-> ([CreateProjectVersionResponse] -> ShowS)
-> Show CreateProjectVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProjectVersionResponse] -> ShowS
$cshowList :: [CreateProjectVersionResponse] -> ShowS
show :: CreateProjectVersionResponse -> String
$cshow :: CreateProjectVersionResponse -> String
showsPrec :: Int -> CreateProjectVersionResponse -> ShowS
$cshowsPrec :: Int -> CreateProjectVersionResponse -> ShowS
Prelude.Show, (forall x.
 CreateProjectVersionResponse -> Rep CreateProjectVersionResponse x)
-> (forall x.
    Rep CreateProjectVersionResponse x -> CreateProjectVersionResponse)
-> Generic CreateProjectVersionResponse
forall x.
Rep CreateProjectVersionResponse x -> CreateProjectVersionResponse
forall x.
CreateProjectVersionResponse -> Rep CreateProjectVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateProjectVersionResponse x -> CreateProjectVersionResponse
$cfrom :: forall x.
CreateProjectVersionResponse -> Rep CreateProjectVersionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateProjectVersionResponse' 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:
--
-- 'projectVersionArn', 'createProjectVersionResponse_projectVersionArn' - The ARN of the model version that was created. Use
-- @DescribeProjectVersion@ to get the current status of the training
-- operation.
--
-- 'httpStatus', 'createProjectVersionResponse_httpStatus' - The response's http status code.
newCreateProjectVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateProjectVersionResponse
newCreateProjectVersionResponse :: Int -> CreateProjectVersionResponse
newCreateProjectVersionResponse Int
pHttpStatus_ =
  CreateProjectVersionResponse' :: Maybe Text -> Int -> CreateProjectVersionResponse
CreateProjectVersionResponse'
    { $sel:projectVersionArn:CreateProjectVersionResponse' :: Maybe Text
projectVersionArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateProjectVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the model version that was created. Use
-- @DescribeProjectVersion@ to get the current status of the training
-- operation.
createProjectVersionResponse_projectVersionArn :: Lens.Lens' CreateProjectVersionResponse (Prelude.Maybe Prelude.Text)
createProjectVersionResponse_projectVersionArn :: (Maybe Text -> f (Maybe Text))
-> CreateProjectVersionResponse -> f CreateProjectVersionResponse
createProjectVersionResponse_projectVersionArn = (CreateProjectVersionResponse -> Maybe Text)
-> (CreateProjectVersionResponse
    -> Maybe Text -> CreateProjectVersionResponse)
-> Lens
     CreateProjectVersionResponse
     CreateProjectVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProjectVersionResponse' {Maybe Text
projectVersionArn :: Maybe Text
$sel:projectVersionArn:CreateProjectVersionResponse' :: CreateProjectVersionResponse -> Maybe Text
projectVersionArn} -> Maybe Text
projectVersionArn) (\s :: CreateProjectVersionResponse
s@CreateProjectVersionResponse' {} Maybe Text
a -> CreateProjectVersionResponse
s {$sel:projectVersionArn:CreateProjectVersionResponse' :: Maybe Text
projectVersionArn = Maybe Text
a} :: CreateProjectVersionResponse)

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

instance Prelude.NFData CreateProjectVersionResponse