{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoT.Types.MitigationActionParams
-- 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)
module Amazonka.IoT.Types.MitigationActionParams where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types.AddThingsToThingGroupParams
import Amazonka.IoT.Types.EnableIoTLoggingParams
import Amazonka.IoT.Types.PublishFindingToSnsParams
import Amazonka.IoT.Types.ReplaceDefaultPolicyVersionParams
import Amazonka.IoT.Types.UpdateCACertificateParams
import Amazonka.IoT.Types.UpdateDeviceCertificateParams
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The set of parameters for this mitigation action. You can specify only
-- one type of parameter (in other words, you can apply only one action for
-- each defined mitigation action).
--
-- /See:/ 'newMitigationActionParams' smart constructor.
data MitigationActionParams = MitigationActionParams'
  { -- | Parameters to define a mitigation action that enables Amazon Web
    -- Services IoT Core logging at a specified level of detail.
    MitigationActionParams -> Maybe EnableIoTLoggingParams
enableIoTLoggingParams :: Prelude.Maybe EnableIoTLoggingParams,
    -- | Parameters to define a mitigation action that moves devices associated
    -- with a certificate to one or more specified thing groups, typically for
    -- quarantine.
    MitigationActionParams -> Maybe AddThingsToThingGroupParams
addThingsToThingGroupParams :: Prelude.Maybe AddThingsToThingGroupParams,
    -- | Parameters to define a mitigation action that changes the state of the
    -- CA certificate to inactive.
    MitigationActionParams -> Maybe UpdateCACertificateParams
updateCACertificateParams :: Prelude.Maybe UpdateCACertificateParams,
    -- | Parameters to define a mitigation action that changes the state of the
    -- device certificate to inactive.
    MitigationActionParams -> Maybe UpdateDeviceCertificateParams
updateDeviceCertificateParams :: Prelude.Maybe UpdateDeviceCertificateParams,
    -- | Parameters to define a mitigation action that adds a blank policy to
    -- restrict permissions.
    MitigationActionParams -> Maybe ReplaceDefaultPolicyVersionParams
replaceDefaultPolicyVersionParams :: Prelude.Maybe ReplaceDefaultPolicyVersionParams,
    -- | Parameters to define a mitigation action that publishes findings to
    -- Amazon Simple Notification Service (Amazon SNS. You can implement your
    -- own custom actions in response to the Amazon SNS messages.
    MitigationActionParams -> Maybe PublishFindingToSnsParams
publishFindingToSnsParams :: Prelude.Maybe PublishFindingToSnsParams
  }
  deriving (MitigationActionParams -> MitigationActionParams -> Bool
(MitigationActionParams -> MitigationActionParams -> Bool)
-> (MitigationActionParams -> MitigationActionParams -> Bool)
-> Eq MitigationActionParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MitigationActionParams -> MitigationActionParams -> Bool
$c/= :: MitigationActionParams -> MitigationActionParams -> Bool
== :: MitigationActionParams -> MitigationActionParams -> Bool
$c== :: MitigationActionParams -> MitigationActionParams -> Bool
Prelude.Eq, ReadPrec [MitigationActionParams]
ReadPrec MitigationActionParams
Int -> ReadS MitigationActionParams
ReadS [MitigationActionParams]
(Int -> ReadS MitigationActionParams)
-> ReadS [MitigationActionParams]
-> ReadPrec MitigationActionParams
-> ReadPrec [MitigationActionParams]
-> Read MitigationActionParams
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MitigationActionParams]
$creadListPrec :: ReadPrec [MitigationActionParams]
readPrec :: ReadPrec MitigationActionParams
$creadPrec :: ReadPrec MitigationActionParams
readList :: ReadS [MitigationActionParams]
$creadList :: ReadS [MitigationActionParams]
readsPrec :: Int -> ReadS MitigationActionParams
$creadsPrec :: Int -> ReadS MitigationActionParams
Prelude.Read, Int -> MitigationActionParams -> ShowS
[MitigationActionParams] -> ShowS
MitigationActionParams -> String
(Int -> MitigationActionParams -> ShowS)
-> (MitigationActionParams -> String)
-> ([MitigationActionParams] -> ShowS)
-> Show MitigationActionParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MitigationActionParams] -> ShowS
$cshowList :: [MitigationActionParams] -> ShowS
show :: MitigationActionParams -> String
$cshow :: MitigationActionParams -> String
showsPrec :: Int -> MitigationActionParams -> ShowS
$cshowsPrec :: Int -> MitigationActionParams -> ShowS
Prelude.Show, (forall x. MitigationActionParams -> Rep MitigationActionParams x)
-> (forall x.
    Rep MitigationActionParams x -> MitigationActionParams)
-> Generic MitigationActionParams
forall x. Rep MitigationActionParams x -> MitigationActionParams
forall x. MitigationActionParams -> Rep MitigationActionParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MitigationActionParams x -> MitigationActionParams
$cfrom :: forall x. MitigationActionParams -> Rep MitigationActionParams x
Prelude.Generic)

-- |
-- Create a value of 'MitigationActionParams' 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:
--
-- 'enableIoTLoggingParams', 'mitigationActionParams_enableIoTLoggingParams' - Parameters to define a mitigation action that enables Amazon Web
-- Services IoT Core logging at a specified level of detail.
--
-- 'addThingsToThingGroupParams', 'mitigationActionParams_addThingsToThingGroupParams' - Parameters to define a mitigation action that moves devices associated
-- with a certificate to one or more specified thing groups, typically for
-- quarantine.
--
-- 'updateCACertificateParams', 'mitigationActionParams_updateCACertificateParams' - Parameters to define a mitigation action that changes the state of the
-- CA certificate to inactive.
--
-- 'updateDeviceCertificateParams', 'mitigationActionParams_updateDeviceCertificateParams' - Parameters to define a mitigation action that changes the state of the
-- device certificate to inactive.
--
-- 'replaceDefaultPolicyVersionParams', 'mitigationActionParams_replaceDefaultPolicyVersionParams' - Parameters to define a mitigation action that adds a blank policy to
-- restrict permissions.
--
-- 'publishFindingToSnsParams', 'mitigationActionParams_publishFindingToSnsParams' - Parameters to define a mitigation action that publishes findings to
-- Amazon Simple Notification Service (Amazon SNS. You can implement your
-- own custom actions in response to the Amazon SNS messages.
newMitigationActionParams ::
  MitigationActionParams
newMitigationActionParams :: MitigationActionParams
newMitigationActionParams =
  MitigationActionParams' :: Maybe EnableIoTLoggingParams
-> Maybe AddThingsToThingGroupParams
-> Maybe UpdateCACertificateParams
-> Maybe UpdateDeviceCertificateParams
-> Maybe ReplaceDefaultPolicyVersionParams
-> Maybe PublishFindingToSnsParams
-> MitigationActionParams
MitigationActionParams'
    { $sel:enableIoTLoggingParams:MitigationActionParams' :: Maybe EnableIoTLoggingParams
enableIoTLoggingParams =
        Maybe EnableIoTLoggingParams
forall a. Maybe a
Prelude.Nothing,
      $sel:addThingsToThingGroupParams:MitigationActionParams' :: Maybe AddThingsToThingGroupParams
addThingsToThingGroupParams = Maybe AddThingsToThingGroupParams
forall a. Maybe a
Prelude.Nothing,
      $sel:updateCACertificateParams:MitigationActionParams' :: Maybe UpdateCACertificateParams
updateCACertificateParams = Maybe UpdateCACertificateParams
forall a. Maybe a
Prelude.Nothing,
      $sel:updateDeviceCertificateParams:MitigationActionParams' :: Maybe UpdateDeviceCertificateParams
updateDeviceCertificateParams = Maybe UpdateDeviceCertificateParams
forall a. Maybe a
Prelude.Nothing,
      $sel:replaceDefaultPolicyVersionParams:MitigationActionParams' :: Maybe ReplaceDefaultPolicyVersionParams
replaceDefaultPolicyVersionParams = Maybe ReplaceDefaultPolicyVersionParams
forall a. Maybe a
Prelude.Nothing,
      $sel:publishFindingToSnsParams:MitigationActionParams' :: Maybe PublishFindingToSnsParams
publishFindingToSnsParams = Maybe PublishFindingToSnsParams
forall a. Maybe a
Prelude.Nothing
    }

-- | Parameters to define a mitigation action that enables Amazon Web
-- Services IoT Core logging at a specified level of detail.
mitigationActionParams_enableIoTLoggingParams :: Lens.Lens' MitigationActionParams (Prelude.Maybe EnableIoTLoggingParams)
mitigationActionParams_enableIoTLoggingParams :: (Maybe EnableIoTLoggingParams -> f (Maybe EnableIoTLoggingParams))
-> MitigationActionParams -> f MitigationActionParams
mitigationActionParams_enableIoTLoggingParams = (MitigationActionParams -> Maybe EnableIoTLoggingParams)
-> (MitigationActionParams
    -> Maybe EnableIoTLoggingParams -> MitigationActionParams)
-> Lens
     MitigationActionParams
     MitigationActionParams
     (Maybe EnableIoTLoggingParams)
     (Maybe EnableIoTLoggingParams)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationActionParams' {Maybe EnableIoTLoggingParams
enableIoTLoggingParams :: Maybe EnableIoTLoggingParams
$sel:enableIoTLoggingParams:MitigationActionParams' :: MitigationActionParams -> Maybe EnableIoTLoggingParams
enableIoTLoggingParams} -> Maybe EnableIoTLoggingParams
enableIoTLoggingParams) (\s :: MitigationActionParams
s@MitigationActionParams' {} Maybe EnableIoTLoggingParams
a -> MitigationActionParams
s {$sel:enableIoTLoggingParams:MitigationActionParams' :: Maybe EnableIoTLoggingParams
enableIoTLoggingParams = Maybe EnableIoTLoggingParams
a} :: MitigationActionParams)

-- | Parameters to define a mitigation action that moves devices associated
-- with a certificate to one or more specified thing groups, typically for
-- quarantine.
mitigationActionParams_addThingsToThingGroupParams :: Lens.Lens' MitigationActionParams (Prelude.Maybe AddThingsToThingGroupParams)
mitigationActionParams_addThingsToThingGroupParams :: (Maybe AddThingsToThingGroupParams
 -> f (Maybe AddThingsToThingGroupParams))
-> MitigationActionParams -> f MitigationActionParams
mitigationActionParams_addThingsToThingGroupParams = (MitigationActionParams -> Maybe AddThingsToThingGroupParams)
-> (MitigationActionParams
    -> Maybe AddThingsToThingGroupParams -> MitigationActionParams)
-> Lens
     MitigationActionParams
     MitigationActionParams
     (Maybe AddThingsToThingGroupParams)
     (Maybe AddThingsToThingGroupParams)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationActionParams' {Maybe AddThingsToThingGroupParams
addThingsToThingGroupParams :: Maybe AddThingsToThingGroupParams
$sel:addThingsToThingGroupParams:MitigationActionParams' :: MitigationActionParams -> Maybe AddThingsToThingGroupParams
addThingsToThingGroupParams} -> Maybe AddThingsToThingGroupParams
addThingsToThingGroupParams) (\s :: MitigationActionParams
s@MitigationActionParams' {} Maybe AddThingsToThingGroupParams
a -> MitigationActionParams
s {$sel:addThingsToThingGroupParams:MitigationActionParams' :: Maybe AddThingsToThingGroupParams
addThingsToThingGroupParams = Maybe AddThingsToThingGroupParams
a} :: MitigationActionParams)

-- | Parameters to define a mitigation action that changes the state of the
-- CA certificate to inactive.
mitigationActionParams_updateCACertificateParams :: Lens.Lens' MitigationActionParams (Prelude.Maybe UpdateCACertificateParams)
mitigationActionParams_updateCACertificateParams :: (Maybe UpdateCACertificateParams
 -> f (Maybe UpdateCACertificateParams))
-> MitigationActionParams -> f MitigationActionParams
mitigationActionParams_updateCACertificateParams = (MitigationActionParams -> Maybe UpdateCACertificateParams)
-> (MitigationActionParams
    -> Maybe UpdateCACertificateParams -> MitigationActionParams)
-> Lens
     MitigationActionParams
     MitigationActionParams
     (Maybe UpdateCACertificateParams)
     (Maybe UpdateCACertificateParams)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationActionParams' {Maybe UpdateCACertificateParams
updateCACertificateParams :: Maybe UpdateCACertificateParams
$sel:updateCACertificateParams:MitigationActionParams' :: MitigationActionParams -> Maybe UpdateCACertificateParams
updateCACertificateParams} -> Maybe UpdateCACertificateParams
updateCACertificateParams) (\s :: MitigationActionParams
s@MitigationActionParams' {} Maybe UpdateCACertificateParams
a -> MitigationActionParams
s {$sel:updateCACertificateParams:MitigationActionParams' :: Maybe UpdateCACertificateParams
updateCACertificateParams = Maybe UpdateCACertificateParams
a} :: MitigationActionParams)

-- | Parameters to define a mitigation action that changes the state of the
-- device certificate to inactive.
mitigationActionParams_updateDeviceCertificateParams :: Lens.Lens' MitigationActionParams (Prelude.Maybe UpdateDeviceCertificateParams)
mitigationActionParams_updateDeviceCertificateParams :: (Maybe UpdateDeviceCertificateParams
 -> f (Maybe UpdateDeviceCertificateParams))
-> MitigationActionParams -> f MitigationActionParams
mitigationActionParams_updateDeviceCertificateParams = (MitigationActionParams -> Maybe UpdateDeviceCertificateParams)
-> (MitigationActionParams
    -> Maybe UpdateDeviceCertificateParams -> MitigationActionParams)
-> Lens
     MitigationActionParams
     MitigationActionParams
     (Maybe UpdateDeviceCertificateParams)
     (Maybe UpdateDeviceCertificateParams)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationActionParams' {Maybe UpdateDeviceCertificateParams
updateDeviceCertificateParams :: Maybe UpdateDeviceCertificateParams
$sel:updateDeviceCertificateParams:MitigationActionParams' :: MitigationActionParams -> Maybe UpdateDeviceCertificateParams
updateDeviceCertificateParams} -> Maybe UpdateDeviceCertificateParams
updateDeviceCertificateParams) (\s :: MitigationActionParams
s@MitigationActionParams' {} Maybe UpdateDeviceCertificateParams
a -> MitigationActionParams
s {$sel:updateDeviceCertificateParams:MitigationActionParams' :: Maybe UpdateDeviceCertificateParams
updateDeviceCertificateParams = Maybe UpdateDeviceCertificateParams
a} :: MitigationActionParams)

-- | Parameters to define a mitigation action that adds a blank policy to
-- restrict permissions.
mitigationActionParams_replaceDefaultPolicyVersionParams :: Lens.Lens' MitigationActionParams (Prelude.Maybe ReplaceDefaultPolicyVersionParams)
mitigationActionParams_replaceDefaultPolicyVersionParams :: (Maybe ReplaceDefaultPolicyVersionParams
 -> f (Maybe ReplaceDefaultPolicyVersionParams))
-> MitigationActionParams -> f MitigationActionParams
mitigationActionParams_replaceDefaultPolicyVersionParams = (MitigationActionParams -> Maybe ReplaceDefaultPolicyVersionParams)
-> (MitigationActionParams
    -> Maybe ReplaceDefaultPolicyVersionParams
    -> MitigationActionParams)
-> Lens
     MitigationActionParams
     MitigationActionParams
     (Maybe ReplaceDefaultPolicyVersionParams)
     (Maybe ReplaceDefaultPolicyVersionParams)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationActionParams' {Maybe ReplaceDefaultPolicyVersionParams
replaceDefaultPolicyVersionParams :: Maybe ReplaceDefaultPolicyVersionParams
$sel:replaceDefaultPolicyVersionParams:MitigationActionParams' :: MitigationActionParams -> Maybe ReplaceDefaultPolicyVersionParams
replaceDefaultPolicyVersionParams} -> Maybe ReplaceDefaultPolicyVersionParams
replaceDefaultPolicyVersionParams) (\s :: MitigationActionParams
s@MitigationActionParams' {} Maybe ReplaceDefaultPolicyVersionParams
a -> MitigationActionParams
s {$sel:replaceDefaultPolicyVersionParams:MitigationActionParams' :: Maybe ReplaceDefaultPolicyVersionParams
replaceDefaultPolicyVersionParams = Maybe ReplaceDefaultPolicyVersionParams
a} :: MitigationActionParams)

-- | Parameters to define a mitigation action that publishes findings to
-- Amazon Simple Notification Service (Amazon SNS. You can implement your
-- own custom actions in response to the Amazon SNS messages.
mitigationActionParams_publishFindingToSnsParams :: Lens.Lens' MitigationActionParams (Prelude.Maybe PublishFindingToSnsParams)
mitigationActionParams_publishFindingToSnsParams :: (Maybe PublishFindingToSnsParams
 -> f (Maybe PublishFindingToSnsParams))
-> MitigationActionParams -> f MitigationActionParams
mitigationActionParams_publishFindingToSnsParams = (MitigationActionParams -> Maybe PublishFindingToSnsParams)
-> (MitigationActionParams
    -> Maybe PublishFindingToSnsParams -> MitigationActionParams)
-> Lens
     MitigationActionParams
     MitigationActionParams
     (Maybe PublishFindingToSnsParams)
     (Maybe PublishFindingToSnsParams)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MitigationActionParams' {Maybe PublishFindingToSnsParams
publishFindingToSnsParams :: Maybe PublishFindingToSnsParams
$sel:publishFindingToSnsParams:MitigationActionParams' :: MitigationActionParams -> Maybe PublishFindingToSnsParams
publishFindingToSnsParams} -> Maybe PublishFindingToSnsParams
publishFindingToSnsParams) (\s :: MitigationActionParams
s@MitigationActionParams' {} Maybe PublishFindingToSnsParams
a -> MitigationActionParams
s {$sel:publishFindingToSnsParams:MitigationActionParams' :: Maybe PublishFindingToSnsParams
publishFindingToSnsParams = Maybe PublishFindingToSnsParams
a} :: MitigationActionParams)

instance Core.FromJSON MitigationActionParams where
  parseJSON :: Value -> Parser MitigationActionParams
parseJSON =
    String
-> (Object -> Parser MitigationActionParams)
-> Value
-> Parser MitigationActionParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MitigationActionParams"
      ( \Object
x ->
          Maybe EnableIoTLoggingParams
-> Maybe AddThingsToThingGroupParams
-> Maybe UpdateCACertificateParams
-> Maybe UpdateDeviceCertificateParams
-> Maybe ReplaceDefaultPolicyVersionParams
-> Maybe PublishFindingToSnsParams
-> MitigationActionParams
MitigationActionParams'
            (Maybe EnableIoTLoggingParams
 -> Maybe AddThingsToThingGroupParams
 -> Maybe UpdateCACertificateParams
 -> Maybe UpdateDeviceCertificateParams
 -> Maybe ReplaceDefaultPolicyVersionParams
 -> Maybe PublishFindingToSnsParams
 -> MitigationActionParams)
-> Parser (Maybe EnableIoTLoggingParams)
-> Parser
     (Maybe AddThingsToThingGroupParams
      -> Maybe UpdateCACertificateParams
      -> Maybe UpdateDeviceCertificateParams
      -> Maybe ReplaceDefaultPolicyVersionParams
      -> Maybe PublishFindingToSnsParams
      -> MitigationActionParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EnableIoTLoggingParams)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"enableIoTLoggingParams")
            Parser
  (Maybe AddThingsToThingGroupParams
   -> Maybe UpdateCACertificateParams
   -> Maybe UpdateDeviceCertificateParams
   -> Maybe ReplaceDefaultPolicyVersionParams
   -> Maybe PublishFindingToSnsParams
   -> MitigationActionParams)
-> Parser (Maybe AddThingsToThingGroupParams)
-> Parser
     (Maybe UpdateCACertificateParams
      -> Maybe UpdateDeviceCertificateParams
      -> Maybe ReplaceDefaultPolicyVersionParams
      -> Maybe PublishFindingToSnsParams
      -> MitigationActionParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AddThingsToThingGroupParams)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"addThingsToThingGroupParams")
            Parser
  (Maybe UpdateCACertificateParams
   -> Maybe UpdateDeviceCertificateParams
   -> Maybe ReplaceDefaultPolicyVersionParams
   -> Maybe PublishFindingToSnsParams
   -> MitigationActionParams)
-> Parser (Maybe UpdateCACertificateParams)
-> Parser
     (Maybe UpdateDeviceCertificateParams
      -> Maybe ReplaceDefaultPolicyVersionParams
      -> Maybe PublishFindingToSnsParams
      -> MitigationActionParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UpdateCACertificateParams)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"updateCACertificateParams")
            Parser
  (Maybe UpdateDeviceCertificateParams
   -> Maybe ReplaceDefaultPolicyVersionParams
   -> Maybe PublishFindingToSnsParams
   -> MitigationActionParams)
-> Parser (Maybe UpdateDeviceCertificateParams)
-> Parser
     (Maybe ReplaceDefaultPolicyVersionParams
      -> Maybe PublishFindingToSnsParams -> MitigationActionParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe UpdateDeviceCertificateParams)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"updateDeviceCertificateParams")
            Parser
  (Maybe ReplaceDefaultPolicyVersionParams
   -> Maybe PublishFindingToSnsParams -> MitigationActionParams)
-> Parser (Maybe ReplaceDefaultPolicyVersionParams)
-> Parser
     (Maybe PublishFindingToSnsParams -> MitigationActionParams)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ReplaceDefaultPolicyVersionParams)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"replaceDefaultPolicyVersionParams")
            Parser (Maybe PublishFindingToSnsParams -> MitigationActionParams)
-> Parser (Maybe PublishFindingToSnsParams)
-> Parser MitigationActionParams
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PublishFindingToSnsParams)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"publishFindingToSnsParams")
      )

instance Prelude.Hashable MitigationActionParams

instance Prelude.NFData MitigationActionParams

instance Core.ToJSON MitigationActionParams where
  toJSON :: MitigationActionParams -> Value
toJSON MitigationActionParams' {Maybe AddThingsToThingGroupParams
Maybe EnableIoTLoggingParams
Maybe PublishFindingToSnsParams
Maybe ReplaceDefaultPolicyVersionParams
Maybe UpdateCACertificateParams
Maybe UpdateDeviceCertificateParams
publishFindingToSnsParams :: Maybe PublishFindingToSnsParams
replaceDefaultPolicyVersionParams :: Maybe ReplaceDefaultPolicyVersionParams
updateDeviceCertificateParams :: Maybe UpdateDeviceCertificateParams
updateCACertificateParams :: Maybe UpdateCACertificateParams
addThingsToThingGroupParams :: Maybe AddThingsToThingGroupParams
enableIoTLoggingParams :: Maybe EnableIoTLoggingParams
$sel:publishFindingToSnsParams:MitigationActionParams' :: MitigationActionParams -> Maybe PublishFindingToSnsParams
$sel:replaceDefaultPolicyVersionParams:MitigationActionParams' :: MitigationActionParams -> Maybe ReplaceDefaultPolicyVersionParams
$sel:updateDeviceCertificateParams:MitigationActionParams' :: MitigationActionParams -> Maybe UpdateDeviceCertificateParams
$sel:updateCACertificateParams:MitigationActionParams' :: MitigationActionParams -> Maybe UpdateCACertificateParams
$sel:addThingsToThingGroupParams:MitigationActionParams' :: MitigationActionParams -> Maybe AddThingsToThingGroupParams
$sel:enableIoTLoggingParams:MitigationActionParams' :: MitigationActionParams -> Maybe EnableIoTLoggingParams
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"enableIoTLoggingParams" Text -> EnableIoTLoggingParams -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EnableIoTLoggingParams -> Pair)
-> Maybe EnableIoTLoggingParams -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EnableIoTLoggingParams
enableIoTLoggingParams,
            (Text
"addThingsToThingGroupParams" Text -> AddThingsToThingGroupParams -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AddThingsToThingGroupParams -> Pair)
-> Maybe AddThingsToThingGroupParams -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AddThingsToThingGroupParams
addThingsToThingGroupParams,
            (Text
"updateCACertificateParams" Text -> UpdateCACertificateParams -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (UpdateCACertificateParams -> Pair)
-> Maybe UpdateCACertificateParams -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UpdateCACertificateParams
updateCACertificateParams,
            (Text
"updateDeviceCertificateParams" Text -> UpdateDeviceCertificateParams -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (UpdateDeviceCertificateParams -> Pair)
-> Maybe UpdateDeviceCertificateParams -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UpdateDeviceCertificateParams
updateDeviceCertificateParams,
            (Text
"replaceDefaultPolicyVersionParams" Text -> ReplaceDefaultPolicyVersionParams -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ReplaceDefaultPolicyVersionParams -> Pair)
-> Maybe ReplaceDefaultPolicyVersionParams -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReplaceDefaultPolicyVersionParams
replaceDefaultPolicyVersionParams,
            (Text
"publishFindingToSnsParams" Text -> PublishFindingToSnsParams -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PublishFindingToSnsParams -> Pair)
-> Maybe PublishFindingToSnsParams -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PublishFindingToSnsParams
publishFindingToSnsParams
          ]
      )