{-# 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.ImageBuilder.Types.SystemsManagerAgent
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ImageBuilder.Types.SystemsManagerAgent where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains settings for the Systems Manager agent on your build instance.
--
-- /See:/ 'newSystemsManagerAgent' smart constructor.
data SystemsManagerAgent = SystemsManagerAgent'
  { -- | Controls whether the Systems Manager agent is removed from your final
    -- build image, prior to creating the new AMI. If this is set to true, then
    -- the agent is removed from the final image. If it\'s set to false, then
    -- the agent is left in, so that it is included in the new AMI. The default
    -- value is false.
    SystemsManagerAgent -> Maybe Bool
uninstallAfterBuild :: Prelude.Maybe Prelude.Bool
  }
  deriving (SystemsManagerAgent -> SystemsManagerAgent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SystemsManagerAgent -> SystemsManagerAgent -> Bool
$c/= :: SystemsManagerAgent -> SystemsManagerAgent -> Bool
== :: SystemsManagerAgent -> SystemsManagerAgent -> Bool
$c== :: SystemsManagerAgent -> SystemsManagerAgent -> Bool
Prelude.Eq, ReadPrec [SystemsManagerAgent]
ReadPrec SystemsManagerAgent
Int -> ReadS SystemsManagerAgent
ReadS [SystemsManagerAgent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SystemsManagerAgent]
$creadListPrec :: ReadPrec [SystemsManagerAgent]
readPrec :: ReadPrec SystemsManagerAgent
$creadPrec :: ReadPrec SystemsManagerAgent
readList :: ReadS [SystemsManagerAgent]
$creadList :: ReadS [SystemsManagerAgent]
readsPrec :: Int -> ReadS SystemsManagerAgent
$creadsPrec :: Int -> ReadS SystemsManagerAgent
Prelude.Read, Int -> SystemsManagerAgent -> ShowS
[SystemsManagerAgent] -> ShowS
SystemsManagerAgent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SystemsManagerAgent] -> ShowS
$cshowList :: [SystemsManagerAgent] -> ShowS
show :: SystemsManagerAgent -> String
$cshow :: SystemsManagerAgent -> String
showsPrec :: Int -> SystemsManagerAgent -> ShowS
$cshowsPrec :: Int -> SystemsManagerAgent -> ShowS
Prelude.Show, forall x. Rep SystemsManagerAgent x -> SystemsManagerAgent
forall x. SystemsManagerAgent -> Rep SystemsManagerAgent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SystemsManagerAgent x -> SystemsManagerAgent
$cfrom :: forall x. SystemsManagerAgent -> Rep SystemsManagerAgent x
Prelude.Generic)

-- |
-- Create a value of 'SystemsManagerAgent' 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:
--
-- 'uninstallAfterBuild', 'systemsManagerAgent_uninstallAfterBuild' - Controls whether the Systems Manager agent is removed from your final
-- build image, prior to creating the new AMI. If this is set to true, then
-- the agent is removed from the final image. If it\'s set to false, then
-- the agent is left in, so that it is included in the new AMI. The default
-- value is false.
newSystemsManagerAgent ::
  SystemsManagerAgent
newSystemsManagerAgent :: SystemsManagerAgent
newSystemsManagerAgent =
  SystemsManagerAgent'
    { $sel:uninstallAfterBuild:SystemsManagerAgent' :: Maybe Bool
uninstallAfterBuild =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Controls whether the Systems Manager agent is removed from your final
-- build image, prior to creating the new AMI. If this is set to true, then
-- the agent is removed from the final image. If it\'s set to false, then
-- the agent is left in, so that it is included in the new AMI. The default
-- value is false.
systemsManagerAgent_uninstallAfterBuild :: Lens.Lens' SystemsManagerAgent (Prelude.Maybe Prelude.Bool)
systemsManagerAgent_uninstallAfterBuild :: Lens' SystemsManagerAgent (Maybe Bool)
systemsManagerAgent_uninstallAfterBuild = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SystemsManagerAgent' {Maybe Bool
uninstallAfterBuild :: Maybe Bool
$sel:uninstallAfterBuild:SystemsManagerAgent' :: SystemsManagerAgent -> Maybe Bool
uninstallAfterBuild} -> Maybe Bool
uninstallAfterBuild) (\s :: SystemsManagerAgent
s@SystemsManagerAgent' {} Maybe Bool
a -> SystemsManagerAgent
s {$sel:uninstallAfterBuild:SystemsManagerAgent' :: Maybe Bool
uninstallAfterBuild = Maybe Bool
a} :: SystemsManagerAgent)

instance Data.FromJSON SystemsManagerAgent where
  parseJSON :: Value -> Parser SystemsManagerAgent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SystemsManagerAgent"
      ( \Object
x ->
          Maybe Bool -> SystemsManagerAgent
SystemsManagerAgent'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"uninstallAfterBuild")
      )

instance Prelude.Hashable SystemsManagerAgent where
  hashWithSalt :: Int -> SystemsManagerAgent -> Int
hashWithSalt Int
_salt SystemsManagerAgent' {Maybe Bool
uninstallAfterBuild :: Maybe Bool
$sel:uninstallAfterBuild:SystemsManagerAgent' :: SystemsManagerAgent -> Maybe Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
uninstallAfterBuild

instance Prelude.NFData SystemsManagerAgent where
  rnf :: SystemsManagerAgent -> ()
rnf SystemsManagerAgent' {Maybe Bool
uninstallAfterBuild :: Maybe Bool
$sel:uninstallAfterBuild:SystemsManagerAgent' :: SystemsManagerAgent -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
uninstallAfterBuild

instance Data.ToJSON SystemsManagerAgent where
  toJSON :: SystemsManagerAgent -> Value
toJSON SystemsManagerAgent' {Maybe Bool
uninstallAfterBuild :: Maybe Bool
$sel:uninstallAfterBuild:SystemsManagerAgent' :: SystemsManagerAgent -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"uninstallAfterBuild" 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 Bool
uninstallAfterBuild
          ]
      )