{-# 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.PatchRule where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.PatchComplianceLevel
import Amazonka.SSM.Types.PatchFilterGroup
data PatchRule = PatchRule'
{
PatchRule -> Maybe Natural
approveAfterDays :: Prelude.Maybe Prelude.Natural,
PatchRule -> Maybe Text
approveUntilDate :: Prelude.Maybe Prelude.Text,
PatchRule -> Maybe Bool
enableNonSecurity :: Prelude.Maybe Prelude.Bool,
PatchRule -> Maybe PatchComplianceLevel
complianceLevel :: Prelude.Maybe PatchComplianceLevel,
PatchRule -> PatchFilterGroup
patchFilterGroup :: PatchFilterGroup
}
deriving (PatchRule -> PatchRule -> Bool
(PatchRule -> PatchRule -> Bool)
-> (PatchRule -> PatchRule -> Bool) -> Eq PatchRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatchRule -> PatchRule -> Bool
$c/= :: PatchRule -> PatchRule -> Bool
== :: PatchRule -> PatchRule -> Bool
$c== :: PatchRule -> PatchRule -> Bool
Prelude.Eq, ReadPrec [PatchRule]
ReadPrec PatchRule
Int -> ReadS PatchRule
ReadS [PatchRule]
(Int -> ReadS PatchRule)
-> ReadS [PatchRule]
-> ReadPrec PatchRule
-> ReadPrec [PatchRule]
-> Read PatchRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PatchRule]
$creadListPrec :: ReadPrec [PatchRule]
readPrec :: ReadPrec PatchRule
$creadPrec :: ReadPrec PatchRule
readList :: ReadS [PatchRule]
$creadList :: ReadS [PatchRule]
readsPrec :: Int -> ReadS PatchRule
$creadsPrec :: Int -> ReadS PatchRule
Prelude.Read, Int -> PatchRule -> ShowS
[PatchRule] -> ShowS
PatchRule -> String
(Int -> PatchRule -> ShowS)
-> (PatchRule -> String)
-> ([PatchRule] -> ShowS)
-> Show PatchRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatchRule] -> ShowS
$cshowList :: [PatchRule] -> ShowS
show :: PatchRule -> String
$cshow :: PatchRule -> String
showsPrec :: Int -> PatchRule -> ShowS
$cshowsPrec :: Int -> PatchRule -> ShowS
Prelude.Show, (forall x. PatchRule -> Rep PatchRule x)
-> (forall x. Rep PatchRule x -> PatchRule) -> Generic PatchRule
forall x. Rep PatchRule x -> PatchRule
forall x. PatchRule -> Rep PatchRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PatchRule x -> PatchRule
$cfrom :: forall x. PatchRule -> Rep PatchRule x
Prelude.Generic)
newPatchRule ::
PatchFilterGroup ->
PatchRule
newPatchRule :: PatchFilterGroup -> PatchRule
newPatchRule PatchFilterGroup
pPatchFilterGroup_ =
PatchRule' :: Maybe Natural
-> Maybe Text
-> Maybe Bool
-> Maybe PatchComplianceLevel
-> PatchFilterGroup
-> PatchRule
PatchRule'
{ $sel:approveAfterDays:PatchRule' :: Maybe Natural
approveAfterDays = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:approveUntilDate:PatchRule' :: Maybe Text
approveUntilDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:enableNonSecurity:PatchRule' :: Maybe Bool
enableNonSecurity = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:complianceLevel:PatchRule' :: Maybe PatchComplianceLevel
complianceLevel = Maybe PatchComplianceLevel
forall a. Maybe a
Prelude.Nothing,
$sel:patchFilterGroup:PatchRule' :: PatchFilterGroup
patchFilterGroup = PatchFilterGroup
pPatchFilterGroup_
}
patchRule_approveAfterDays :: Lens.Lens' PatchRule (Prelude.Maybe Prelude.Natural)
patchRule_approveAfterDays :: (Maybe Natural -> f (Maybe Natural)) -> PatchRule -> f PatchRule
patchRule_approveAfterDays = (PatchRule -> Maybe Natural)
-> (PatchRule -> Maybe Natural -> PatchRule)
-> Lens PatchRule PatchRule (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchRule' {Maybe Natural
approveAfterDays :: Maybe Natural
$sel:approveAfterDays:PatchRule' :: PatchRule -> Maybe Natural
approveAfterDays} -> Maybe Natural
approveAfterDays) (\s :: PatchRule
s@PatchRule' {} Maybe Natural
a -> PatchRule
s {$sel:approveAfterDays:PatchRule' :: Maybe Natural
approveAfterDays = Maybe Natural
a} :: PatchRule)
patchRule_approveUntilDate :: Lens.Lens' PatchRule (Prelude.Maybe Prelude.Text)
patchRule_approveUntilDate :: (Maybe Text -> f (Maybe Text)) -> PatchRule -> f PatchRule
patchRule_approveUntilDate = (PatchRule -> Maybe Text)
-> (PatchRule -> Maybe Text -> PatchRule)
-> Lens PatchRule PatchRule (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchRule' {Maybe Text
approveUntilDate :: Maybe Text
$sel:approveUntilDate:PatchRule' :: PatchRule -> Maybe Text
approveUntilDate} -> Maybe Text
approveUntilDate) (\s :: PatchRule
s@PatchRule' {} Maybe Text
a -> PatchRule
s {$sel:approveUntilDate:PatchRule' :: Maybe Text
approveUntilDate = Maybe Text
a} :: PatchRule)
patchRule_enableNonSecurity :: Lens.Lens' PatchRule (Prelude.Maybe Prelude.Bool)
patchRule_enableNonSecurity :: (Maybe Bool -> f (Maybe Bool)) -> PatchRule -> f PatchRule
patchRule_enableNonSecurity = (PatchRule -> Maybe Bool)
-> (PatchRule -> Maybe Bool -> PatchRule)
-> Lens PatchRule PatchRule (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchRule' {Maybe Bool
enableNonSecurity :: Maybe Bool
$sel:enableNonSecurity:PatchRule' :: PatchRule -> Maybe Bool
enableNonSecurity} -> Maybe Bool
enableNonSecurity) (\s :: PatchRule
s@PatchRule' {} Maybe Bool
a -> PatchRule
s {$sel:enableNonSecurity:PatchRule' :: Maybe Bool
enableNonSecurity = Maybe Bool
a} :: PatchRule)
patchRule_complianceLevel :: Lens.Lens' PatchRule (Prelude.Maybe PatchComplianceLevel)
patchRule_complianceLevel :: (Maybe PatchComplianceLevel -> f (Maybe PatchComplianceLevel))
-> PatchRule -> f PatchRule
patchRule_complianceLevel = (PatchRule -> Maybe PatchComplianceLevel)
-> (PatchRule -> Maybe PatchComplianceLevel -> PatchRule)
-> Lens
PatchRule
PatchRule
(Maybe PatchComplianceLevel)
(Maybe PatchComplianceLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchRule' {Maybe PatchComplianceLevel
complianceLevel :: Maybe PatchComplianceLevel
$sel:complianceLevel:PatchRule' :: PatchRule -> Maybe PatchComplianceLevel
complianceLevel} -> Maybe PatchComplianceLevel
complianceLevel) (\s :: PatchRule
s@PatchRule' {} Maybe PatchComplianceLevel
a -> PatchRule
s {$sel:complianceLevel:PatchRule' :: Maybe PatchComplianceLevel
complianceLevel = Maybe PatchComplianceLevel
a} :: PatchRule)
patchRule_patchFilterGroup :: Lens.Lens' PatchRule PatchFilterGroup
patchRule_patchFilterGroup :: (PatchFilterGroup -> f PatchFilterGroup)
-> PatchRule -> f PatchRule
patchRule_patchFilterGroup = (PatchRule -> PatchFilterGroup)
-> (PatchRule -> PatchFilterGroup -> PatchRule)
-> Lens PatchRule PatchRule PatchFilterGroup PatchFilterGroup
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchRule' {PatchFilterGroup
patchFilterGroup :: PatchFilterGroup
$sel:patchFilterGroup:PatchRule' :: PatchRule -> PatchFilterGroup
patchFilterGroup} -> PatchFilterGroup
patchFilterGroup) (\s :: PatchRule
s@PatchRule' {} PatchFilterGroup
a -> PatchRule
s {$sel:patchFilterGroup:PatchRule' :: PatchFilterGroup
patchFilterGroup = PatchFilterGroup
a} :: PatchRule)
instance Core.FromJSON PatchRule where
parseJSON :: Value -> Parser PatchRule
parseJSON =
String -> (Object -> Parser PatchRule) -> Value -> Parser PatchRule
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PatchRule"
( \Object
x ->
Maybe Natural
-> Maybe Text
-> Maybe Bool
-> Maybe PatchComplianceLevel
-> PatchFilterGroup
-> PatchRule
PatchRule'
(Maybe Natural
-> Maybe Text
-> Maybe Bool
-> Maybe PatchComplianceLevel
-> PatchFilterGroup
-> PatchRule)
-> Parser (Maybe Natural)
-> Parser
(Maybe Text
-> Maybe Bool
-> Maybe PatchComplianceLevel
-> PatchFilterGroup
-> PatchRule)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ApproveAfterDays")
Parser
(Maybe Text
-> Maybe Bool
-> Maybe PatchComplianceLevel
-> PatchFilterGroup
-> PatchRule)
-> Parser (Maybe Text)
-> Parser
(Maybe Bool
-> Maybe PatchComplianceLevel -> PatchFilterGroup -> PatchRule)
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
"ApproveUntilDate")
Parser
(Maybe Bool
-> Maybe PatchComplianceLevel -> PatchFilterGroup -> PatchRule)
-> Parser (Maybe Bool)
-> Parser
(Maybe PatchComplianceLevel -> PatchFilterGroup -> PatchRule)
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
"EnableNonSecurity")
Parser
(Maybe PatchComplianceLevel -> PatchFilterGroup -> PatchRule)
-> Parser (Maybe PatchComplianceLevel)
-> Parser (PatchFilterGroup -> PatchRule)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PatchComplianceLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComplianceLevel")
Parser (PatchFilterGroup -> PatchRule)
-> Parser PatchFilterGroup -> Parser PatchRule
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser PatchFilterGroup
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"PatchFilterGroup")
)
instance Prelude.Hashable PatchRule
instance Prelude.NFData PatchRule
instance Core.ToJSON PatchRule where
toJSON :: PatchRule -> Value
toJSON PatchRule' {Maybe Bool
Maybe Natural
Maybe Text
Maybe PatchComplianceLevel
PatchFilterGroup
patchFilterGroup :: PatchFilterGroup
complianceLevel :: Maybe PatchComplianceLevel
enableNonSecurity :: Maybe Bool
approveUntilDate :: Maybe Text
approveAfterDays :: Maybe Natural
$sel:patchFilterGroup:PatchRule' :: PatchRule -> PatchFilterGroup
$sel:complianceLevel:PatchRule' :: PatchRule -> Maybe PatchComplianceLevel
$sel:enableNonSecurity:PatchRule' :: PatchRule -> Maybe Bool
$sel:approveUntilDate:PatchRule' :: PatchRule -> Maybe Text
$sel:approveAfterDays:PatchRule' :: PatchRule -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ApproveAfterDays" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
approveAfterDays,
(Text
"ApproveUntilDate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
approveUntilDate,
(Text
"EnableNonSecurity" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enableNonSecurity,
(Text
"ComplianceLevel" Text -> PatchComplianceLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(PatchComplianceLevel -> Pair)
-> Maybe PatchComplianceLevel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PatchComplianceLevel
complianceLevel,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"PatchFilterGroup" Text -> PatchFilterGroup -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PatchFilterGroup
patchFilterGroup)
]
)