{-# 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.FraudDetector.CreateModelVersion
-- 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 version of the model using the specified model type and model
-- id.
module Amazonka.FraudDetector.CreateModelVersion
  ( -- * Creating a Request
    CreateModelVersion (..),
    newCreateModelVersion,

    -- * Request Lenses
    createModelVersion_externalEventsDetail,
    createModelVersion_ingestedEventsDetail,
    createModelVersion_tags,
    createModelVersion_modelId,
    createModelVersion_modelType,
    createModelVersion_trainingDataSource,
    createModelVersion_trainingDataSchema,

    -- * Destructuring the Response
    CreateModelVersionResponse (..),
    newCreateModelVersionResponse,

    -- * Response Lenses
    createModelVersionResponse_status,
    createModelVersionResponse_modelType,
    createModelVersionResponse_modelId,
    createModelVersionResponse_modelVersionNumber,
    createModelVersionResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateModelVersion' smart constructor.
data CreateModelVersion = CreateModelVersion'
  { -- | Details of the external events data used for model version training.
    -- Required if @trainingDataSource@ is @EXTERNAL_EVENTS@.
    CreateModelVersion -> Maybe ExternalEventsDetail
externalEventsDetail :: Prelude.Maybe ExternalEventsDetail,
    -- | Details of the ingested events data used for model version training.
    -- Required if @trainingDataSource@ is @INGESTED_EVENTS@.
    CreateModelVersion -> Maybe IngestedEventsDetail
ingestedEventsDetail :: Prelude.Maybe IngestedEventsDetail,
    -- | A collection of key and value pairs.
    CreateModelVersion -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The model ID.
    CreateModelVersion -> Text
modelId :: Prelude.Text,
    -- | The model type.
    CreateModelVersion -> ModelTypeEnum
modelType :: ModelTypeEnum,
    -- | The training data source location in Amazon S3.
    CreateModelVersion -> TrainingDataSourceEnum
trainingDataSource :: TrainingDataSourceEnum,
    -- | The training data schema.
    CreateModelVersion -> TrainingDataSchema
trainingDataSchema :: TrainingDataSchema
  }
  deriving (CreateModelVersion -> CreateModelVersion -> Bool
(CreateModelVersion -> CreateModelVersion -> Bool)
-> (CreateModelVersion -> CreateModelVersion -> Bool)
-> Eq CreateModelVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateModelVersion -> CreateModelVersion -> Bool
$c/= :: CreateModelVersion -> CreateModelVersion -> Bool
== :: CreateModelVersion -> CreateModelVersion -> Bool
$c== :: CreateModelVersion -> CreateModelVersion -> Bool
Prelude.Eq, ReadPrec [CreateModelVersion]
ReadPrec CreateModelVersion
Int -> ReadS CreateModelVersion
ReadS [CreateModelVersion]
(Int -> ReadS CreateModelVersion)
-> ReadS [CreateModelVersion]
-> ReadPrec CreateModelVersion
-> ReadPrec [CreateModelVersion]
-> Read CreateModelVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateModelVersion]
$creadListPrec :: ReadPrec [CreateModelVersion]
readPrec :: ReadPrec CreateModelVersion
$creadPrec :: ReadPrec CreateModelVersion
readList :: ReadS [CreateModelVersion]
$creadList :: ReadS [CreateModelVersion]
readsPrec :: Int -> ReadS CreateModelVersion
$creadsPrec :: Int -> ReadS CreateModelVersion
Prelude.Read, Int -> CreateModelVersion -> ShowS
[CreateModelVersion] -> ShowS
CreateModelVersion -> String
(Int -> CreateModelVersion -> ShowS)
-> (CreateModelVersion -> String)
-> ([CreateModelVersion] -> ShowS)
-> Show CreateModelVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateModelVersion] -> ShowS
$cshowList :: [CreateModelVersion] -> ShowS
show :: CreateModelVersion -> String
$cshow :: CreateModelVersion -> String
showsPrec :: Int -> CreateModelVersion -> ShowS
$cshowsPrec :: Int -> CreateModelVersion -> ShowS
Prelude.Show, (forall x. CreateModelVersion -> Rep CreateModelVersion x)
-> (forall x. Rep CreateModelVersion x -> CreateModelVersion)
-> Generic CreateModelVersion
forall x. Rep CreateModelVersion x -> CreateModelVersion
forall x. CreateModelVersion -> Rep CreateModelVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateModelVersion x -> CreateModelVersion
$cfrom :: forall x. CreateModelVersion -> Rep CreateModelVersion x
Prelude.Generic)

-- |
-- Create a value of 'CreateModelVersion' 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:
--
-- 'externalEventsDetail', 'createModelVersion_externalEventsDetail' - Details of the external events data used for model version training.
-- Required if @trainingDataSource@ is @EXTERNAL_EVENTS@.
--
-- 'ingestedEventsDetail', 'createModelVersion_ingestedEventsDetail' - Details of the ingested events data used for model version training.
-- Required if @trainingDataSource@ is @INGESTED_EVENTS@.
--
-- 'tags', 'createModelVersion_tags' - A collection of key and value pairs.
--
-- 'modelId', 'createModelVersion_modelId' - The model ID.
--
-- 'modelType', 'createModelVersion_modelType' - The model type.
--
-- 'trainingDataSource', 'createModelVersion_trainingDataSource' - The training data source location in Amazon S3.
--
-- 'trainingDataSchema', 'createModelVersion_trainingDataSchema' - The training data schema.
newCreateModelVersion ::
  -- | 'modelId'
  Prelude.Text ->
  -- | 'modelType'
  ModelTypeEnum ->
  -- | 'trainingDataSource'
  TrainingDataSourceEnum ->
  -- | 'trainingDataSchema'
  TrainingDataSchema ->
  CreateModelVersion
newCreateModelVersion :: Text
-> ModelTypeEnum
-> TrainingDataSourceEnum
-> TrainingDataSchema
-> CreateModelVersion
newCreateModelVersion
  Text
pModelId_
  ModelTypeEnum
pModelType_
  TrainingDataSourceEnum
pTrainingDataSource_
  TrainingDataSchema
pTrainingDataSchema_ =
    CreateModelVersion' :: Maybe ExternalEventsDetail
-> Maybe IngestedEventsDetail
-> Maybe [Tag]
-> Text
-> ModelTypeEnum
-> TrainingDataSourceEnum
-> TrainingDataSchema
-> CreateModelVersion
CreateModelVersion'
      { $sel:externalEventsDetail:CreateModelVersion' :: Maybe ExternalEventsDetail
externalEventsDetail =
          Maybe ExternalEventsDetail
forall a. Maybe a
Prelude.Nothing,
        $sel:ingestedEventsDetail:CreateModelVersion' :: Maybe IngestedEventsDetail
ingestedEventsDetail = Maybe IngestedEventsDetail
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateModelVersion' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:modelId:CreateModelVersion' :: Text
modelId = Text
pModelId_,
        $sel:modelType:CreateModelVersion' :: ModelTypeEnum
modelType = ModelTypeEnum
pModelType_,
        $sel:trainingDataSource:CreateModelVersion' :: TrainingDataSourceEnum
trainingDataSource = TrainingDataSourceEnum
pTrainingDataSource_,
        $sel:trainingDataSchema:CreateModelVersion' :: TrainingDataSchema
trainingDataSchema = TrainingDataSchema
pTrainingDataSchema_
      }

-- | Details of the external events data used for model version training.
-- Required if @trainingDataSource@ is @EXTERNAL_EVENTS@.
createModelVersion_externalEventsDetail :: Lens.Lens' CreateModelVersion (Prelude.Maybe ExternalEventsDetail)
createModelVersion_externalEventsDetail :: (Maybe ExternalEventsDetail -> f (Maybe ExternalEventsDetail))
-> CreateModelVersion -> f CreateModelVersion
createModelVersion_externalEventsDetail = (CreateModelVersion -> Maybe ExternalEventsDetail)
-> (CreateModelVersion
    -> Maybe ExternalEventsDetail -> CreateModelVersion)
-> Lens
     CreateModelVersion
     CreateModelVersion
     (Maybe ExternalEventsDetail)
     (Maybe ExternalEventsDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersion' {Maybe ExternalEventsDetail
externalEventsDetail :: Maybe ExternalEventsDetail
$sel:externalEventsDetail:CreateModelVersion' :: CreateModelVersion -> Maybe ExternalEventsDetail
externalEventsDetail} -> Maybe ExternalEventsDetail
externalEventsDetail) (\s :: CreateModelVersion
s@CreateModelVersion' {} Maybe ExternalEventsDetail
a -> CreateModelVersion
s {$sel:externalEventsDetail:CreateModelVersion' :: Maybe ExternalEventsDetail
externalEventsDetail = Maybe ExternalEventsDetail
a} :: CreateModelVersion)

-- | Details of the ingested events data used for model version training.
-- Required if @trainingDataSource@ is @INGESTED_EVENTS@.
createModelVersion_ingestedEventsDetail :: Lens.Lens' CreateModelVersion (Prelude.Maybe IngestedEventsDetail)
createModelVersion_ingestedEventsDetail :: (Maybe IngestedEventsDetail -> f (Maybe IngestedEventsDetail))
-> CreateModelVersion -> f CreateModelVersion
createModelVersion_ingestedEventsDetail = (CreateModelVersion -> Maybe IngestedEventsDetail)
-> (CreateModelVersion
    -> Maybe IngestedEventsDetail -> CreateModelVersion)
-> Lens
     CreateModelVersion
     CreateModelVersion
     (Maybe IngestedEventsDetail)
     (Maybe IngestedEventsDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersion' {Maybe IngestedEventsDetail
ingestedEventsDetail :: Maybe IngestedEventsDetail
$sel:ingestedEventsDetail:CreateModelVersion' :: CreateModelVersion -> Maybe IngestedEventsDetail
ingestedEventsDetail} -> Maybe IngestedEventsDetail
ingestedEventsDetail) (\s :: CreateModelVersion
s@CreateModelVersion' {} Maybe IngestedEventsDetail
a -> CreateModelVersion
s {$sel:ingestedEventsDetail:CreateModelVersion' :: Maybe IngestedEventsDetail
ingestedEventsDetail = Maybe IngestedEventsDetail
a} :: CreateModelVersion)

-- | A collection of key and value pairs.
createModelVersion_tags :: Lens.Lens' CreateModelVersion (Prelude.Maybe [Tag])
createModelVersion_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateModelVersion -> f CreateModelVersion
createModelVersion_tags = (CreateModelVersion -> Maybe [Tag])
-> (CreateModelVersion -> Maybe [Tag] -> CreateModelVersion)
-> Lens
     CreateModelVersion CreateModelVersion (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersion' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateModelVersion' :: CreateModelVersion -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateModelVersion
s@CreateModelVersion' {} Maybe [Tag]
a -> CreateModelVersion
s {$sel:tags:CreateModelVersion' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateModelVersion) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateModelVersion -> f CreateModelVersion)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateModelVersion
-> f CreateModelVersion
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 model ID.
createModelVersion_modelId :: Lens.Lens' CreateModelVersion Prelude.Text
createModelVersion_modelId :: (Text -> f Text) -> CreateModelVersion -> f CreateModelVersion
createModelVersion_modelId = (CreateModelVersion -> Text)
-> (CreateModelVersion -> Text -> CreateModelVersion)
-> Lens CreateModelVersion CreateModelVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersion' {Text
modelId :: Text
$sel:modelId:CreateModelVersion' :: CreateModelVersion -> Text
modelId} -> Text
modelId) (\s :: CreateModelVersion
s@CreateModelVersion' {} Text
a -> CreateModelVersion
s {$sel:modelId:CreateModelVersion' :: Text
modelId = Text
a} :: CreateModelVersion)

-- | The model type.
createModelVersion_modelType :: Lens.Lens' CreateModelVersion ModelTypeEnum
createModelVersion_modelType :: (ModelTypeEnum -> f ModelTypeEnum)
-> CreateModelVersion -> f CreateModelVersion
createModelVersion_modelType = (CreateModelVersion -> ModelTypeEnum)
-> (CreateModelVersion -> ModelTypeEnum -> CreateModelVersion)
-> Lens
     CreateModelVersion CreateModelVersion ModelTypeEnum ModelTypeEnum
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersion' {ModelTypeEnum
modelType :: ModelTypeEnum
$sel:modelType:CreateModelVersion' :: CreateModelVersion -> ModelTypeEnum
modelType} -> ModelTypeEnum
modelType) (\s :: CreateModelVersion
s@CreateModelVersion' {} ModelTypeEnum
a -> CreateModelVersion
s {$sel:modelType:CreateModelVersion' :: ModelTypeEnum
modelType = ModelTypeEnum
a} :: CreateModelVersion)

-- | The training data source location in Amazon S3.
createModelVersion_trainingDataSource :: Lens.Lens' CreateModelVersion TrainingDataSourceEnum
createModelVersion_trainingDataSource :: (TrainingDataSourceEnum -> f TrainingDataSourceEnum)
-> CreateModelVersion -> f CreateModelVersion
createModelVersion_trainingDataSource = (CreateModelVersion -> TrainingDataSourceEnum)
-> (CreateModelVersion
    -> TrainingDataSourceEnum -> CreateModelVersion)
-> Lens
     CreateModelVersion
     CreateModelVersion
     TrainingDataSourceEnum
     TrainingDataSourceEnum
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersion' {TrainingDataSourceEnum
trainingDataSource :: TrainingDataSourceEnum
$sel:trainingDataSource:CreateModelVersion' :: CreateModelVersion -> TrainingDataSourceEnum
trainingDataSource} -> TrainingDataSourceEnum
trainingDataSource) (\s :: CreateModelVersion
s@CreateModelVersion' {} TrainingDataSourceEnum
a -> CreateModelVersion
s {$sel:trainingDataSource:CreateModelVersion' :: TrainingDataSourceEnum
trainingDataSource = TrainingDataSourceEnum
a} :: CreateModelVersion)

-- | The training data schema.
createModelVersion_trainingDataSchema :: Lens.Lens' CreateModelVersion TrainingDataSchema
createModelVersion_trainingDataSchema :: (TrainingDataSchema -> f TrainingDataSchema)
-> CreateModelVersion -> f CreateModelVersion
createModelVersion_trainingDataSchema = (CreateModelVersion -> TrainingDataSchema)
-> (CreateModelVersion -> TrainingDataSchema -> CreateModelVersion)
-> Lens
     CreateModelVersion
     CreateModelVersion
     TrainingDataSchema
     TrainingDataSchema
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersion' {TrainingDataSchema
trainingDataSchema :: TrainingDataSchema
$sel:trainingDataSchema:CreateModelVersion' :: CreateModelVersion -> TrainingDataSchema
trainingDataSchema} -> TrainingDataSchema
trainingDataSchema) (\s :: CreateModelVersion
s@CreateModelVersion' {} TrainingDataSchema
a -> CreateModelVersion
s {$sel:trainingDataSchema:CreateModelVersion' :: TrainingDataSchema
trainingDataSchema = TrainingDataSchema
a} :: CreateModelVersion)

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

instance Prelude.NFData CreateModelVersion

instance Core.ToHeaders CreateModelVersion where
  toHeaders :: CreateModelVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateModelVersion -> 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
"AWSHawksNestServiceFacade.CreateModelVersion" ::
                          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 CreateModelVersion where
  toJSON :: CreateModelVersion -> Value
toJSON CreateModelVersion' {Maybe [Tag]
Maybe ExternalEventsDetail
Maybe IngestedEventsDetail
Text
ModelTypeEnum
TrainingDataSourceEnum
TrainingDataSchema
trainingDataSchema :: TrainingDataSchema
trainingDataSource :: TrainingDataSourceEnum
modelType :: ModelTypeEnum
modelId :: Text
tags :: Maybe [Tag]
ingestedEventsDetail :: Maybe IngestedEventsDetail
externalEventsDetail :: Maybe ExternalEventsDetail
$sel:trainingDataSchema:CreateModelVersion' :: CreateModelVersion -> TrainingDataSchema
$sel:trainingDataSource:CreateModelVersion' :: CreateModelVersion -> TrainingDataSourceEnum
$sel:modelType:CreateModelVersion' :: CreateModelVersion -> ModelTypeEnum
$sel:modelId:CreateModelVersion' :: CreateModelVersion -> Text
$sel:tags:CreateModelVersion' :: CreateModelVersion -> Maybe [Tag]
$sel:ingestedEventsDetail:CreateModelVersion' :: CreateModelVersion -> Maybe IngestedEventsDetail
$sel:externalEventsDetail:CreateModelVersion' :: CreateModelVersion -> Maybe ExternalEventsDetail
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"externalEventsDetail" Text -> ExternalEventsDetail -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ExternalEventsDetail -> Pair)
-> Maybe ExternalEventsDetail -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExternalEventsDetail
externalEventsDetail,
            (Text
"ingestedEventsDetail" Text -> IngestedEventsDetail -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (IngestedEventsDetail -> Pair)
-> Maybe IngestedEventsDetail -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IngestedEventsDetail
ingestedEventsDetail,
            (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
"modelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
modelId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"modelType" Text -> ModelTypeEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ModelTypeEnum
modelType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"trainingDataSource" Text -> TrainingDataSourceEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TrainingDataSourceEnum
trainingDataSource),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"trainingDataSchema" Text -> TrainingDataSchema -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TrainingDataSchema
trainingDataSchema)
          ]
      )

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

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

-- | /See:/ 'newCreateModelVersionResponse' smart constructor.
data CreateModelVersionResponse = CreateModelVersionResponse'
  { -- | The model version status.
    CreateModelVersionResponse -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The model type.
    CreateModelVersionResponse -> Maybe ModelTypeEnum
modelType :: Prelude.Maybe ModelTypeEnum,
    -- | The model ID.
    CreateModelVersionResponse -> Maybe Text
modelId :: Prelude.Maybe Prelude.Text,
    -- | The model version number of the model version created.
    CreateModelVersionResponse -> Maybe Text
modelVersionNumber :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateModelVersionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateModelVersionResponse -> CreateModelVersionResponse -> Bool
(CreateModelVersionResponse -> CreateModelVersionResponse -> Bool)
-> (CreateModelVersionResponse
    -> CreateModelVersionResponse -> Bool)
-> Eq CreateModelVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateModelVersionResponse -> CreateModelVersionResponse -> Bool
$c/= :: CreateModelVersionResponse -> CreateModelVersionResponse -> Bool
== :: CreateModelVersionResponse -> CreateModelVersionResponse -> Bool
$c== :: CreateModelVersionResponse -> CreateModelVersionResponse -> Bool
Prelude.Eq, ReadPrec [CreateModelVersionResponse]
ReadPrec CreateModelVersionResponse
Int -> ReadS CreateModelVersionResponse
ReadS [CreateModelVersionResponse]
(Int -> ReadS CreateModelVersionResponse)
-> ReadS [CreateModelVersionResponse]
-> ReadPrec CreateModelVersionResponse
-> ReadPrec [CreateModelVersionResponse]
-> Read CreateModelVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateModelVersionResponse]
$creadListPrec :: ReadPrec [CreateModelVersionResponse]
readPrec :: ReadPrec CreateModelVersionResponse
$creadPrec :: ReadPrec CreateModelVersionResponse
readList :: ReadS [CreateModelVersionResponse]
$creadList :: ReadS [CreateModelVersionResponse]
readsPrec :: Int -> ReadS CreateModelVersionResponse
$creadsPrec :: Int -> ReadS CreateModelVersionResponse
Prelude.Read, Int -> CreateModelVersionResponse -> ShowS
[CreateModelVersionResponse] -> ShowS
CreateModelVersionResponse -> String
(Int -> CreateModelVersionResponse -> ShowS)
-> (CreateModelVersionResponse -> String)
-> ([CreateModelVersionResponse] -> ShowS)
-> Show CreateModelVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateModelVersionResponse] -> ShowS
$cshowList :: [CreateModelVersionResponse] -> ShowS
show :: CreateModelVersionResponse -> String
$cshow :: CreateModelVersionResponse -> String
showsPrec :: Int -> CreateModelVersionResponse -> ShowS
$cshowsPrec :: Int -> CreateModelVersionResponse -> ShowS
Prelude.Show, (forall x.
 CreateModelVersionResponse -> Rep CreateModelVersionResponse x)
-> (forall x.
    Rep CreateModelVersionResponse x -> CreateModelVersionResponse)
-> Generic CreateModelVersionResponse
forall x.
Rep CreateModelVersionResponse x -> CreateModelVersionResponse
forall x.
CreateModelVersionResponse -> Rep CreateModelVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateModelVersionResponse x -> CreateModelVersionResponse
$cfrom :: forall x.
CreateModelVersionResponse -> Rep CreateModelVersionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateModelVersionResponse' 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:
--
-- 'status', 'createModelVersionResponse_status' - The model version status.
--
-- 'modelType', 'createModelVersionResponse_modelType' - The model type.
--
-- 'modelId', 'createModelVersionResponse_modelId' - The model ID.
--
-- 'modelVersionNumber', 'createModelVersionResponse_modelVersionNumber' - The model version number of the model version created.
--
-- 'httpStatus', 'createModelVersionResponse_httpStatus' - The response's http status code.
newCreateModelVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateModelVersionResponse
newCreateModelVersionResponse :: Int -> CreateModelVersionResponse
newCreateModelVersionResponse Int
pHttpStatus_ =
  CreateModelVersionResponse' :: Maybe Text
-> Maybe ModelTypeEnum
-> Maybe Text
-> Maybe Text
-> Int
-> CreateModelVersionResponse
CreateModelVersionResponse'
    { $sel:status:CreateModelVersionResponse' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:modelType:CreateModelVersionResponse' :: Maybe ModelTypeEnum
modelType = Maybe ModelTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:modelId:CreateModelVersionResponse' :: Maybe Text
modelId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:modelVersionNumber:CreateModelVersionResponse' :: Maybe Text
modelVersionNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateModelVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The model version status.
createModelVersionResponse_status :: Lens.Lens' CreateModelVersionResponse (Prelude.Maybe Prelude.Text)
createModelVersionResponse_status :: (Maybe Text -> f (Maybe Text))
-> CreateModelVersionResponse -> f CreateModelVersionResponse
createModelVersionResponse_status = (CreateModelVersionResponse -> Maybe Text)
-> (CreateModelVersionResponse
    -> Maybe Text -> CreateModelVersionResponse)
-> Lens
     CreateModelVersionResponse
     CreateModelVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersionResponse' {Maybe Text
status :: Maybe Text
$sel:status:CreateModelVersionResponse' :: CreateModelVersionResponse -> Maybe Text
status} -> Maybe Text
status) (\s :: CreateModelVersionResponse
s@CreateModelVersionResponse' {} Maybe Text
a -> CreateModelVersionResponse
s {$sel:status:CreateModelVersionResponse' :: Maybe Text
status = Maybe Text
a} :: CreateModelVersionResponse)

-- | The model type.
createModelVersionResponse_modelType :: Lens.Lens' CreateModelVersionResponse (Prelude.Maybe ModelTypeEnum)
createModelVersionResponse_modelType :: (Maybe ModelTypeEnum -> f (Maybe ModelTypeEnum))
-> CreateModelVersionResponse -> f CreateModelVersionResponse
createModelVersionResponse_modelType = (CreateModelVersionResponse -> Maybe ModelTypeEnum)
-> (CreateModelVersionResponse
    -> Maybe ModelTypeEnum -> CreateModelVersionResponse)
-> Lens
     CreateModelVersionResponse
     CreateModelVersionResponse
     (Maybe ModelTypeEnum)
     (Maybe ModelTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersionResponse' {Maybe ModelTypeEnum
modelType :: Maybe ModelTypeEnum
$sel:modelType:CreateModelVersionResponse' :: CreateModelVersionResponse -> Maybe ModelTypeEnum
modelType} -> Maybe ModelTypeEnum
modelType) (\s :: CreateModelVersionResponse
s@CreateModelVersionResponse' {} Maybe ModelTypeEnum
a -> CreateModelVersionResponse
s {$sel:modelType:CreateModelVersionResponse' :: Maybe ModelTypeEnum
modelType = Maybe ModelTypeEnum
a} :: CreateModelVersionResponse)

-- | The model ID.
createModelVersionResponse_modelId :: Lens.Lens' CreateModelVersionResponse (Prelude.Maybe Prelude.Text)
createModelVersionResponse_modelId :: (Maybe Text -> f (Maybe Text))
-> CreateModelVersionResponse -> f CreateModelVersionResponse
createModelVersionResponse_modelId = (CreateModelVersionResponse -> Maybe Text)
-> (CreateModelVersionResponse
    -> Maybe Text -> CreateModelVersionResponse)
-> Lens
     CreateModelVersionResponse
     CreateModelVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersionResponse' {Maybe Text
modelId :: Maybe Text
$sel:modelId:CreateModelVersionResponse' :: CreateModelVersionResponse -> Maybe Text
modelId} -> Maybe Text
modelId) (\s :: CreateModelVersionResponse
s@CreateModelVersionResponse' {} Maybe Text
a -> CreateModelVersionResponse
s {$sel:modelId:CreateModelVersionResponse' :: Maybe Text
modelId = Maybe Text
a} :: CreateModelVersionResponse)

-- | The model version number of the model version created.
createModelVersionResponse_modelVersionNumber :: Lens.Lens' CreateModelVersionResponse (Prelude.Maybe Prelude.Text)
createModelVersionResponse_modelVersionNumber :: (Maybe Text -> f (Maybe Text))
-> CreateModelVersionResponse -> f CreateModelVersionResponse
createModelVersionResponse_modelVersionNumber = (CreateModelVersionResponse -> Maybe Text)
-> (CreateModelVersionResponse
    -> Maybe Text -> CreateModelVersionResponse)
-> Lens
     CreateModelVersionResponse
     CreateModelVersionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateModelVersionResponse' {Maybe Text
modelVersionNumber :: Maybe Text
$sel:modelVersionNumber:CreateModelVersionResponse' :: CreateModelVersionResponse -> Maybe Text
modelVersionNumber} -> Maybe Text
modelVersionNumber) (\s :: CreateModelVersionResponse
s@CreateModelVersionResponse' {} Maybe Text
a -> CreateModelVersionResponse
s {$sel:modelVersionNumber:CreateModelVersionResponse' :: Maybe Text
modelVersionNumber = Maybe Text
a} :: CreateModelVersionResponse)

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

instance Prelude.NFData CreateModelVersionResponse