{-# 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.Lens as Lens
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
(PatchFilter -> PatchFilter -> Bool)
-> (PatchFilter -> PatchFilter -> Bool) -> Eq PatchFilter
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]
(Int -> ReadS PatchFilter)
-> ReadS [PatchFilter]
-> ReadPrec PatchFilter
-> ReadPrec [PatchFilter]
-> Read 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
(Int -> PatchFilter -> ShowS)
-> (PatchFilter -> String)
-> ([PatchFilter] -> ShowS)
-> Show PatchFilter
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. PatchFilter -> Rep PatchFilter x)
-> (forall x. Rep PatchFilter x -> PatchFilter)
-> Generic PatchFilter
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' :: PatchFilterKey -> NonEmpty Text -> PatchFilter
PatchFilter'
{ $sel:key:PatchFilter' :: PatchFilterKey
key = PatchFilterKey
pKey_,
$sel:values:PatchFilter' :: NonEmpty Text
values = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pValues_
}
patchFilter_key :: Lens.Lens' PatchFilter PatchFilterKey
patchFilter_key :: (PatchFilterKey -> f PatchFilterKey)
-> PatchFilter -> f PatchFilter
patchFilter_key = (PatchFilter -> PatchFilterKey)
-> (PatchFilter -> PatchFilterKey -> PatchFilter)
-> Lens PatchFilter PatchFilter PatchFilterKey PatchFilterKey
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 :: (NonEmpty Text -> f (NonEmpty Text))
-> PatchFilter -> f PatchFilter
patchFilter_values = (PatchFilter -> NonEmpty Text)
-> (PatchFilter -> NonEmpty Text -> PatchFilter)
-> Lens PatchFilter PatchFilter (NonEmpty Text) (NonEmpty Text)
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) ((NonEmpty Text -> f (NonEmpty Text))
-> PatchFilter -> f PatchFilter)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> PatchFilter
-> f PatchFilter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON PatchFilter where
parseJSON :: Value -> Parser PatchFilter
parseJSON =
String
-> (Object -> Parser PatchFilter) -> Value -> Parser PatchFilter
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PatchFilter"
( \Object
x ->
PatchFilterKey -> NonEmpty Text -> PatchFilter
PatchFilter'
(PatchFilterKey -> NonEmpty Text -> PatchFilter)
-> Parser PatchFilterKey -> Parser (NonEmpty Text -> PatchFilter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser PatchFilterKey
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Key") Parser (NonEmpty Text -> PatchFilter)
-> Parser (NonEmpty Text) -> Parser PatchFilter
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Values")
)
instance Prelude.Hashable PatchFilter
instance Prelude.NFData PatchFilter
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Key" Text -> PatchFilterKey -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PatchFilterKey
key),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Values" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
values)
]
)