{-# 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.CreateDetectorVersion
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a detector version. The detector version starts in a @DRAFT@
-- status.
module Amazonka.FraudDetector.CreateDetectorVersion
  ( -- * Creating a Request
    CreateDetectorVersion (..),
    newCreateDetectorVersion,

    -- * Request Lenses
    createDetectorVersion_description,
    createDetectorVersion_externalModelEndpoints,
    createDetectorVersion_modelVersions,
    createDetectorVersion_ruleExecutionMode,
    createDetectorVersion_tags,
    createDetectorVersion_detectorId,
    createDetectorVersion_rules,

    -- * Destructuring the Response
    CreateDetectorVersionResponse (..),
    newCreateDetectorVersionResponse,

    -- * Response Lenses
    createDetectorVersionResponse_detectorId,
    createDetectorVersionResponse_detectorVersionId,
    createDetectorVersionResponse_status,
    createDetectorVersionResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateDetectorVersion' smart constructor.
data CreateDetectorVersion = CreateDetectorVersion'
  { -- | The description of the detector version.
    CreateDetectorVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Sagemaker model endpoints to include in the detector version.
    CreateDetectorVersion -> Maybe [Text]
externalModelEndpoints :: Prelude.Maybe [Prelude.Text],
    -- | The model versions to include in the detector version.
    CreateDetectorVersion -> Maybe [ModelVersion]
modelVersions :: Prelude.Maybe [ModelVersion],
    -- | The rule execution mode for the rules included in the detector version.
    --
    -- You can define and edit the rule mode at the detector version level,
    -- when it is in draft status.
    --
    -- If you specify @FIRST_MATCHED@, Amazon Fraud Detector evaluates rules
    -- sequentially, first to last, stopping at the first matched rule. Amazon
    -- Fraud dectector then provides the outcomes for that single rule.
    --
    -- If you specifiy @ALL_MATCHED@, Amazon Fraud Detector evaluates all rules
    -- and returns the outcomes for all matched rules.
    --
    -- The default behavior is @FIRST_MATCHED@.
    CreateDetectorVersion -> Maybe RuleExecutionMode
ruleExecutionMode :: Prelude.Maybe RuleExecutionMode,
    -- | A collection of key and value pairs.
    CreateDetectorVersion -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The ID of the detector under which you want to create a new version.
    CreateDetectorVersion -> Text
detectorId :: Prelude.Text,
    -- | The rules to include in the detector version.
    CreateDetectorVersion -> [Rule]
rules :: [Rule]
  }
  deriving (CreateDetectorVersion -> CreateDetectorVersion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDetectorVersion -> CreateDetectorVersion -> Bool
$c/= :: CreateDetectorVersion -> CreateDetectorVersion -> Bool
== :: CreateDetectorVersion -> CreateDetectorVersion -> Bool
$c== :: CreateDetectorVersion -> CreateDetectorVersion -> Bool
Prelude.Eq, ReadPrec [CreateDetectorVersion]
ReadPrec CreateDetectorVersion
Int -> ReadS CreateDetectorVersion
ReadS [CreateDetectorVersion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDetectorVersion]
$creadListPrec :: ReadPrec [CreateDetectorVersion]
readPrec :: ReadPrec CreateDetectorVersion
$creadPrec :: ReadPrec CreateDetectorVersion
readList :: ReadS [CreateDetectorVersion]
$creadList :: ReadS [CreateDetectorVersion]
readsPrec :: Int -> ReadS CreateDetectorVersion
$creadsPrec :: Int -> ReadS CreateDetectorVersion
Prelude.Read, Int -> CreateDetectorVersion -> ShowS
[CreateDetectorVersion] -> ShowS
CreateDetectorVersion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDetectorVersion] -> ShowS
$cshowList :: [CreateDetectorVersion] -> ShowS
show :: CreateDetectorVersion -> String
$cshow :: CreateDetectorVersion -> String
showsPrec :: Int -> CreateDetectorVersion -> ShowS
$cshowsPrec :: Int -> CreateDetectorVersion -> ShowS
Prelude.Show, forall x. Rep CreateDetectorVersion x -> CreateDetectorVersion
forall x. CreateDetectorVersion -> Rep CreateDetectorVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDetectorVersion x -> CreateDetectorVersion
$cfrom :: forall x. CreateDetectorVersion -> Rep CreateDetectorVersion x
Prelude.Generic)

-- |
-- Create a value of 'CreateDetectorVersion' 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:
--
-- 'description', 'createDetectorVersion_description' - The description of the detector version.
--
-- 'externalModelEndpoints', 'createDetectorVersion_externalModelEndpoints' - The Amazon Sagemaker model endpoints to include in the detector version.
--
-- 'modelVersions', 'createDetectorVersion_modelVersions' - The model versions to include in the detector version.
--
-- 'ruleExecutionMode', 'createDetectorVersion_ruleExecutionMode' - The rule execution mode for the rules included in the detector version.
--
-- You can define and edit the rule mode at the detector version level,
-- when it is in draft status.
--
-- If you specify @FIRST_MATCHED@, Amazon Fraud Detector evaluates rules
-- sequentially, first to last, stopping at the first matched rule. Amazon
-- Fraud dectector then provides the outcomes for that single rule.
--
-- If you specifiy @ALL_MATCHED@, Amazon Fraud Detector evaluates all rules
-- and returns the outcomes for all matched rules.
--
-- The default behavior is @FIRST_MATCHED@.
--
-- 'tags', 'createDetectorVersion_tags' - A collection of key and value pairs.
--
-- 'detectorId', 'createDetectorVersion_detectorId' - The ID of the detector under which you want to create a new version.
--
-- 'rules', 'createDetectorVersion_rules' - The rules to include in the detector version.
newCreateDetectorVersion ::
  -- | 'detectorId'
  Prelude.Text ->
  CreateDetectorVersion
newCreateDetectorVersion :: Text -> CreateDetectorVersion
newCreateDetectorVersion Text
pDetectorId_ =
  CreateDetectorVersion'
    { $sel:description:CreateDetectorVersion' :: Maybe Text
description =
        forall a. Maybe a
Prelude.Nothing,
      $sel:externalModelEndpoints:CreateDetectorVersion' :: Maybe [Text]
externalModelEndpoints = forall a. Maybe a
Prelude.Nothing,
      $sel:modelVersions:CreateDetectorVersion' :: Maybe [ModelVersion]
modelVersions = forall a. Maybe a
Prelude.Nothing,
      $sel:ruleExecutionMode:CreateDetectorVersion' :: Maybe RuleExecutionMode
ruleExecutionMode = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateDetectorVersion' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:detectorId:CreateDetectorVersion' :: Text
detectorId = Text
pDetectorId_,
      $sel:rules:CreateDetectorVersion' :: [Rule]
rules = forall a. Monoid a => a
Prelude.mempty
    }

-- | The description of the detector version.
createDetectorVersion_description :: Lens.Lens' CreateDetectorVersion (Prelude.Maybe Prelude.Text)
createDetectorVersion_description :: Lens' CreateDetectorVersion (Maybe Text)
createDetectorVersion_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersion' {Maybe Text
description :: Maybe Text
$sel:description:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateDetectorVersion
s@CreateDetectorVersion' {} Maybe Text
a -> CreateDetectorVersion
s {$sel:description:CreateDetectorVersion' :: Maybe Text
description = Maybe Text
a} :: CreateDetectorVersion)

-- | The Amazon Sagemaker model endpoints to include in the detector version.
createDetectorVersion_externalModelEndpoints :: Lens.Lens' CreateDetectorVersion (Prelude.Maybe [Prelude.Text])
createDetectorVersion_externalModelEndpoints :: Lens' CreateDetectorVersion (Maybe [Text])
createDetectorVersion_externalModelEndpoints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersion' {Maybe [Text]
externalModelEndpoints :: Maybe [Text]
$sel:externalModelEndpoints:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [Text]
externalModelEndpoints} -> Maybe [Text]
externalModelEndpoints) (\s :: CreateDetectorVersion
s@CreateDetectorVersion' {} Maybe [Text]
a -> CreateDetectorVersion
s {$sel:externalModelEndpoints:CreateDetectorVersion' :: Maybe [Text]
externalModelEndpoints = Maybe [Text]
a} :: CreateDetectorVersion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The model versions to include in the detector version.
createDetectorVersion_modelVersions :: Lens.Lens' CreateDetectorVersion (Prelude.Maybe [ModelVersion])
createDetectorVersion_modelVersions :: Lens' CreateDetectorVersion (Maybe [ModelVersion])
createDetectorVersion_modelVersions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersion' {Maybe [ModelVersion]
modelVersions :: Maybe [ModelVersion]
$sel:modelVersions:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [ModelVersion]
modelVersions} -> Maybe [ModelVersion]
modelVersions) (\s :: CreateDetectorVersion
s@CreateDetectorVersion' {} Maybe [ModelVersion]
a -> CreateDetectorVersion
s {$sel:modelVersions:CreateDetectorVersion' :: Maybe [ModelVersion]
modelVersions = Maybe [ModelVersion]
a} :: CreateDetectorVersion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The rule execution mode for the rules included in the detector version.
--
-- You can define and edit the rule mode at the detector version level,
-- when it is in draft status.
--
-- If you specify @FIRST_MATCHED@, Amazon Fraud Detector evaluates rules
-- sequentially, first to last, stopping at the first matched rule. Amazon
-- Fraud dectector then provides the outcomes for that single rule.
--
-- If you specifiy @ALL_MATCHED@, Amazon Fraud Detector evaluates all rules
-- and returns the outcomes for all matched rules.
--
-- The default behavior is @FIRST_MATCHED@.
createDetectorVersion_ruleExecutionMode :: Lens.Lens' CreateDetectorVersion (Prelude.Maybe RuleExecutionMode)
createDetectorVersion_ruleExecutionMode :: Lens' CreateDetectorVersion (Maybe RuleExecutionMode)
createDetectorVersion_ruleExecutionMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersion' {Maybe RuleExecutionMode
ruleExecutionMode :: Maybe RuleExecutionMode
$sel:ruleExecutionMode:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe RuleExecutionMode
ruleExecutionMode} -> Maybe RuleExecutionMode
ruleExecutionMode) (\s :: CreateDetectorVersion
s@CreateDetectorVersion' {} Maybe RuleExecutionMode
a -> CreateDetectorVersion
s {$sel:ruleExecutionMode:CreateDetectorVersion' :: Maybe RuleExecutionMode
ruleExecutionMode = Maybe RuleExecutionMode
a} :: CreateDetectorVersion)

-- | A collection of key and value pairs.
createDetectorVersion_tags :: Lens.Lens' CreateDetectorVersion (Prelude.Maybe [Tag])
createDetectorVersion_tags :: Lens' CreateDetectorVersion (Maybe [Tag])
createDetectorVersion_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersion' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDetectorVersion
s@CreateDetectorVersion' {} Maybe [Tag]
a -> CreateDetectorVersion
s {$sel:tags:CreateDetectorVersion' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDetectorVersion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the detector under which you want to create a new version.
createDetectorVersion_detectorId :: Lens.Lens' CreateDetectorVersion Prelude.Text
createDetectorVersion_detectorId :: Lens' CreateDetectorVersion Text
createDetectorVersion_detectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersion' {Text
detectorId :: Text
$sel:detectorId:CreateDetectorVersion' :: CreateDetectorVersion -> Text
detectorId} -> Text
detectorId) (\s :: CreateDetectorVersion
s@CreateDetectorVersion' {} Text
a -> CreateDetectorVersion
s {$sel:detectorId:CreateDetectorVersion' :: Text
detectorId = Text
a} :: CreateDetectorVersion)

-- | The rules to include in the detector version.
createDetectorVersion_rules :: Lens.Lens' CreateDetectorVersion [Rule]
createDetectorVersion_rules :: Lens' CreateDetectorVersion [Rule]
createDetectorVersion_rules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersion' {[Rule]
rules :: [Rule]
$sel:rules:CreateDetectorVersion' :: CreateDetectorVersion -> [Rule]
rules} -> [Rule]
rules) (\s :: CreateDetectorVersion
s@CreateDetectorVersion' {} [Rule]
a -> CreateDetectorVersion
s {$sel:rules:CreateDetectorVersion' :: [Rule]
rules = [Rule]
a} :: CreateDetectorVersion) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateDetectorVersion where
  type
    AWSResponse CreateDetectorVersion =
      CreateDetectorVersionResponse
  request :: (Service -> Service)
-> CreateDetectorVersion -> Request CreateDetectorVersion
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateDetectorVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDetectorVersion)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe DetectorVersionStatus
-> Int
-> CreateDetectorVersionResponse
CreateDetectorVersionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"detectorId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"detectorVersionId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateDetectorVersion where
  hashWithSalt :: Int -> CreateDetectorVersion -> Int
hashWithSalt Int
_salt CreateDetectorVersion' {[Rule]
Maybe [Text]
Maybe [ModelVersion]
Maybe [Tag]
Maybe Text
Maybe RuleExecutionMode
Text
rules :: [Rule]
detectorId :: Text
tags :: Maybe [Tag]
ruleExecutionMode :: Maybe RuleExecutionMode
modelVersions :: Maybe [ModelVersion]
externalModelEndpoints :: Maybe [Text]
description :: Maybe Text
$sel:rules:CreateDetectorVersion' :: CreateDetectorVersion -> [Rule]
$sel:detectorId:CreateDetectorVersion' :: CreateDetectorVersion -> Text
$sel:tags:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [Tag]
$sel:ruleExecutionMode:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe RuleExecutionMode
$sel:modelVersions:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [ModelVersion]
$sel:externalModelEndpoints:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [Text]
$sel:description:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
externalModelEndpoints
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ModelVersion]
modelVersions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RuleExecutionMode
ruleExecutionMode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Rule]
rules

instance Prelude.NFData CreateDetectorVersion where
  rnf :: CreateDetectorVersion -> ()
rnf CreateDetectorVersion' {[Rule]
Maybe [Text]
Maybe [ModelVersion]
Maybe [Tag]
Maybe Text
Maybe RuleExecutionMode
Text
rules :: [Rule]
detectorId :: Text
tags :: Maybe [Tag]
ruleExecutionMode :: Maybe RuleExecutionMode
modelVersions :: Maybe [ModelVersion]
externalModelEndpoints :: Maybe [Text]
description :: Maybe Text
$sel:rules:CreateDetectorVersion' :: CreateDetectorVersion -> [Rule]
$sel:detectorId:CreateDetectorVersion' :: CreateDetectorVersion -> Text
$sel:tags:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [Tag]
$sel:ruleExecutionMode:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe RuleExecutionMode
$sel:modelVersions:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [ModelVersion]
$sel:externalModelEndpoints:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [Text]
$sel:description:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
externalModelEndpoints
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ModelVersion]
modelVersions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RuleExecutionMode
ruleExecutionMode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
detectorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Rule]
rules

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

instance Data.ToJSON CreateDetectorVersion where
  toJSON :: CreateDetectorVersion -> Value
toJSON CreateDetectorVersion' {[Rule]
Maybe [Text]
Maybe [ModelVersion]
Maybe [Tag]
Maybe Text
Maybe RuleExecutionMode
Text
rules :: [Rule]
detectorId :: Text
tags :: Maybe [Tag]
ruleExecutionMode :: Maybe RuleExecutionMode
modelVersions :: Maybe [ModelVersion]
externalModelEndpoints :: Maybe [Text]
description :: Maybe Text
$sel:rules:CreateDetectorVersion' :: CreateDetectorVersion -> [Rule]
$sel:detectorId:CreateDetectorVersion' :: CreateDetectorVersion -> Text
$sel:tags:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [Tag]
$sel:ruleExecutionMode:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe RuleExecutionMode
$sel:modelVersions:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [ModelVersion]
$sel:externalModelEndpoints:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe [Text]
$sel:description:CreateDetectorVersion' :: CreateDetectorVersion -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"externalModelEndpoints" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
externalModelEndpoints,
            (Key
"modelVersions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ModelVersion]
modelVersions,
            (Key
"ruleExecutionMode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RuleExecutionMode
ruleExecutionMode,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"detectorId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
detectorId),
            forall a. a -> Maybe a
Prelude.Just (Key
"rules" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Rule]
rules)
          ]
      )

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

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

-- | /See:/ 'newCreateDetectorVersionResponse' smart constructor.
data CreateDetectorVersionResponse = CreateDetectorVersionResponse'
  { -- | The ID for the created version\'s parent detector.
    CreateDetectorVersionResponse -> Maybe Text
detectorId :: Prelude.Maybe Prelude.Text,
    -- | The ID for the created detector.
    CreateDetectorVersionResponse -> Maybe Text
detectorVersionId :: Prelude.Maybe Prelude.Text,
    -- | The status of the detector version.
    CreateDetectorVersionResponse -> Maybe DetectorVersionStatus
status :: Prelude.Maybe DetectorVersionStatus,
    -- | The response's http status code.
    CreateDetectorVersionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDetectorVersionResponse
-> CreateDetectorVersionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDetectorVersionResponse
-> CreateDetectorVersionResponse -> Bool
$c/= :: CreateDetectorVersionResponse
-> CreateDetectorVersionResponse -> Bool
== :: CreateDetectorVersionResponse
-> CreateDetectorVersionResponse -> Bool
$c== :: CreateDetectorVersionResponse
-> CreateDetectorVersionResponse -> Bool
Prelude.Eq, ReadPrec [CreateDetectorVersionResponse]
ReadPrec CreateDetectorVersionResponse
Int -> ReadS CreateDetectorVersionResponse
ReadS [CreateDetectorVersionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDetectorVersionResponse]
$creadListPrec :: ReadPrec [CreateDetectorVersionResponse]
readPrec :: ReadPrec CreateDetectorVersionResponse
$creadPrec :: ReadPrec CreateDetectorVersionResponse
readList :: ReadS [CreateDetectorVersionResponse]
$creadList :: ReadS [CreateDetectorVersionResponse]
readsPrec :: Int -> ReadS CreateDetectorVersionResponse
$creadsPrec :: Int -> ReadS CreateDetectorVersionResponse
Prelude.Read, Int -> CreateDetectorVersionResponse -> ShowS
[CreateDetectorVersionResponse] -> ShowS
CreateDetectorVersionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDetectorVersionResponse] -> ShowS
$cshowList :: [CreateDetectorVersionResponse] -> ShowS
show :: CreateDetectorVersionResponse -> String
$cshow :: CreateDetectorVersionResponse -> String
showsPrec :: Int -> CreateDetectorVersionResponse -> ShowS
$cshowsPrec :: Int -> CreateDetectorVersionResponse -> ShowS
Prelude.Show, forall x.
Rep CreateDetectorVersionResponse x
-> CreateDetectorVersionResponse
forall x.
CreateDetectorVersionResponse
-> Rep CreateDetectorVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDetectorVersionResponse x
-> CreateDetectorVersionResponse
$cfrom :: forall x.
CreateDetectorVersionResponse
-> Rep CreateDetectorVersionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDetectorVersionResponse' 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:
--
-- 'detectorId', 'createDetectorVersionResponse_detectorId' - The ID for the created version\'s parent detector.
--
-- 'detectorVersionId', 'createDetectorVersionResponse_detectorVersionId' - The ID for the created detector.
--
-- 'status', 'createDetectorVersionResponse_status' - The status of the detector version.
--
-- 'httpStatus', 'createDetectorVersionResponse_httpStatus' - The response's http status code.
newCreateDetectorVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDetectorVersionResponse
newCreateDetectorVersionResponse :: Int -> CreateDetectorVersionResponse
newCreateDetectorVersionResponse Int
pHttpStatus_ =
  CreateDetectorVersionResponse'
    { $sel:detectorId:CreateDetectorVersionResponse' :: Maybe Text
detectorId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:detectorVersionId:CreateDetectorVersionResponse' :: Maybe Text
detectorVersionId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:CreateDetectorVersionResponse' :: Maybe DetectorVersionStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDetectorVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID for the created version\'s parent detector.
createDetectorVersionResponse_detectorId :: Lens.Lens' CreateDetectorVersionResponse (Prelude.Maybe Prelude.Text)
createDetectorVersionResponse_detectorId :: Lens' CreateDetectorVersionResponse (Maybe Text)
createDetectorVersionResponse_detectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersionResponse' {Maybe Text
detectorId :: Maybe Text
$sel:detectorId:CreateDetectorVersionResponse' :: CreateDetectorVersionResponse -> Maybe Text
detectorId} -> Maybe Text
detectorId) (\s :: CreateDetectorVersionResponse
s@CreateDetectorVersionResponse' {} Maybe Text
a -> CreateDetectorVersionResponse
s {$sel:detectorId:CreateDetectorVersionResponse' :: Maybe Text
detectorId = Maybe Text
a} :: CreateDetectorVersionResponse)

-- | The ID for the created detector.
createDetectorVersionResponse_detectorVersionId :: Lens.Lens' CreateDetectorVersionResponse (Prelude.Maybe Prelude.Text)
createDetectorVersionResponse_detectorVersionId :: Lens' CreateDetectorVersionResponse (Maybe Text)
createDetectorVersionResponse_detectorVersionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersionResponse' {Maybe Text
detectorVersionId :: Maybe Text
$sel:detectorVersionId:CreateDetectorVersionResponse' :: CreateDetectorVersionResponse -> Maybe Text
detectorVersionId} -> Maybe Text
detectorVersionId) (\s :: CreateDetectorVersionResponse
s@CreateDetectorVersionResponse' {} Maybe Text
a -> CreateDetectorVersionResponse
s {$sel:detectorVersionId:CreateDetectorVersionResponse' :: Maybe Text
detectorVersionId = Maybe Text
a} :: CreateDetectorVersionResponse)

-- | The status of the detector version.
createDetectorVersionResponse_status :: Lens.Lens' CreateDetectorVersionResponse (Prelude.Maybe DetectorVersionStatus)
createDetectorVersionResponse_status :: Lens' CreateDetectorVersionResponse (Maybe DetectorVersionStatus)
createDetectorVersionResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDetectorVersionResponse' {Maybe DetectorVersionStatus
status :: Maybe DetectorVersionStatus
$sel:status:CreateDetectorVersionResponse' :: CreateDetectorVersionResponse -> Maybe DetectorVersionStatus
status} -> Maybe DetectorVersionStatus
status) (\s :: CreateDetectorVersionResponse
s@CreateDetectorVersionResponse' {} Maybe DetectorVersionStatus
a -> CreateDetectorVersionResponse
s {$sel:status:CreateDetectorVersionResponse' :: Maybe DetectorVersionStatus
status = Maybe DetectorVersionStatus
a} :: CreateDetectorVersionResponse)

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

instance Prelude.NFData CreateDetectorVersionResponse where
  rnf :: CreateDetectorVersionResponse -> ()
rnf CreateDetectorVersionResponse' {Int
Maybe Text
Maybe DetectorVersionStatus
httpStatus :: Int
status :: Maybe DetectorVersionStatus
detectorVersionId :: Maybe Text
detectorId :: Maybe Text
$sel:httpStatus:CreateDetectorVersionResponse' :: CreateDetectorVersionResponse -> Int
$sel:status:CreateDetectorVersionResponse' :: CreateDetectorVersionResponse -> Maybe DetectorVersionStatus
$sel:detectorVersionId:CreateDetectorVersionResponse' :: CreateDetectorVersionResponse -> Maybe Text
$sel:detectorId:CreateDetectorVersionResponse' :: CreateDetectorVersionResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
detectorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
detectorVersionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DetectorVersionStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus