{-# 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.SSM.Types.PatchBaselineIdentity
-- 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.SSM.Types.PatchBaselineIdentity where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.OperatingSystem

-- | Defines the basic information about a patch baseline.
--
-- /See:/ 'newPatchBaselineIdentity' smart constructor.
data PatchBaselineIdentity = PatchBaselineIdentity'
  { -- | The name of the patch baseline.
    PatchBaselineIdentity -> Maybe Text
baselineName :: Prelude.Maybe Prelude.Text,
    -- | The description of the patch baseline.
    PatchBaselineIdentity -> Maybe Text
baselineDescription :: Prelude.Maybe Prelude.Text,
    -- | Defines the operating system the patch baseline applies to. The default
    -- value is @WINDOWS@.
    PatchBaselineIdentity -> Maybe OperatingSystem
operatingSystem :: Prelude.Maybe OperatingSystem,
    -- | Whether this is the default baseline. Amazon Web Services Systems
    -- Manager supports creating multiple default patch baselines. For example,
    -- you can create a default patch baseline for each operating system.
    PatchBaselineIdentity -> Maybe Bool
defaultBaseline :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the patch baseline.
    PatchBaselineIdentity -> Maybe Text
baselineId :: Prelude.Maybe Prelude.Text
  }
  deriving (PatchBaselineIdentity -> PatchBaselineIdentity -> Bool
(PatchBaselineIdentity -> PatchBaselineIdentity -> Bool)
-> (PatchBaselineIdentity -> PatchBaselineIdentity -> Bool)
-> Eq PatchBaselineIdentity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatchBaselineIdentity -> PatchBaselineIdentity -> Bool
$c/= :: PatchBaselineIdentity -> PatchBaselineIdentity -> Bool
== :: PatchBaselineIdentity -> PatchBaselineIdentity -> Bool
$c== :: PatchBaselineIdentity -> PatchBaselineIdentity -> Bool
Prelude.Eq, ReadPrec [PatchBaselineIdentity]
ReadPrec PatchBaselineIdentity
Int -> ReadS PatchBaselineIdentity
ReadS [PatchBaselineIdentity]
(Int -> ReadS PatchBaselineIdentity)
-> ReadS [PatchBaselineIdentity]
-> ReadPrec PatchBaselineIdentity
-> ReadPrec [PatchBaselineIdentity]
-> Read PatchBaselineIdentity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PatchBaselineIdentity]
$creadListPrec :: ReadPrec [PatchBaselineIdentity]
readPrec :: ReadPrec PatchBaselineIdentity
$creadPrec :: ReadPrec PatchBaselineIdentity
readList :: ReadS [PatchBaselineIdentity]
$creadList :: ReadS [PatchBaselineIdentity]
readsPrec :: Int -> ReadS PatchBaselineIdentity
$creadsPrec :: Int -> ReadS PatchBaselineIdentity
Prelude.Read, Int -> PatchBaselineIdentity -> ShowS
[PatchBaselineIdentity] -> ShowS
PatchBaselineIdentity -> String
(Int -> PatchBaselineIdentity -> ShowS)
-> (PatchBaselineIdentity -> String)
-> ([PatchBaselineIdentity] -> ShowS)
-> Show PatchBaselineIdentity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatchBaselineIdentity] -> ShowS
$cshowList :: [PatchBaselineIdentity] -> ShowS
show :: PatchBaselineIdentity -> String
$cshow :: PatchBaselineIdentity -> String
showsPrec :: Int -> PatchBaselineIdentity -> ShowS
$cshowsPrec :: Int -> PatchBaselineIdentity -> ShowS
Prelude.Show, (forall x. PatchBaselineIdentity -> Rep PatchBaselineIdentity x)
-> (forall x. Rep PatchBaselineIdentity x -> PatchBaselineIdentity)
-> Generic PatchBaselineIdentity
forall x. Rep PatchBaselineIdentity x -> PatchBaselineIdentity
forall x. PatchBaselineIdentity -> Rep PatchBaselineIdentity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PatchBaselineIdentity x -> PatchBaselineIdentity
$cfrom :: forall x. PatchBaselineIdentity -> Rep PatchBaselineIdentity x
Prelude.Generic)

-- |
-- Create a value of 'PatchBaselineIdentity' 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:
--
-- 'baselineName', 'patchBaselineIdentity_baselineName' - The name of the patch baseline.
--
-- 'baselineDescription', 'patchBaselineIdentity_baselineDescription' - The description of the patch baseline.
--
-- 'operatingSystem', 'patchBaselineIdentity_operatingSystem' - Defines the operating system the patch baseline applies to. The default
-- value is @WINDOWS@.
--
-- 'defaultBaseline', 'patchBaselineIdentity_defaultBaseline' - Whether this is the default baseline. Amazon Web Services Systems
-- Manager supports creating multiple default patch baselines. For example,
-- you can create a default patch baseline for each operating system.
--
-- 'baselineId', 'patchBaselineIdentity_baselineId' - The ID of the patch baseline.
newPatchBaselineIdentity ::
  PatchBaselineIdentity
newPatchBaselineIdentity :: PatchBaselineIdentity
newPatchBaselineIdentity =
  PatchBaselineIdentity' :: Maybe Text
-> Maybe Text
-> Maybe OperatingSystem
-> Maybe Bool
-> Maybe Text
-> PatchBaselineIdentity
PatchBaselineIdentity'
    { $sel:baselineName:PatchBaselineIdentity' :: Maybe Text
baselineName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:baselineDescription:PatchBaselineIdentity' :: Maybe Text
baselineDescription = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:operatingSystem:PatchBaselineIdentity' :: Maybe OperatingSystem
operatingSystem = Maybe OperatingSystem
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultBaseline:PatchBaselineIdentity' :: Maybe Bool
defaultBaseline = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:baselineId:PatchBaselineIdentity' :: Maybe Text
baselineId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the patch baseline.
patchBaselineIdentity_baselineName :: Lens.Lens' PatchBaselineIdentity (Prelude.Maybe Prelude.Text)
patchBaselineIdentity_baselineName :: (Maybe Text -> f (Maybe Text))
-> PatchBaselineIdentity -> f PatchBaselineIdentity
patchBaselineIdentity_baselineName = (PatchBaselineIdentity -> Maybe Text)
-> (PatchBaselineIdentity -> Maybe Text -> PatchBaselineIdentity)
-> Lens
     PatchBaselineIdentity
     PatchBaselineIdentity
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchBaselineIdentity' {Maybe Text
baselineName :: Maybe Text
$sel:baselineName:PatchBaselineIdentity' :: PatchBaselineIdentity -> Maybe Text
baselineName} -> Maybe Text
baselineName) (\s :: PatchBaselineIdentity
s@PatchBaselineIdentity' {} Maybe Text
a -> PatchBaselineIdentity
s {$sel:baselineName:PatchBaselineIdentity' :: Maybe Text
baselineName = Maybe Text
a} :: PatchBaselineIdentity)

-- | The description of the patch baseline.
patchBaselineIdentity_baselineDescription :: Lens.Lens' PatchBaselineIdentity (Prelude.Maybe Prelude.Text)
patchBaselineIdentity_baselineDescription :: (Maybe Text -> f (Maybe Text))
-> PatchBaselineIdentity -> f PatchBaselineIdentity
patchBaselineIdentity_baselineDescription = (PatchBaselineIdentity -> Maybe Text)
-> (PatchBaselineIdentity -> Maybe Text -> PatchBaselineIdentity)
-> Lens
     PatchBaselineIdentity
     PatchBaselineIdentity
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchBaselineIdentity' {Maybe Text
baselineDescription :: Maybe Text
$sel:baselineDescription:PatchBaselineIdentity' :: PatchBaselineIdentity -> Maybe Text
baselineDescription} -> Maybe Text
baselineDescription) (\s :: PatchBaselineIdentity
s@PatchBaselineIdentity' {} Maybe Text
a -> PatchBaselineIdentity
s {$sel:baselineDescription:PatchBaselineIdentity' :: Maybe Text
baselineDescription = Maybe Text
a} :: PatchBaselineIdentity)

-- | Defines the operating system the patch baseline applies to. The default
-- value is @WINDOWS@.
patchBaselineIdentity_operatingSystem :: Lens.Lens' PatchBaselineIdentity (Prelude.Maybe OperatingSystem)
patchBaselineIdentity_operatingSystem :: (Maybe OperatingSystem -> f (Maybe OperatingSystem))
-> PatchBaselineIdentity -> f PatchBaselineIdentity
patchBaselineIdentity_operatingSystem = (PatchBaselineIdentity -> Maybe OperatingSystem)
-> (PatchBaselineIdentity
    -> Maybe OperatingSystem -> PatchBaselineIdentity)
-> Lens
     PatchBaselineIdentity
     PatchBaselineIdentity
     (Maybe OperatingSystem)
     (Maybe OperatingSystem)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchBaselineIdentity' {Maybe OperatingSystem
operatingSystem :: Maybe OperatingSystem
$sel:operatingSystem:PatchBaselineIdentity' :: PatchBaselineIdentity -> Maybe OperatingSystem
operatingSystem} -> Maybe OperatingSystem
operatingSystem) (\s :: PatchBaselineIdentity
s@PatchBaselineIdentity' {} Maybe OperatingSystem
a -> PatchBaselineIdentity
s {$sel:operatingSystem:PatchBaselineIdentity' :: Maybe OperatingSystem
operatingSystem = Maybe OperatingSystem
a} :: PatchBaselineIdentity)

-- | Whether this is the default baseline. Amazon Web Services Systems
-- Manager supports creating multiple default patch baselines. For example,
-- you can create a default patch baseline for each operating system.
patchBaselineIdentity_defaultBaseline :: Lens.Lens' PatchBaselineIdentity (Prelude.Maybe Prelude.Bool)
patchBaselineIdentity_defaultBaseline :: (Maybe Bool -> f (Maybe Bool))
-> PatchBaselineIdentity -> f PatchBaselineIdentity
patchBaselineIdentity_defaultBaseline = (PatchBaselineIdentity -> Maybe Bool)
-> (PatchBaselineIdentity -> Maybe Bool -> PatchBaselineIdentity)
-> Lens
     PatchBaselineIdentity
     PatchBaselineIdentity
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchBaselineIdentity' {Maybe Bool
defaultBaseline :: Maybe Bool
$sel:defaultBaseline:PatchBaselineIdentity' :: PatchBaselineIdentity -> Maybe Bool
defaultBaseline} -> Maybe Bool
defaultBaseline) (\s :: PatchBaselineIdentity
s@PatchBaselineIdentity' {} Maybe Bool
a -> PatchBaselineIdentity
s {$sel:defaultBaseline:PatchBaselineIdentity' :: Maybe Bool
defaultBaseline = Maybe Bool
a} :: PatchBaselineIdentity)

-- | The ID of the patch baseline.
patchBaselineIdentity_baselineId :: Lens.Lens' PatchBaselineIdentity (Prelude.Maybe Prelude.Text)
patchBaselineIdentity_baselineId :: (Maybe Text -> f (Maybe Text))
-> PatchBaselineIdentity -> f PatchBaselineIdentity
patchBaselineIdentity_baselineId = (PatchBaselineIdentity -> Maybe Text)
-> (PatchBaselineIdentity -> Maybe Text -> PatchBaselineIdentity)
-> Lens
     PatchBaselineIdentity
     PatchBaselineIdentity
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchBaselineIdentity' {Maybe Text
baselineId :: Maybe Text
$sel:baselineId:PatchBaselineIdentity' :: PatchBaselineIdentity -> Maybe Text
baselineId} -> Maybe Text
baselineId) (\s :: PatchBaselineIdentity
s@PatchBaselineIdentity' {} Maybe Text
a -> PatchBaselineIdentity
s {$sel:baselineId:PatchBaselineIdentity' :: Maybe Text
baselineId = Maybe Text
a} :: PatchBaselineIdentity)

instance Core.FromJSON PatchBaselineIdentity where
  parseJSON :: Value -> Parser PatchBaselineIdentity
parseJSON =
    String
-> (Object -> Parser PatchBaselineIdentity)
-> Value
-> Parser PatchBaselineIdentity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PatchBaselineIdentity"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe OperatingSystem
-> Maybe Bool
-> Maybe Text
-> PatchBaselineIdentity
PatchBaselineIdentity'
            (Maybe Text
 -> Maybe Text
 -> Maybe OperatingSystem
 -> Maybe Bool
 -> Maybe Text
 -> PatchBaselineIdentity)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe OperatingSystem
      -> Maybe Bool
      -> Maybe Text
      -> PatchBaselineIdentity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BaselineName")
            Parser
  (Maybe Text
   -> Maybe OperatingSystem
   -> Maybe Bool
   -> Maybe Text
   -> PatchBaselineIdentity)
-> Parser (Maybe Text)
-> Parser
     (Maybe OperatingSystem
      -> Maybe Bool -> Maybe Text -> PatchBaselineIdentity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BaselineDescription")
            Parser
  (Maybe OperatingSystem
   -> Maybe Bool -> Maybe Text -> PatchBaselineIdentity)
-> Parser (Maybe OperatingSystem)
-> Parser (Maybe Bool -> Maybe Text -> PatchBaselineIdentity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OperatingSystem)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OperatingSystem")
            Parser (Maybe Bool -> Maybe Text -> PatchBaselineIdentity)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> PatchBaselineIdentity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DefaultBaseline")
            Parser (Maybe Text -> PatchBaselineIdentity)
-> Parser (Maybe Text) -> Parser PatchBaselineIdentity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BaselineId")
      )

instance Prelude.Hashable PatchBaselineIdentity

instance Prelude.NFData PatchBaselineIdentity