{-# 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.PatchGroupPatchBaselineMapping
-- 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.SSM.Types.PatchGroupPatchBaselineMapping 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
import Amazonka.SSM.Types.PatchBaselineIdentity

-- | The mapping between a patch group and the patch baseline the patch group
-- is registered with.
--
-- /See:/ 'newPatchGroupPatchBaselineMapping' smart constructor.
data PatchGroupPatchBaselineMapping = PatchGroupPatchBaselineMapping'
  { -- | The patch baseline the patch group is registered with.
    PatchGroupPatchBaselineMapping -> Maybe PatchBaselineIdentity
baselineIdentity :: Prelude.Maybe PatchBaselineIdentity,
    -- | The name of the patch group registered with the patch baseline.
    PatchGroupPatchBaselineMapping -> Maybe Text
patchGroup :: Prelude.Maybe Prelude.Text
  }
  deriving (PatchGroupPatchBaselineMapping
-> PatchGroupPatchBaselineMapping -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatchGroupPatchBaselineMapping
-> PatchGroupPatchBaselineMapping -> Bool
$c/= :: PatchGroupPatchBaselineMapping
-> PatchGroupPatchBaselineMapping -> Bool
== :: PatchGroupPatchBaselineMapping
-> PatchGroupPatchBaselineMapping -> Bool
$c== :: PatchGroupPatchBaselineMapping
-> PatchGroupPatchBaselineMapping -> Bool
Prelude.Eq, ReadPrec [PatchGroupPatchBaselineMapping]
ReadPrec PatchGroupPatchBaselineMapping
Int -> ReadS PatchGroupPatchBaselineMapping
ReadS [PatchGroupPatchBaselineMapping]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PatchGroupPatchBaselineMapping]
$creadListPrec :: ReadPrec [PatchGroupPatchBaselineMapping]
readPrec :: ReadPrec PatchGroupPatchBaselineMapping
$creadPrec :: ReadPrec PatchGroupPatchBaselineMapping
readList :: ReadS [PatchGroupPatchBaselineMapping]
$creadList :: ReadS [PatchGroupPatchBaselineMapping]
readsPrec :: Int -> ReadS PatchGroupPatchBaselineMapping
$creadsPrec :: Int -> ReadS PatchGroupPatchBaselineMapping
Prelude.Read, Int -> PatchGroupPatchBaselineMapping -> ShowS
[PatchGroupPatchBaselineMapping] -> ShowS
PatchGroupPatchBaselineMapping -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatchGroupPatchBaselineMapping] -> ShowS
$cshowList :: [PatchGroupPatchBaselineMapping] -> ShowS
show :: PatchGroupPatchBaselineMapping -> String
$cshow :: PatchGroupPatchBaselineMapping -> String
showsPrec :: Int -> PatchGroupPatchBaselineMapping -> ShowS
$cshowsPrec :: Int -> PatchGroupPatchBaselineMapping -> ShowS
Prelude.Show, forall x.
Rep PatchGroupPatchBaselineMapping x
-> PatchGroupPatchBaselineMapping
forall x.
PatchGroupPatchBaselineMapping
-> Rep PatchGroupPatchBaselineMapping x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PatchGroupPatchBaselineMapping x
-> PatchGroupPatchBaselineMapping
$cfrom :: forall x.
PatchGroupPatchBaselineMapping
-> Rep PatchGroupPatchBaselineMapping x
Prelude.Generic)

-- |
-- Create a value of 'PatchGroupPatchBaselineMapping' 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:
--
-- 'baselineIdentity', 'patchGroupPatchBaselineMapping_baselineIdentity' - The patch baseline the patch group is registered with.
--
-- 'patchGroup', 'patchGroupPatchBaselineMapping_patchGroup' - The name of the patch group registered with the patch baseline.
newPatchGroupPatchBaselineMapping ::
  PatchGroupPatchBaselineMapping
newPatchGroupPatchBaselineMapping :: PatchGroupPatchBaselineMapping
newPatchGroupPatchBaselineMapping =
  PatchGroupPatchBaselineMapping'
    { $sel:baselineIdentity:PatchGroupPatchBaselineMapping' :: Maybe PatchBaselineIdentity
baselineIdentity =
        forall a. Maybe a
Prelude.Nothing,
      $sel:patchGroup:PatchGroupPatchBaselineMapping' :: Maybe Text
patchGroup = forall a. Maybe a
Prelude.Nothing
    }

-- | The patch baseline the patch group is registered with.
patchGroupPatchBaselineMapping_baselineIdentity :: Lens.Lens' PatchGroupPatchBaselineMapping (Prelude.Maybe PatchBaselineIdentity)
patchGroupPatchBaselineMapping_baselineIdentity :: Lens' PatchGroupPatchBaselineMapping (Maybe PatchBaselineIdentity)
patchGroupPatchBaselineMapping_baselineIdentity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchGroupPatchBaselineMapping' {Maybe PatchBaselineIdentity
baselineIdentity :: Maybe PatchBaselineIdentity
$sel:baselineIdentity:PatchGroupPatchBaselineMapping' :: PatchGroupPatchBaselineMapping -> Maybe PatchBaselineIdentity
baselineIdentity} -> Maybe PatchBaselineIdentity
baselineIdentity) (\s :: PatchGroupPatchBaselineMapping
s@PatchGroupPatchBaselineMapping' {} Maybe PatchBaselineIdentity
a -> PatchGroupPatchBaselineMapping
s {$sel:baselineIdentity:PatchGroupPatchBaselineMapping' :: Maybe PatchBaselineIdentity
baselineIdentity = Maybe PatchBaselineIdentity
a} :: PatchGroupPatchBaselineMapping)

-- | The name of the patch group registered with the patch baseline.
patchGroupPatchBaselineMapping_patchGroup :: Lens.Lens' PatchGroupPatchBaselineMapping (Prelude.Maybe Prelude.Text)
patchGroupPatchBaselineMapping_patchGroup :: Lens' PatchGroupPatchBaselineMapping (Maybe Text)
patchGroupPatchBaselineMapping_patchGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchGroupPatchBaselineMapping' {Maybe Text
patchGroup :: Maybe Text
$sel:patchGroup:PatchGroupPatchBaselineMapping' :: PatchGroupPatchBaselineMapping -> Maybe Text
patchGroup} -> Maybe Text
patchGroup) (\s :: PatchGroupPatchBaselineMapping
s@PatchGroupPatchBaselineMapping' {} Maybe Text
a -> PatchGroupPatchBaselineMapping
s {$sel:patchGroup:PatchGroupPatchBaselineMapping' :: Maybe Text
patchGroup = Maybe Text
a} :: PatchGroupPatchBaselineMapping)

instance Data.FromJSON PatchGroupPatchBaselineMapping where
  parseJSON :: Value -> Parser PatchGroupPatchBaselineMapping
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PatchGroupPatchBaselineMapping"
      ( \Object
x ->
          Maybe PatchBaselineIdentity
-> Maybe Text -> PatchGroupPatchBaselineMapping
PatchGroupPatchBaselineMapping'
            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
"BaselineIdentity")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PatchGroup")
      )

instance
  Prelude.Hashable
    PatchGroupPatchBaselineMapping
  where
  hashWithSalt :: Int -> PatchGroupPatchBaselineMapping -> Int
hashWithSalt
    Int
_salt
    PatchGroupPatchBaselineMapping' {Maybe Text
Maybe PatchBaselineIdentity
patchGroup :: Maybe Text
baselineIdentity :: Maybe PatchBaselineIdentity
$sel:patchGroup:PatchGroupPatchBaselineMapping' :: PatchGroupPatchBaselineMapping -> Maybe Text
$sel:baselineIdentity:PatchGroupPatchBaselineMapping' :: PatchGroupPatchBaselineMapping -> Maybe PatchBaselineIdentity
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PatchBaselineIdentity
baselineIdentity
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
patchGroup

instance
  Prelude.NFData
    PatchGroupPatchBaselineMapping
  where
  rnf :: PatchGroupPatchBaselineMapping -> ()
rnf PatchGroupPatchBaselineMapping' {Maybe Text
Maybe PatchBaselineIdentity
patchGroup :: Maybe Text
baselineIdentity :: Maybe PatchBaselineIdentity
$sel:patchGroup:PatchGroupPatchBaselineMapping' :: PatchGroupPatchBaselineMapping -> Maybe Text
$sel:baselineIdentity:PatchGroupPatchBaselineMapping' :: PatchGroupPatchBaselineMapping -> Maybe PatchBaselineIdentity
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PatchBaselineIdentity
baselineIdentity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
patchGroup