{-# 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.Config.Types.ExecutionControls
-- 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.Config.Types.ExecutionControls where

import Amazonka.Config.Types.SsmControls
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The controls that Config uses for executing remediations.
--
-- /See:/ 'newExecutionControls' smart constructor.
data ExecutionControls = ExecutionControls'
  { -- | A SsmControls object.
    ExecutionControls -> Maybe SsmControls
ssmControls :: Prelude.Maybe SsmControls
  }
  deriving (ExecutionControls -> ExecutionControls -> Bool
(ExecutionControls -> ExecutionControls -> Bool)
-> (ExecutionControls -> ExecutionControls -> Bool)
-> Eq ExecutionControls
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecutionControls -> ExecutionControls -> Bool
$c/= :: ExecutionControls -> ExecutionControls -> Bool
== :: ExecutionControls -> ExecutionControls -> Bool
$c== :: ExecutionControls -> ExecutionControls -> Bool
Prelude.Eq, ReadPrec [ExecutionControls]
ReadPrec ExecutionControls
Int -> ReadS ExecutionControls
ReadS [ExecutionControls]
(Int -> ReadS ExecutionControls)
-> ReadS [ExecutionControls]
-> ReadPrec ExecutionControls
-> ReadPrec [ExecutionControls]
-> Read ExecutionControls
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExecutionControls]
$creadListPrec :: ReadPrec [ExecutionControls]
readPrec :: ReadPrec ExecutionControls
$creadPrec :: ReadPrec ExecutionControls
readList :: ReadS [ExecutionControls]
$creadList :: ReadS [ExecutionControls]
readsPrec :: Int -> ReadS ExecutionControls
$creadsPrec :: Int -> ReadS ExecutionControls
Prelude.Read, Int -> ExecutionControls -> ShowS
[ExecutionControls] -> ShowS
ExecutionControls -> String
(Int -> ExecutionControls -> ShowS)
-> (ExecutionControls -> String)
-> ([ExecutionControls] -> ShowS)
-> Show ExecutionControls
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecutionControls] -> ShowS
$cshowList :: [ExecutionControls] -> ShowS
show :: ExecutionControls -> String
$cshow :: ExecutionControls -> String
showsPrec :: Int -> ExecutionControls -> ShowS
$cshowsPrec :: Int -> ExecutionControls -> ShowS
Prelude.Show, (forall x. ExecutionControls -> Rep ExecutionControls x)
-> (forall x. Rep ExecutionControls x -> ExecutionControls)
-> Generic ExecutionControls
forall x. Rep ExecutionControls x -> ExecutionControls
forall x. ExecutionControls -> Rep ExecutionControls x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecutionControls x -> ExecutionControls
$cfrom :: forall x. ExecutionControls -> Rep ExecutionControls x
Prelude.Generic)

-- |
-- Create a value of 'ExecutionControls' 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:
--
-- 'ssmControls', 'executionControls_ssmControls' - A SsmControls object.
newExecutionControls ::
  ExecutionControls
newExecutionControls :: ExecutionControls
newExecutionControls =
  ExecutionControls' :: Maybe SsmControls -> ExecutionControls
ExecutionControls' {$sel:ssmControls:ExecutionControls' :: Maybe SsmControls
ssmControls = Maybe SsmControls
forall a. Maybe a
Prelude.Nothing}

-- | A SsmControls object.
executionControls_ssmControls :: Lens.Lens' ExecutionControls (Prelude.Maybe SsmControls)
executionControls_ssmControls :: (Maybe SsmControls -> f (Maybe SsmControls))
-> ExecutionControls -> f ExecutionControls
executionControls_ssmControls = (ExecutionControls -> Maybe SsmControls)
-> (ExecutionControls -> Maybe SsmControls -> ExecutionControls)
-> Lens
     ExecutionControls
     ExecutionControls
     (Maybe SsmControls)
     (Maybe SsmControls)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExecutionControls' {Maybe SsmControls
ssmControls :: Maybe SsmControls
$sel:ssmControls:ExecutionControls' :: ExecutionControls -> Maybe SsmControls
ssmControls} -> Maybe SsmControls
ssmControls) (\s :: ExecutionControls
s@ExecutionControls' {} Maybe SsmControls
a -> ExecutionControls
s {$sel:ssmControls:ExecutionControls' :: Maybe SsmControls
ssmControls = Maybe SsmControls
a} :: ExecutionControls)

instance Core.FromJSON ExecutionControls where
  parseJSON :: Value -> Parser ExecutionControls
parseJSON =
    String
-> (Object -> Parser ExecutionControls)
-> Value
-> Parser ExecutionControls
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExecutionControls"
      ( \Object
x ->
          Maybe SsmControls -> ExecutionControls
ExecutionControls'
            (Maybe SsmControls -> ExecutionControls)
-> Parser (Maybe SsmControls) -> Parser ExecutionControls
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SsmControls)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SsmControls")
      )

instance Prelude.Hashable ExecutionControls

instance Prelude.NFData ExecutionControls

instance Core.ToJSON ExecutionControls where
  toJSON :: ExecutionControls -> Value
toJSON ExecutionControls' {Maybe SsmControls
ssmControls :: Maybe SsmControls
$sel:ssmControls:ExecutionControls' :: ExecutionControls -> Maybe SsmControls
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"SsmControls" Text -> SsmControls -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SsmControls -> Pair) -> Maybe SsmControls -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SsmControls
ssmControls]
      )