{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 PatchComplianceLevel
complianceLevel :: Prelude.Maybe PatchComplianceLevel,
PatchRule -> Maybe Bool
enableNonSecurity :: Prelude.Maybe Prelude.Bool,
PatchRule -> PatchFilterGroup
patchFilterGroup :: PatchFilterGroup
}
deriving (PatchRule -> PatchRule -> Bool
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]
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
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. 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'
{ $sel:approveAfterDays:PatchRule' :: Maybe Natural
approveAfterDays = forall a. Maybe a
Prelude.Nothing,
$sel:approveUntilDate:PatchRule' :: Maybe Text
approveUntilDate = forall a. Maybe a
Prelude.Nothing,
$sel:complianceLevel:PatchRule' :: Maybe PatchComplianceLevel
complianceLevel = forall a. Maybe a
Prelude.Nothing,
$sel:enableNonSecurity:PatchRule' :: Maybe Bool
enableNonSecurity = forall a. Maybe a
Prelude.Nothing,
$sel:patchFilterGroup:PatchRule' :: PatchFilterGroup
patchFilterGroup = PatchFilterGroup
pPatchFilterGroup_
}
patchRule_approveAfterDays :: Lens.Lens' PatchRule (Prelude.Maybe Prelude.Natural)
patchRule_approveAfterDays :: Lens' PatchRule (Maybe Natural)
patchRule_approveAfterDays = 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 :: Lens' PatchRule (Maybe Text)
patchRule_approveUntilDate = 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_complianceLevel :: Lens.Lens' PatchRule (Prelude.Maybe PatchComplianceLevel)
patchRule_complianceLevel :: Lens' PatchRule (Maybe PatchComplianceLevel)
patchRule_complianceLevel = 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_enableNonSecurity :: Lens.Lens' PatchRule (Prelude.Maybe Prelude.Bool)
patchRule_enableNonSecurity :: Lens' PatchRule (Maybe Bool)
patchRule_enableNonSecurity = 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_patchFilterGroup :: Lens.Lens' PatchRule PatchFilterGroup
patchRule_patchFilterGroup :: Lens' PatchRule PatchFilterGroup
patchRule_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 Data.FromJSON PatchRule where
parseJSON :: Value -> Parser PatchRule
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PatchRule"
( \Object
x ->
Maybe Natural
-> Maybe Text
-> Maybe PatchComplianceLevel
-> Maybe Bool
-> PatchFilterGroup
-> PatchRule
PatchRule'
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
"ApproveAfterDays")
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
"ApproveUntilDate")
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
"ComplianceLevel")
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
"EnableNonSecurity")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"PatchFilterGroup")
)
instance Prelude.Hashable PatchRule where
hashWithSalt :: Int -> PatchRule -> Int
hashWithSalt Int
_salt PatchRule' {Maybe Bool
Maybe Natural
Maybe Text
Maybe PatchComplianceLevel
PatchFilterGroup
patchFilterGroup :: PatchFilterGroup
enableNonSecurity :: Maybe Bool
complianceLevel :: Maybe PatchComplianceLevel
approveUntilDate :: Maybe Text
approveAfterDays :: Maybe Natural
$sel:patchFilterGroup:PatchRule' :: PatchRule -> PatchFilterGroup
$sel:enableNonSecurity:PatchRule' :: PatchRule -> Maybe Bool
$sel:complianceLevel:PatchRule' :: PatchRule -> Maybe PatchComplianceLevel
$sel:approveUntilDate:PatchRule' :: PatchRule -> Maybe Text
$sel:approveAfterDays:PatchRule' :: PatchRule -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
approveAfterDays
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
approveUntilDate
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PatchComplianceLevel
complianceLevel
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enableNonSecurity
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PatchFilterGroup
patchFilterGroup
instance Prelude.NFData PatchRule where
rnf :: PatchRule -> ()
rnf PatchRule' {Maybe Bool
Maybe Natural
Maybe Text
Maybe PatchComplianceLevel
PatchFilterGroup
patchFilterGroup :: PatchFilterGroup
enableNonSecurity :: Maybe Bool
complianceLevel :: Maybe PatchComplianceLevel
approveUntilDate :: Maybe Text
approveAfterDays :: Maybe Natural
$sel:patchFilterGroup:PatchRule' :: PatchRule -> PatchFilterGroup
$sel:enableNonSecurity:PatchRule' :: PatchRule -> Maybe Bool
$sel:complianceLevel:PatchRule' :: PatchRule -> Maybe PatchComplianceLevel
$sel:approveUntilDate:PatchRule' :: PatchRule -> Maybe Text
$sel:approveAfterDays:PatchRule' :: PatchRule -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
approveAfterDays
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
approveUntilDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PatchComplianceLevel
complianceLevel
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enableNonSecurity
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PatchFilterGroup
patchFilterGroup
instance Data.ToJSON PatchRule where
toJSON :: PatchRule -> Value
toJSON PatchRule' {Maybe Bool
Maybe Natural
Maybe Text
Maybe PatchComplianceLevel
PatchFilterGroup
patchFilterGroup :: PatchFilterGroup
enableNonSecurity :: Maybe Bool
complianceLevel :: Maybe PatchComplianceLevel
approveUntilDate :: Maybe Text
approveAfterDays :: Maybe Natural
$sel:patchFilterGroup:PatchRule' :: PatchRule -> PatchFilterGroup
$sel:enableNonSecurity:PatchRule' :: PatchRule -> Maybe Bool
$sel:complianceLevel:PatchRule' :: PatchRule -> Maybe PatchComplianceLevel
$sel:approveUntilDate:PatchRule' :: PatchRule -> Maybe Text
$sel:approveAfterDays:PatchRule' :: PatchRule -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ApproveAfterDays" 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 Natural
approveAfterDays,
(Key
"ApproveUntilDate" 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 Text
approveUntilDate,
(Key
"ComplianceLevel" 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 PatchComplianceLevel
complianceLevel,
(Key
"EnableNonSecurity" 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
enableNonSecurity,
forall a. a -> Maybe a
Prelude.Just
(Key
"PatchFilterGroup" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PatchFilterGroup
patchFilterGroup)
]
)