{-# 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.Glue.Types.FilterValue where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.FilterValueType
import qualified Amazonka.Prelude as Prelude
data FilterValue = FilterValue'
{
FilterValue -> FilterValueType
type' :: FilterValueType,
FilterValue -> [Text]
value :: [Prelude.Text]
}
deriving (FilterValue -> FilterValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FilterValue -> FilterValue -> Bool
$c/= :: FilterValue -> FilterValue -> Bool
== :: FilterValue -> FilterValue -> Bool
$c== :: FilterValue -> FilterValue -> Bool
Prelude.Eq, ReadPrec [FilterValue]
ReadPrec FilterValue
Int -> ReadS FilterValue
ReadS [FilterValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FilterValue]
$creadListPrec :: ReadPrec [FilterValue]
readPrec :: ReadPrec FilterValue
$creadPrec :: ReadPrec FilterValue
readList :: ReadS [FilterValue]
$creadList :: ReadS [FilterValue]
readsPrec :: Int -> ReadS FilterValue
$creadsPrec :: Int -> ReadS FilterValue
Prelude.Read, Int -> FilterValue -> ShowS
[FilterValue] -> ShowS
FilterValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FilterValue] -> ShowS
$cshowList :: [FilterValue] -> ShowS
show :: FilterValue -> String
$cshow :: FilterValue -> String
showsPrec :: Int -> FilterValue -> ShowS
$cshowsPrec :: Int -> FilterValue -> ShowS
Prelude.Show, forall x. Rep FilterValue x -> FilterValue
forall x. FilterValue -> Rep FilterValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FilterValue x -> FilterValue
$cfrom :: forall x. FilterValue -> Rep FilterValue x
Prelude.Generic)
newFilterValue ::
FilterValueType ->
FilterValue
newFilterValue :: FilterValueType -> FilterValue
newFilterValue FilterValueType
pType_ =
FilterValue'
{ $sel:type':FilterValue' :: FilterValueType
type' = FilterValueType
pType_,
$sel:value:FilterValue' :: [Text]
value = forall a. Monoid a => a
Prelude.mempty
}
filterValue_type :: Lens.Lens' FilterValue FilterValueType
filterValue_type :: Lens' FilterValue FilterValueType
filterValue_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterValue' {FilterValueType
type' :: FilterValueType
$sel:type':FilterValue' :: FilterValue -> FilterValueType
type'} -> FilterValueType
type') (\s :: FilterValue
s@FilterValue' {} FilterValueType
a -> FilterValue
s {$sel:type':FilterValue' :: FilterValueType
type' = FilterValueType
a} :: FilterValue)
filterValue_value :: Lens.Lens' FilterValue [Prelude.Text]
filterValue_value :: Lens' FilterValue [Text]
filterValue_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FilterValue' {[Text]
value :: [Text]
$sel:value:FilterValue' :: FilterValue -> [Text]
value} -> [Text]
value) (\s :: FilterValue
s@FilterValue' {} [Text]
a -> FilterValue
s {$sel:value:FilterValue' :: [Text]
value = [Text]
a} :: FilterValue) 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 FilterValue where
parseJSON :: Value -> Parser FilterValue
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"FilterValue"
( \Object
x ->
FilterValueType -> [Text] -> FilterValue
FilterValue'
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
"Type")
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
"Value" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable FilterValue where
hashWithSalt :: Int -> FilterValue -> Int
hashWithSalt Int
_salt FilterValue' {[Text]
FilterValueType
value :: [Text]
type' :: FilterValueType
$sel:value:FilterValue' :: FilterValue -> [Text]
$sel:type':FilterValue' :: FilterValue -> FilterValueType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FilterValueType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
value
instance Prelude.NFData FilterValue where
rnf :: FilterValue -> ()
rnf FilterValue' {[Text]
FilterValueType
value :: [Text]
type' :: FilterValueType
$sel:value:FilterValue' :: FilterValue -> [Text]
$sel:type':FilterValue' :: FilterValue -> FilterValueType
..} =
forall a. NFData a => a -> ()
Prelude.rnf FilterValueType
type' seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
value
instance Data.ToJSON FilterValue where
toJSON :: FilterValue -> Value
toJSON FilterValue' {[Text]
FilterValueType
value :: [Text]
type' :: FilterValueType
$sel:value:FilterValue' :: FilterValue -> [Text]
$sel:type':FilterValue' :: FilterValue -> FilterValueType
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= FilterValueType
type'),
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
value)
]
)