{-# 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.PatchFilter 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.PatchFilterKey
data PatchFilter = PatchFilter'
{
PatchFilter -> PatchFilterKey
key :: PatchFilterKey,
PatchFilter -> NonEmpty Text
values :: Prelude.NonEmpty Prelude.Text
}
deriving (PatchFilter -> PatchFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PatchFilter -> PatchFilter -> Bool
$c/= :: PatchFilter -> PatchFilter -> Bool
== :: PatchFilter -> PatchFilter -> Bool
$c== :: PatchFilter -> PatchFilter -> Bool
Prelude.Eq, ReadPrec [PatchFilter]
ReadPrec PatchFilter
Int -> ReadS PatchFilter
ReadS [PatchFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PatchFilter]
$creadListPrec :: ReadPrec [PatchFilter]
readPrec :: ReadPrec PatchFilter
$creadPrec :: ReadPrec PatchFilter
readList :: ReadS [PatchFilter]
$creadList :: ReadS [PatchFilter]
readsPrec :: Int -> ReadS PatchFilter
$creadsPrec :: Int -> ReadS PatchFilter
Prelude.Read, Int -> PatchFilter -> ShowS
[PatchFilter] -> ShowS
PatchFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PatchFilter] -> ShowS
$cshowList :: [PatchFilter] -> ShowS
show :: PatchFilter -> String
$cshow :: PatchFilter -> String
showsPrec :: Int -> PatchFilter -> ShowS
$cshowsPrec :: Int -> PatchFilter -> ShowS
Prelude.Show, forall x. Rep PatchFilter x -> PatchFilter
forall x. PatchFilter -> Rep PatchFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PatchFilter x -> PatchFilter
$cfrom :: forall x. PatchFilter -> Rep PatchFilter x
Prelude.Generic)
newPatchFilter ::
PatchFilterKey ->
Prelude.NonEmpty Prelude.Text ->
PatchFilter
newPatchFilter :: PatchFilterKey -> NonEmpty Text -> PatchFilter
newPatchFilter PatchFilterKey
pKey_ NonEmpty Text
pValues_ =
PatchFilter'
{ $sel:key:PatchFilter' :: PatchFilterKey
key = PatchFilterKey
pKey_,
$sel:values:PatchFilter' :: NonEmpty Text
values = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pValues_
}
patchFilter_key :: Lens.Lens' PatchFilter PatchFilterKey
patchFilter_key :: Lens' PatchFilter PatchFilterKey
patchFilter_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchFilter' {PatchFilterKey
key :: PatchFilterKey
$sel:key:PatchFilter' :: PatchFilter -> PatchFilterKey
key} -> PatchFilterKey
key) (\s :: PatchFilter
s@PatchFilter' {} PatchFilterKey
a -> PatchFilter
s {$sel:key:PatchFilter' :: PatchFilterKey
key = PatchFilterKey
a} :: PatchFilter)
patchFilter_values :: Lens.Lens' PatchFilter (Prelude.NonEmpty Prelude.Text)
patchFilter_values :: Lens' PatchFilter (NonEmpty Text)
patchFilter_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PatchFilter' {NonEmpty Text
values :: NonEmpty Text
$sel:values:PatchFilter' :: PatchFilter -> NonEmpty Text
values} -> NonEmpty Text
values) (\s :: PatchFilter
s@PatchFilter' {} NonEmpty Text
a -> PatchFilter
s {$sel:values:PatchFilter' :: NonEmpty Text
values = NonEmpty Text
a} :: PatchFilter) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON PatchFilter where
parseJSON :: Value -> Parser PatchFilter
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PatchFilter"
( \Object
x ->
PatchFilterKey -> NonEmpty Text -> PatchFilter
PatchFilter'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Key")
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
"Values")
)
instance Prelude.Hashable PatchFilter where
hashWithSalt :: Int -> PatchFilter -> Int
hashWithSalt Int
_salt PatchFilter' {NonEmpty Text
PatchFilterKey
values :: NonEmpty Text
key :: PatchFilterKey
$sel:values:PatchFilter' :: PatchFilter -> NonEmpty Text
$sel:key:PatchFilter' :: PatchFilter -> PatchFilterKey
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PatchFilterKey
key
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
values
instance Prelude.NFData PatchFilter where
rnf :: PatchFilter -> ()
rnf PatchFilter' {NonEmpty Text
PatchFilterKey
values :: NonEmpty Text
key :: PatchFilterKey
$sel:values:PatchFilter' :: PatchFilter -> NonEmpty Text
$sel:key:PatchFilter' :: PatchFilter -> PatchFilterKey
..} =
forall a. NFData a => a -> ()
Prelude.rnf PatchFilterKey
key seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
values
instance Data.ToJSON PatchFilter where
toJSON :: PatchFilter -> Value
toJSON PatchFilter' {NonEmpty Text
PatchFilterKey
values :: NonEmpty Text
key :: PatchFilterKey
$sel:values:PatchFilter' :: PatchFilter -> NonEmpty Text
$sel:key:PatchFilter' :: PatchFilter -> PatchFilterKey
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PatchFilterKey
key),
forall a. a -> Maybe a
Prelude.Just (Key
"Values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
values)
]
)