{-# 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 #-}
module Amazonka.SSM.Types.PatchRuleGroup where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.PatchRule
data PatchRuleGroup = PatchRuleGroup'
{
PatchRuleGroup -> [PatchRule]
patchRules :: [PatchRule]
}
deriving (PatchRuleGroup -> PatchRuleGroup -> Bool
(PatchRuleGroup -> PatchRuleGroup -> Bool)
-> (PatchRuleGroup -> PatchRuleGroup -> Bool) -> Eq PatchRuleGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatchRuleGroup -> PatchRuleGroup -> Bool
$c/= :: PatchRuleGroup -> PatchRuleGroup -> Bool
== :: PatchRuleGroup -> PatchRuleGroup -> Bool
$c== :: PatchRuleGroup -> PatchRuleGroup -> Bool
Prelude.Eq, ReadPrec [PatchRuleGroup]
ReadPrec PatchRuleGroup
Int -> ReadS PatchRuleGroup
ReadS [PatchRuleGroup]
(Int -> ReadS PatchRuleGroup)
-> ReadS [PatchRuleGroup]
-> ReadPrec PatchRuleGroup
-> ReadPrec [PatchRuleGroup]
-> Read PatchRuleGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PatchRuleGroup]
$creadListPrec :: ReadPrec [PatchRuleGroup]
readPrec :: ReadPrec PatchRuleGroup
$creadPrec :: ReadPrec PatchRuleGroup
readList :: ReadS [PatchRuleGroup]
$creadList :: ReadS [PatchRuleGroup]
readsPrec :: Int -> ReadS PatchRuleGroup
$creadsPrec :: Int -> ReadS PatchRuleGroup
Prelude.Read, Int -> PatchRuleGroup -> ShowS
[PatchRuleGroup] -> ShowS
PatchRuleGroup -> String
(Int -> PatchRuleGroup -> ShowS)
-> (PatchRuleGroup -> String)
-> ([PatchRuleGroup] -> ShowS)
-> Show PatchRuleGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatchRuleGroup] -> ShowS
$cshowList :: [PatchRuleGroup] -> ShowS
show :: PatchRuleGroup -> String
$cshow :: PatchRuleGroup -> String
showsPrec :: Int -> PatchRuleGroup -> ShowS
$cshowsPrec :: Int -> PatchRuleGroup -> ShowS
Prelude.Show, (forall x. PatchRuleGroup -> Rep PatchRuleGroup x)
-> (forall x. Rep PatchRuleGroup x -> PatchRuleGroup)
-> Generic PatchRuleGroup
forall x. Rep PatchRuleGroup x -> PatchRuleGroup
forall x. PatchRuleGroup -> Rep PatchRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PatchRuleGroup x -> PatchRuleGroup
$cfrom :: forall x. PatchRuleGroup -> Rep PatchRuleGroup x
Prelude.Generic)
newPatchRuleGroup ::
PatchRuleGroup
newPatchRuleGroup :: PatchRuleGroup
newPatchRuleGroup =
PatchRuleGroup' :: [PatchRule] -> PatchRuleGroup
PatchRuleGroup' {$sel:patchRules:PatchRuleGroup' :: [PatchRule]
patchRules = [PatchRule]
forall a. Monoid a => a
Prelude.mempty}
patchRuleGroup_patchRules :: Lens.Lens' PatchRuleGroup [PatchRule]
patchRuleGroup_patchRules :: ([PatchRule] -> f [PatchRule])
-> PatchRuleGroup -> f PatchRuleGroup
patchRuleGroup_patchRules = (PatchRuleGroup -> [PatchRule])
-> (PatchRuleGroup -> [PatchRule] -> PatchRuleGroup)
-> Lens PatchRuleGroup PatchRuleGroup [PatchRule] [PatchRule]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchRuleGroup' {[PatchRule]
patchRules :: [PatchRule]
$sel:patchRules:PatchRuleGroup' :: PatchRuleGroup -> [PatchRule]
patchRules} -> [PatchRule]
patchRules) (\s :: PatchRuleGroup
s@PatchRuleGroup' {} [PatchRule]
a -> PatchRuleGroup
s {$sel:patchRules:PatchRuleGroup' :: [PatchRule]
patchRules = [PatchRule]
a} :: PatchRuleGroup) (([PatchRule] -> f [PatchRule])
-> PatchRuleGroup -> f PatchRuleGroup)
-> (([PatchRule] -> f [PatchRule]) -> [PatchRule] -> f [PatchRule])
-> ([PatchRule] -> f [PatchRule])
-> PatchRuleGroup
-> f PatchRuleGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PatchRule] -> f [PatchRule]) -> [PatchRule] -> f [PatchRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON PatchRuleGroup where
parseJSON :: Value -> Parser PatchRuleGroup
parseJSON =
String
-> (Object -> Parser PatchRuleGroup)
-> Value
-> Parser PatchRuleGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PatchRuleGroup"
( \Object
x ->
[PatchRule] -> PatchRuleGroup
PatchRuleGroup'
([PatchRule] -> PatchRuleGroup)
-> Parser [PatchRule] -> Parser PatchRuleGroup
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe [PatchRule])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PatchRules" Parser (Maybe [PatchRule]) -> [PatchRule] -> Parser [PatchRule]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [PatchRule]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable PatchRuleGroup
instance Prelude.NFData PatchRuleGroup
instance Core.ToJSON PatchRuleGroup where
toJSON :: PatchRuleGroup -> Value
toJSON PatchRuleGroup' {[PatchRule]
patchRules :: [PatchRule]
$sel:patchRules:PatchRuleGroup' :: PatchRuleGroup -> [PatchRule]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PatchRules" Text -> [PatchRule] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [PatchRule]
patchRules)]
)