{-# 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.UpdateDetectorVersion
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates a detector version. The detector version attributes that you can
-- update include models, external model endpoints, rules, rule execution
-- mode, and description. You can only update a @DRAFT@ detector version.
module Amazonka.FraudDetector.UpdateDetectorVersion
  ( -- * Creating a Request
    UpdateDetectorVersion (..),
    newUpdateDetectorVersion,

    -- * Request Lenses
    updateDetectorVersion_description,
    updateDetectorVersion_modelVersions,
    updateDetectorVersion_ruleExecutionMode,
    updateDetectorVersion_detectorId,
    updateDetectorVersion_detectorVersionId,
    updateDetectorVersion_externalModelEndpoints,
    updateDetectorVersion_rules,

    -- * Destructuring the Response
    UpdateDetectorVersionResponse (..),
    newUpdateDetectorVersionResponse,

    -- * Response Lenses
    updateDetectorVersionResponse_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:/ 'newUpdateDetectorVersion' smart constructor.
data UpdateDetectorVersion = UpdateDetectorVersion'
  { -- | The detector version description.
    UpdateDetectorVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The model versions to include in the detector version.
    UpdateDetectorVersion -> Maybe [ModelVersion]
modelVersions :: Prelude.Maybe [ModelVersion],
    -- | The rule execution mode to add to the detector.
    --
    -- 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. You can define and edit
    -- the rule mode at the detector version level, when it is in draft status.
    --
    -- The default behavior is @FIRST_MATCHED@.
    UpdateDetectorVersion -> Maybe RuleExecutionMode
ruleExecutionMode :: Prelude.Maybe RuleExecutionMode,
    -- | The parent detector ID for the detector version you want to update.
    UpdateDetectorVersion -> Text
detectorId :: Prelude.Text,
    -- | The detector version ID.
    UpdateDetectorVersion -> Text
detectorVersionId :: Prelude.Text,
    -- | The Amazon SageMaker model endpoints to include in the detector version.
    UpdateDetectorVersion -> [Text]
externalModelEndpoints :: [Prelude.Text],
    -- | The rules to include in the detector version.
    UpdateDetectorVersion -> [Rule]
rules :: [Rule]
  }
  deriving (UpdateDetectorVersion -> UpdateDetectorVersion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDetectorVersion -> UpdateDetectorVersion -> Bool
$c/= :: UpdateDetectorVersion -> UpdateDetectorVersion -> Bool
== :: UpdateDetectorVersion -> UpdateDetectorVersion -> Bool
$c== :: UpdateDetectorVersion -> UpdateDetectorVersion -> Bool
Prelude.Eq, ReadPrec [UpdateDetectorVersion]
ReadPrec UpdateDetectorVersion
Int -> ReadS UpdateDetectorVersion
ReadS [UpdateDetectorVersion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDetectorVersion]
$creadListPrec :: ReadPrec [UpdateDetectorVersion]
readPrec :: ReadPrec UpdateDetectorVersion
$creadPrec :: ReadPrec UpdateDetectorVersion
readList :: ReadS [UpdateDetectorVersion]
$creadList :: ReadS [UpdateDetectorVersion]
readsPrec :: Int -> ReadS UpdateDetectorVersion
$creadsPrec :: Int -> ReadS UpdateDetectorVersion
Prelude.Read, Int -> UpdateDetectorVersion -> ShowS
[UpdateDetectorVersion] -> ShowS
UpdateDetectorVersion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDetectorVersion] -> ShowS
$cshowList :: [UpdateDetectorVersion] -> ShowS
show :: UpdateDetectorVersion -> String
$cshow :: UpdateDetectorVersion -> String
showsPrec :: Int -> UpdateDetectorVersion -> ShowS
$cshowsPrec :: Int -> UpdateDetectorVersion -> ShowS
Prelude.Show, forall x. Rep UpdateDetectorVersion x -> UpdateDetectorVersion
forall x. UpdateDetectorVersion -> Rep UpdateDetectorVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDetectorVersion x -> UpdateDetectorVersion
$cfrom :: forall x. UpdateDetectorVersion -> Rep UpdateDetectorVersion x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDetectorVersion' 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', 'updateDetectorVersion_description' - The detector version description.
--
-- 'modelVersions', 'updateDetectorVersion_modelVersions' - The model versions to include in the detector version.
--
-- 'ruleExecutionMode', 'updateDetectorVersion_ruleExecutionMode' - The rule execution mode to add to the detector.
--
-- 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. You can define and edit
-- the rule mode at the detector version level, when it is in draft status.
--
-- The default behavior is @FIRST_MATCHED@.
--
-- 'detectorId', 'updateDetectorVersion_detectorId' - The parent detector ID for the detector version you want to update.
--
-- 'detectorVersionId', 'updateDetectorVersion_detectorVersionId' - The detector version ID.
--
-- 'externalModelEndpoints', 'updateDetectorVersion_externalModelEndpoints' - The Amazon SageMaker model endpoints to include in the detector version.
--
-- 'rules', 'updateDetectorVersion_rules' - The rules to include in the detector version.
newUpdateDetectorVersion ::
  -- | 'detectorId'
  Prelude.Text ->
  -- | 'detectorVersionId'
  Prelude.Text ->
  UpdateDetectorVersion
newUpdateDetectorVersion :: Text -> Text -> UpdateDetectorVersion
newUpdateDetectorVersion
  Text
pDetectorId_
  Text
pDetectorVersionId_ =
    UpdateDetectorVersion'
      { $sel:description:UpdateDetectorVersion' :: Maybe Text
description =
          forall a. Maybe a
Prelude.Nothing,
        $sel:modelVersions:UpdateDetectorVersion' :: Maybe [ModelVersion]
modelVersions = forall a. Maybe a
Prelude.Nothing,
        $sel:ruleExecutionMode:UpdateDetectorVersion' :: Maybe RuleExecutionMode
ruleExecutionMode = forall a. Maybe a
Prelude.Nothing,
        $sel:detectorId:UpdateDetectorVersion' :: Text
detectorId = Text
pDetectorId_,
        $sel:detectorVersionId:UpdateDetectorVersion' :: Text
detectorVersionId = Text
pDetectorVersionId_,
        $sel:externalModelEndpoints:UpdateDetectorVersion' :: [Text]
externalModelEndpoints = forall a. Monoid a => a
Prelude.mempty,
        $sel:rules:UpdateDetectorVersion' :: [Rule]
rules = forall a. Monoid a => a
Prelude.mempty
      }

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

-- | The model versions to include in the detector version.
updateDetectorVersion_modelVersions :: Lens.Lens' UpdateDetectorVersion (Prelude.Maybe [ModelVersion])
updateDetectorVersion_modelVersions :: Lens' UpdateDetectorVersion (Maybe [ModelVersion])
updateDetectorVersion_modelVersions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDetectorVersion' {Maybe [ModelVersion]
modelVersions :: Maybe [ModelVersion]
$sel:modelVersions:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe [ModelVersion]
modelVersions} -> Maybe [ModelVersion]
modelVersions) (\s :: UpdateDetectorVersion
s@UpdateDetectorVersion' {} Maybe [ModelVersion]
a -> UpdateDetectorVersion
s {$sel:modelVersions:UpdateDetectorVersion' :: Maybe [ModelVersion]
modelVersions = Maybe [ModelVersion]
a} :: UpdateDetectorVersion) 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 to add to the detector.
--
-- 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. You can define and edit
-- the rule mode at the detector version level, when it is in draft status.
--
-- The default behavior is @FIRST_MATCHED@.
updateDetectorVersion_ruleExecutionMode :: Lens.Lens' UpdateDetectorVersion (Prelude.Maybe RuleExecutionMode)
updateDetectorVersion_ruleExecutionMode :: Lens' UpdateDetectorVersion (Maybe RuleExecutionMode)
updateDetectorVersion_ruleExecutionMode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDetectorVersion' {Maybe RuleExecutionMode
ruleExecutionMode :: Maybe RuleExecutionMode
$sel:ruleExecutionMode:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe RuleExecutionMode
ruleExecutionMode} -> Maybe RuleExecutionMode
ruleExecutionMode) (\s :: UpdateDetectorVersion
s@UpdateDetectorVersion' {} Maybe RuleExecutionMode
a -> UpdateDetectorVersion
s {$sel:ruleExecutionMode:UpdateDetectorVersion' :: Maybe RuleExecutionMode
ruleExecutionMode = Maybe RuleExecutionMode
a} :: UpdateDetectorVersion)

-- | The parent detector ID for the detector version you want to update.
updateDetectorVersion_detectorId :: Lens.Lens' UpdateDetectorVersion Prelude.Text
updateDetectorVersion_detectorId :: Lens' UpdateDetectorVersion Text
updateDetectorVersion_detectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDetectorVersion' {Text
detectorId :: Text
$sel:detectorId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
detectorId} -> Text
detectorId) (\s :: UpdateDetectorVersion
s@UpdateDetectorVersion' {} Text
a -> UpdateDetectorVersion
s {$sel:detectorId:UpdateDetectorVersion' :: Text
detectorId = Text
a} :: UpdateDetectorVersion)

-- | The detector version ID.
updateDetectorVersion_detectorVersionId :: Lens.Lens' UpdateDetectorVersion Prelude.Text
updateDetectorVersion_detectorVersionId :: Lens' UpdateDetectorVersion Text
updateDetectorVersion_detectorVersionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDetectorVersion' {Text
detectorVersionId :: Text
$sel:detectorVersionId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
detectorVersionId} -> Text
detectorVersionId) (\s :: UpdateDetectorVersion
s@UpdateDetectorVersion' {} Text
a -> UpdateDetectorVersion
s {$sel:detectorVersionId:UpdateDetectorVersion' :: Text
detectorVersionId = Text
a} :: UpdateDetectorVersion)

-- | The Amazon SageMaker model endpoints to include in the detector version.
updateDetectorVersion_externalModelEndpoints :: Lens.Lens' UpdateDetectorVersion [Prelude.Text]
updateDetectorVersion_externalModelEndpoints :: Lens' UpdateDetectorVersion [Text]
updateDetectorVersion_externalModelEndpoints = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDetectorVersion' {[Text]
externalModelEndpoints :: [Text]
$sel:externalModelEndpoints:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Text]
externalModelEndpoints} -> [Text]
externalModelEndpoints) (\s :: UpdateDetectorVersion
s@UpdateDetectorVersion' {} [Text]
a -> UpdateDetectorVersion
s {$sel:externalModelEndpoints:UpdateDetectorVersion' :: [Text]
externalModelEndpoints = [Text]
a} :: UpdateDetectorVersion) 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

-- | The rules to include in the detector version.
updateDetectorVersion_rules :: Lens.Lens' UpdateDetectorVersion [Rule]
updateDetectorVersion_rules :: Lens' UpdateDetectorVersion [Rule]
updateDetectorVersion_rules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDetectorVersion' {[Rule]
rules :: [Rule]
$sel:rules:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Rule]
rules} -> [Rule]
rules) (\s :: UpdateDetectorVersion
s@UpdateDetectorVersion' {} [Rule]
a -> UpdateDetectorVersion
s {$sel:rules:UpdateDetectorVersion' :: [Rule]
rules = [Rule]
a} :: UpdateDetectorVersion) 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 UpdateDetectorVersion where
  type
    AWSResponse UpdateDetectorVersion =
      UpdateDetectorVersionResponse
  request :: (Service -> Service)
-> UpdateDetectorVersion -> Request UpdateDetectorVersion
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 UpdateDetectorVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDetectorVersion)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateDetectorVersionResponse
UpdateDetectorVersionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateDetectorVersion where
  hashWithSalt :: Int -> UpdateDetectorVersion -> Int
hashWithSalt Int
_salt UpdateDetectorVersion' {[Text]
[Rule]
Maybe [ModelVersion]
Maybe Text
Maybe RuleExecutionMode
Text
rules :: [Rule]
externalModelEndpoints :: [Text]
detectorVersionId :: Text
detectorId :: Text
ruleExecutionMode :: Maybe RuleExecutionMode
modelVersions :: Maybe [ModelVersion]
description :: Maybe Text
$sel:rules:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Rule]
$sel:externalModelEndpoints:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Text]
$sel:detectorVersionId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
$sel:detectorId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
$sel:ruleExecutionMode:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe RuleExecutionMode
$sel:modelVersions:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe [ModelVersion]
$sel:description:UpdateDetectorVersion' :: UpdateDetectorVersion -> 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 [ModelVersion]
modelVersions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RuleExecutionMode
ruleExecutionMode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorVersionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
externalModelEndpoints
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Rule]
rules

instance Prelude.NFData UpdateDetectorVersion where
  rnf :: UpdateDetectorVersion -> ()
rnf UpdateDetectorVersion' {[Text]
[Rule]
Maybe [ModelVersion]
Maybe Text
Maybe RuleExecutionMode
Text
rules :: [Rule]
externalModelEndpoints :: [Text]
detectorVersionId :: Text
detectorId :: Text
ruleExecutionMode :: Maybe RuleExecutionMode
modelVersions :: Maybe [ModelVersion]
description :: Maybe Text
$sel:rules:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Rule]
$sel:externalModelEndpoints:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Text]
$sel:detectorVersionId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
$sel:detectorId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
$sel:ruleExecutionMode:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe RuleExecutionMode
$sel:modelVersions:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe [ModelVersion]
$sel:description:UpdateDetectorVersion' :: UpdateDetectorVersion -> 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 [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 Text
detectorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
detectorVersionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
externalModelEndpoints
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Rule]
rules

instance Data.ToHeaders UpdateDetectorVersion where
  toHeaders :: UpdateDetectorVersion -> 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.UpdateDetectorVersion" ::
                          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 UpdateDetectorVersion where
  toJSON :: UpdateDetectorVersion -> Value
toJSON UpdateDetectorVersion' {[Text]
[Rule]
Maybe [ModelVersion]
Maybe Text
Maybe RuleExecutionMode
Text
rules :: [Rule]
externalModelEndpoints :: [Text]
detectorVersionId :: Text
detectorId :: Text
ruleExecutionMode :: Maybe RuleExecutionMode
modelVersions :: Maybe [ModelVersion]
description :: Maybe Text
$sel:rules:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Rule]
$sel:externalModelEndpoints:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Text]
$sel:detectorVersionId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
$sel:detectorId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
$sel:ruleExecutionMode:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe RuleExecutionMode
$sel:modelVersions:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe [ModelVersion]
$sel:description:UpdateDetectorVersion' :: UpdateDetectorVersion -> 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
"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,
            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
"detectorVersionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
detectorVersionId),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"externalModelEndpoints"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
externalModelEndpoints
              ),
            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 UpdateDetectorVersion where
  toPath :: UpdateDetectorVersion -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'UpdateDetectorVersionResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'updateDetectorVersionResponse_httpStatus' - The response's http status code.
newUpdateDetectorVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateDetectorVersionResponse
newUpdateDetectorVersionResponse :: Int -> UpdateDetectorVersionResponse
newUpdateDetectorVersionResponse Int
pHttpStatus_ =
  UpdateDetectorVersionResponse'
    { $sel:httpStatus:UpdateDetectorVersionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData UpdateDetectorVersionResponse where
  rnf :: UpdateDetectorVersionResponse -> ()
rnf UpdateDetectorVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDetectorVersionResponse' :: UpdateDetectorVersionResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus