{-# 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.Discovery.Types.TagFilter where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TagFilter = TagFilter'
{
TagFilter -> Text
name :: Prelude.Text,
TagFilter -> [Text]
values :: [Prelude.Text]
}
deriving (TagFilter -> TagFilter -> Bool
(TagFilter -> TagFilter -> Bool)
-> (TagFilter -> TagFilter -> Bool) -> Eq TagFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagFilter -> TagFilter -> Bool
$c/= :: TagFilter -> TagFilter -> Bool
== :: TagFilter -> TagFilter -> Bool
$c== :: TagFilter -> TagFilter -> Bool
Prelude.Eq, ReadPrec [TagFilter]
ReadPrec TagFilter
Int -> ReadS TagFilter
ReadS [TagFilter]
(Int -> ReadS TagFilter)
-> ReadS [TagFilter]
-> ReadPrec TagFilter
-> ReadPrec [TagFilter]
-> Read TagFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TagFilter]
$creadListPrec :: ReadPrec [TagFilter]
readPrec :: ReadPrec TagFilter
$creadPrec :: ReadPrec TagFilter
readList :: ReadS [TagFilter]
$creadList :: ReadS [TagFilter]
readsPrec :: Int -> ReadS TagFilter
$creadsPrec :: Int -> ReadS TagFilter
Prelude.Read, Int -> TagFilter -> ShowS
[TagFilter] -> ShowS
TagFilter -> String
(Int -> TagFilter -> ShowS)
-> (TagFilter -> String)
-> ([TagFilter] -> ShowS)
-> Show TagFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagFilter] -> ShowS
$cshowList :: [TagFilter] -> ShowS
show :: TagFilter -> String
$cshow :: TagFilter -> String
showsPrec :: Int -> TagFilter -> ShowS
$cshowsPrec :: Int -> TagFilter -> ShowS
Prelude.Show, (forall x. TagFilter -> Rep TagFilter x)
-> (forall x. Rep TagFilter x -> TagFilter) -> Generic TagFilter
forall x. Rep TagFilter x -> TagFilter
forall x. TagFilter -> Rep TagFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TagFilter x -> TagFilter
$cfrom :: forall x. TagFilter -> Rep TagFilter x
Prelude.Generic)
newTagFilter ::
Prelude.Text ->
TagFilter
newTagFilter :: Text -> TagFilter
newTagFilter Text
pName_ =
TagFilter' :: Text -> [Text] -> TagFilter
TagFilter' {$sel:name:TagFilter' :: Text
name = Text
pName_, $sel:values:TagFilter' :: [Text]
values = [Text]
forall a. Monoid a => a
Prelude.mempty}
tagFilter_name :: Lens.Lens' TagFilter Prelude.Text
tagFilter_name :: (Text -> f Text) -> TagFilter -> f TagFilter
tagFilter_name = (TagFilter -> Text)
-> (TagFilter -> Text -> TagFilter)
-> Lens TagFilter TagFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagFilter' {Text
name :: Text
$sel:name:TagFilter' :: TagFilter -> Text
name} -> Text
name) (\s :: TagFilter
s@TagFilter' {} Text
a -> TagFilter
s {$sel:name:TagFilter' :: Text
name = Text
a} :: TagFilter)
tagFilter_values :: Lens.Lens' TagFilter [Prelude.Text]
tagFilter_values :: ([Text] -> f [Text]) -> TagFilter -> f TagFilter
tagFilter_values = (TagFilter -> [Text])
-> (TagFilter -> [Text] -> TagFilter)
-> Lens TagFilter TagFilter [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagFilter' {[Text]
values :: [Text]
$sel:values:TagFilter' :: TagFilter -> [Text]
values} -> [Text]
values) (\s :: TagFilter
s@TagFilter' {} [Text]
a -> TagFilter
s {$sel:values:TagFilter' :: [Text]
values = [Text]
a} :: TagFilter) (([Text] -> f [Text]) -> TagFilter -> f TagFilter)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> TagFilter
-> f TagFilter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable TagFilter
instance Prelude.NFData TagFilter
instance Core.ToJSON TagFilter where
toJSON :: TagFilter -> Value
toJSON TagFilter' {[Text]
Text
values :: [Text]
name :: Text
$sel:values:TagFilter' :: TagFilter -> [Text]
$sel:name:TagFilter' :: TagFilter -> Text
..} =
[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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"values" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
values)
]
)