{-# 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-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)
--
-- 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_ruleExecutionMode,
    updateDetectorVersion_modelVersions,
    updateDetectorVersion_description,
    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 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:/ 'newUpdateDetectorVersion' smart constructor.
data UpdateDetectorVersion = UpdateDetectorVersion'
  { -- | 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 model versions to include in the detector version.
    UpdateDetectorVersion -> Maybe [ModelVersion]
modelVersions :: Prelude.Maybe [ModelVersion],
    -- | The detector version description.
    UpdateDetectorVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | 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
(UpdateDetectorVersion -> UpdateDetectorVersion -> Bool)
-> (UpdateDetectorVersion -> UpdateDetectorVersion -> Bool)
-> Eq UpdateDetectorVersion
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]
(Int -> ReadS UpdateDetectorVersion)
-> ReadS [UpdateDetectorVersion]
-> ReadPrec UpdateDetectorVersion
-> ReadPrec [UpdateDetectorVersion]
-> Read 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
(Int -> UpdateDetectorVersion -> ShowS)
-> (UpdateDetectorVersion -> String)
-> ([UpdateDetectorVersion] -> ShowS)
-> Show UpdateDetectorVersion
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. UpdateDetectorVersion -> Rep UpdateDetectorVersion x)
-> (forall x. Rep UpdateDetectorVersion x -> UpdateDetectorVersion)
-> Generic UpdateDetectorVersion
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:
--
-- '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@.
--
-- 'modelVersions', 'updateDetectorVersion_modelVersions' - The model versions to include in the detector version.
--
-- 'description', 'updateDetectorVersion_description' - The detector version description.
--
-- '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' :: Maybe RuleExecutionMode
-> Maybe [ModelVersion]
-> Maybe Text
-> Text
-> Text
-> [Text]
-> [Rule]
-> UpdateDetectorVersion
UpdateDetectorVersion'
      { $sel:ruleExecutionMode:UpdateDetectorVersion' :: Maybe RuleExecutionMode
ruleExecutionMode =
          Maybe RuleExecutionMode
forall a. Maybe a
Prelude.Nothing,
        $sel:modelVersions:UpdateDetectorVersion' :: Maybe [ModelVersion]
modelVersions = Maybe [ModelVersion]
forall a. Maybe a
Prelude.Nothing,
        $sel:description:UpdateDetectorVersion' :: Maybe Text
description = Maybe Text
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 = [Text]
forall a. Monoid a => a
Prelude.mempty,
        $sel:rules:UpdateDetectorVersion' :: [Rule]
rules = [Rule]
forall a. Monoid a => a
Prelude.mempty
      }

-- | 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 :: (Maybe RuleExecutionMode -> f (Maybe RuleExecutionMode))
-> UpdateDetectorVersion -> f UpdateDetectorVersion
updateDetectorVersion_ruleExecutionMode = (UpdateDetectorVersion -> Maybe RuleExecutionMode)
-> (UpdateDetectorVersion
    -> Maybe RuleExecutionMode -> UpdateDetectorVersion)
-> Lens
     UpdateDetectorVersion
     UpdateDetectorVersion
     (Maybe RuleExecutionMode)
     (Maybe 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 model versions to include in the detector version.
updateDetectorVersion_modelVersions :: Lens.Lens' UpdateDetectorVersion (Prelude.Maybe [ModelVersion])
updateDetectorVersion_modelVersions :: (Maybe [ModelVersion] -> f (Maybe [ModelVersion]))
-> UpdateDetectorVersion -> f UpdateDetectorVersion
updateDetectorVersion_modelVersions = (UpdateDetectorVersion -> Maybe [ModelVersion])
-> (UpdateDetectorVersion
    -> Maybe [ModelVersion] -> UpdateDetectorVersion)
-> Lens
     UpdateDetectorVersion
     UpdateDetectorVersion
     (Maybe [ModelVersion])
     (Maybe [ModelVersion])
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) ((Maybe [ModelVersion] -> f (Maybe [ModelVersion]))
 -> UpdateDetectorVersion -> f UpdateDetectorVersion)
-> ((Maybe [ModelVersion] -> f (Maybe [ModelVersion]))
    -> Maybe [ModelVersion] -> f (Maybe [ModelVersion]))
-> (Maybe [ModelVersion] -> f (Maybe [ModelVersion]))
-> UpdateDetectorVersion
-> f UpdateDetectorVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ModelVersion] [ModelVersion] [ModelVersion] [ModelVersion]
-> Iso
     (Maybe [ModelVersion])
     (Maybe [ModelVersion])
     (Maybe [ModelVersion])
     (Maybe [ModelVersion])
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 [ModelVersion] [ModelVersion] [ModelVersion] [ModelVersion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The detector version description.
updateDetectorVersion_description :: Lens.Lens' UpdateDetectorVersion (Prelude.Maybe Prelude.Text)
updateDetectorVersion_description :: (Maybe Text -> f (Maybe Text))
-> UpdateDetectorVersion -> f UpdateDetectorVersion
updateDetectorVersion_description = (UpdateDetectorVersion -> Maybe Text)
-> (UpdateDetectorVersion -> Maybe Text -> UpdateDetectorVersion)
-> Lens
     UpdateDetectorVersion
     UpdateDetectorVersion
     (Maybe Text)
     (Maybe Text)
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 parent detector ID for the detector version you want to update.
updateDetectorVersion_detectorId :: Lens.Lens' UpdateDetectorVersion Prelude.Text
updateDetectorVersion_detectorId :: (Text -> f Text)
-> UpdateDetectorVersion -> f UpdateDetectorVersion
updateDetectorVersion_detectorId = (UpdateDetectorVersion -> Text)
-> (UpdateDetectorVersion -> Text -> UpdateDetectorVersion)
-> Lens UpdateDetectorVersion UpdateDetectorVersion Text Text
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 :: (Text -> f Text)
-> UpdateDetectorVersion -> f UpdateDetectorVersion
updateDetectorVersion_detectorVersionId = (UpdateDetectorVersion -> Text)
-> (UpdateDetectorVersion -> Text -> UpdateDetectorVersion)
-> Lens UpdateDetectorVersion UpdateDetectorVersion Text Text
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 :: ([Text] -> f [Text])
-> UpdateDetectorVersion -> f UpdateDetectorVersion
updateDetectorVersion_externalModelEndpoints = (UpdateDetectorVersion -> [Text])
-> (UpdateDetectorVersion -> [Text] -> UpdateDetectorVersion)
-> Lens UpdateDetectorVersion UpdateDetectorVersion [Text] [Text]
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) (([Text] -> f [Text])
 -> UpdateDetectorVersion -> f UpdateDetectorVersion)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> UpdateDetectorVersion
-> f UpdateDetectorVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
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 :: ([Rule] -> f [Rule])
-> UpdateDetectorVersion -> f UpdateDetectorVersion
updateDetectorVersion_rules = (UpdateDetectorVersion -> [Rule])
-> (UpdateDetectorVersion -> [Rule] -> UpdateDetectorVersion)
-> Lens UpdateDetectorVersion UpdateDetectorVersion [Rule] [Rule]
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) (([Rule] -> f [Rule])
 -> UpdateDetectorVersion -> f UpdateDetectorVersion)
-> (([Rule] -> f [Rule]) -> [Rule] -> f [Rule])
-> ([Rule] -> f [Rule])
-> UpdateDetectorVersion
-> f UpdateDetectorVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Rule] -> f [Rule]) -> [Rule] -> f [Rule]
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 :: UpdateDetectorVersion -> Request UpdateDetectorVersion
request = Service -> UpdateDetectorVersion -> Request UpdateDetectorVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateDetectorVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDetectorVersion)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateDetectorVersion))
-> Logger
-> Service
-> Proxy UpdateDetectorVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDetectorVersion)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateDetectorVersionResponse
UpdateDetectorVersionResponse'
            (Int -> UpdateDetectorVersionResponse)
-> Either String Int -> Either String UpdateDetectorVersionResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateDetectorVersion

instance Prelude.NFData UpdateDetectorVersion

instance Core.ToHeaders UpdateDetectorVersion where
  toHeaders :: UpdateDetectorVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateDetectorVersion -> 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.UpdateDetectorVersion" ::
                          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 UpdateDetectorVersion where
  toJSON :: UpdateDetectorVersion -> Value
toJSON UpdateDetectorVersion' {[Text]
[Rule]
Maybe [ModelVersion]
Maybe Text
Maybe RuleExecutionMode
Text
rules :: [Rule]
externalModelEndpoints :: [Text]
detectorVersionId :: Text
detectorId :: Text
description :: Maybe Text
modelVersions :: Maybe [ModelVersion]
ruleExecutionMode :: Maybe RuleExecutionMode
$sel:rules:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Rule]
$sel:externalModelEndpoints:UpdateDetectorVersion' :: UpdateDetectorVersion -> [Text]
$sel:detectorVersionId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
$sel:detectorId:UpdateDetectorVersion' :: UpdateDetectorVersion -> Text
$sel:description:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe Text
$sel:modelVersions:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe [ModelVersion]
$sel:ruleExecutionMode:UpdateDetectorVersion' :: UpdateDetectorVersion -> Maybe RuleExecutionMode
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ruleExecutionMode" Text -> RuleExecutionMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RuleExecutionMode -> Pair)
-> Maybe RuleExecutionMode -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RuleExecutionMode
ruleExecutionMode,
            (Text
"modelVersions" Text -> [ModelVersion] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([ModelVersion] -> Pair) -> Maybe [ModelVersion] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ModelVersion]
modelVersions,
            (Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"detectorId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
detectorId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"detectorVersionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
detectorVersionId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"externalModelEndpoints"
                  Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
externalModelEndpoints
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"rules" Text -> [Rule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Rule]
rules)
          ]
      )

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

instance Core.ToQuery UpdateDetectorVersion where
  toQuery :: UpdateDetectorVersion -> QueryString
toQuery = QueryString -> UpdateDetectorVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateDetectorVersionResponse
 -> UpdateDetectorVersionResponse -> Bool)
-> (UpdateDetectorVersionResponse
    -> UpdateDetectorVersionResponse -> Bool)
-> Eq UpdateDetectorVersionResponse
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]
(Int -> ReadS UpdateDetectorVersionResponse)
-> ReadS [UpdateDetectorVersionResponse]
-> ReadPrec UpdateDetectorVersionResponse
-> ReadPrec [UpdateDetectorVersionResponse]
-> Read 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
(Int -> UpdateDetectorVersionResponse -> ShowS)
-> (UpdateDetectorVersionResponse -> String)
-> ([UpdateDetectorVersionResponse] -> ShowS)
-> Show UpdateDetectorVersionResponse
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.
 UpdateDetectorVersionResponse
 -> Rep UpdateDetectorVersionResponse x)
-> (forall x.
    Rep UpdateDetectorVersionResponse x
    -> UpdateDetectorVersionResponse)
-> Generic UpdateDetectorVersionResponse
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' :: Int -> UpdateDetectorVersionResponse
UpdateDetectorVersionResponse'
    { $sel:httpStatus:UpdateDetectorVersionResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
updateDetectorVersionResponse_httpStatus :: Lens.Lens' UpdateDetectorVersionResponse Prelude.Int
updateDetectorVersionResponse_httpStatus :: (Int -> f Int)
-> UpdateDetectorVersionResponse -> f UpdateDetectorVersionResponse
updateDetectorVersionResponse_httpStatus = (UpdateDetectorVersionResponse -> Int)
-> (UpdateDetectorVersionResponse
    -> Int -> UpdateDetectorVersionResponse)
-> Lens
     UpdateDetectorVersionResponse UpdateDetectorVersionResponse Int Int
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