{-# 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.Pricing.Types.Filter 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.Pricing.Types.FilterType
data Filter = Filter'
{
Filter -> FilterType
type' :: FilterType,
Filter -> Text
field :: Prelude.Text,
Filter -> Text
value :: Prelude.Text
}
deriving (Filter -> Filter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Filter -> Filter -> Bool
$c/= :: Filter -> Filter -> Bool
== :: Filter -> Filter -> Bool
$c== :: Filter -> Filter -> Bool
Prelude.Eq, ReadPrec [Filter]
ReadPrec Filter
Int -> ReadS Filter
ReadS [Filter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Filter]
$creadListPrec :: ReadPrec [Filter]
readPrec :: ReadPrec Filter
$creadPrec :: ReadPrec Filter
readList :: ReadS [Filter]
$creadList :: ReadS [Filter]
readsPrec :: Int -> ReadS Filter
$creadsPrec :: Int -> ReadS Filter
Prelude.Read, Int -> Filter -> ShowS
[Filter] -> ShowS
Filter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Filter] -> ShowS
$cshowList :: [Filter] -> ShowS
show :: Filter -> String
$cshow :: Filter -> String
showsPrec :: Int -> Filter -> ShowS
$cshowsPrec :: Int -> Filter -> ShowS
Prelude.Show, forall x. Rep Filter x -> Filter
forall x. Filter -> Rep Filter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Filter x -> Filter
$cfrom :: forall x. Filter -> Rep Filter x
Prelude.Generic)
newFilter ::
FilterType ->
Prelude.Text ->
Prelude.Text ->
Filter
newFilter :: FilterType -> Text -> Text -> Filter
newFilter FilterType
pType_ Text
pField_ Text
pValue_ =
Filter'
{ $sel:type':Filter' :: FilterType
type' = FilterType
pType_,
$sel:field:Filter' :: Text
field = Text
pField_,
$sel:value:Filter' :: Text
value = Text
pValue_
}
filter_type :: Lens.Lens' Filter FilterType
filter_type :: Lens' Filter FilterType
filter_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Filter' {FilterType
type' :: FilterType
$sel:type':Filter' :: Filter -> FilterType
type'} -> FilterType
type') (\s :: Filter
s@Filter' {} FilterType
a -> Filter
s {$sel:type':Filter' :: FilterType
type' = FilterType
a} :: Filter)
filter_field :: Lens.Lens' Filter Prelude.Text
filter_field :: Lens' Filter Text
filter_field = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Filter' {Text
field :: Text
$sel:field:Filter' :: Filter -> Text
field} -> Text
field) (\s :: Filter
s@Filter' {} Text
a -> Filter
s {$sel:field:Filter' :: Text
field = Text
a} :: Filter)
filter_value :: Lens.Lens' Filter Prelude.Text
filter_value :: Lens' Filter Text
filter_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Filter' {Text
value :: Text
$sel:value:Filter' :: Filter -> Text
value} -> Text
value) (\s :: Filter
s@Filter' {} Text
a -> Filter
s {$sel:value:Filter' :: Text
value = Text
a} :: Filter)
instance Prelude.Hashable Filter where
hashWithSalt :: Int -> Filter -> Int
hashWithSalt Int
_salt Filter' {Text
FilterType
value :: Text
field :: Text
type' :: FilterType
$sel:value:Filter' :: Filter -> Text
$sel:field:Filter' :: Filter -> Text
$sel:type':Filter' :: Filter -> FilterType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FilterType
type'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
field
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value
instance Prelude.NFData Filter where
rnf :: Filter -> ()
rnf Filter' {Text
FilterType
value :: Text
field :: Text
type' :: FilterType
$sel:value:Filter' :: Filter -> Text
$sel:field:Filter' :: Filter -> Text
$sel:type':Filter' :: Filter -> FilterType
..} =
forall a. NFData a => a -> ()
Prelude.rnf FilterType
type'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
field
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value
instance Data.ToJSON Filter where
toJSON :: Filter -> Value
toJSON Filter' {Text
FilterType
value :: Text
field :: Text
type' :: FilterType
$sel:value:Filter' :: Filter -> Text
$sel:field:Filter' :: Filter -> Text
$sel:type':Filter' :: Filter -> FilterType
..} =
[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..= FilterType
type'),
forall a. a -> Maybe a
Prelude.Just (Key
"Field" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
field),
forall a. a -> Maybe a
Prelude.Just (Key
"Value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value)
]
)