{-# 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.CostExplorer.Types.CostCategoryValues where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CostExplorer.Types.MatchOption
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data CostCategoryValues = CostCategoryValues'
{ CostCategoryValues -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
CostCategoryValues -> Maybe [MatchOption]
matchOptions :: Prelude.Maybe [MatchOption],
CostCategoryValues -> Maybe [Text]
values :: Prelude.Maybe [Prelude.Text]
}
deriving (CostCategoryValues -> CostCategoryValues -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CostCategoryValues -> CostCategoryValues -> Bool
$c/= :: CostCategoryValues -> CostCategoryValues -> Bool
== :: CostCategoryValues -> CostCategoryValues -> Bool
$c== :: CostCategoryValues -> CostCategoryValues -> Bool
Prelude.Eq, ReadPrec [CostCategoryValues]
ReadPrec CostCategoryValues
Int -> ReadS CostCategoryValues
ReadS [CostCategoryValues]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CostCategoryValues]
$creadListPrec :: ReadPrec [CostCategoryValues]
readPrec :: ReadPrec CostCategoryValues
$creadPrec :: ReadPrec CostCategoryValues
readList :: ReadS [CostCategoryValues]
$creadList :: ReadS [CostCategoryValues]
readsPrec :: Int -> ReadS CostCategoryValues
$creadsPrec :: Int -> ReadS CostCategoryValues
Prelude.Read, Int -> CostCategoryValues -> ShowS
[CostCategoryValues] -> ShowS
CostCategoryValues -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CostCategoryValues] -> ShowS
$cshowList :: [CostCategoryValues] -> ShowS
show :: CostCategoryValues -> String
$cshow :: CostCategoryValues -> String
showsPrec :: Int -> CostCategoryValues -> ShowS
$cshowsPrec :: Int -> CostCategoryValues -> ShowS
Prelude.Show, forall x. Rep CostCategoryValues x -> CostCategoryValues
forall x. CostCategoryValues -> Rep CostCategoryValues x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CostCategoryValues x -> CostCategoryValues
$cfrom :: forall x. CostCategoryValues -> Rep CostCategoryValues x
Prelude.Generic)
newCostCategoryValues ::
CostCategoryValues
newCostCategoryValues :: CostCategoryValues
newCostCategoryValues =
CostCategoryValues'
{ $sel:key:CostCategoryValues' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
$sel:matchOptions:CostCategoryValues' :: Maybe [MatchOption]
matchOptions = forall a. Maybe a
Prelude.Nothing,
$sel:values:CostCategoryValues' :: Maybe [Text]
values = forall a. Maybe a
Prelude.Nothing
}
costCategoryValues_key :: Lens.Lens' CostCategoryValues (Prelude.Maybe Prelude.Text)
costCategoryValues_key :: Lens' CostCategoryValues (Maybe Text)
costCategoryValues_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategoryValues' {Maybe Text
key :: Maybe Text
$sel:key:CostCategoryValues' :: CostCategoryValues -> Maybe Text
key} -> Maybe Text
key) (\s :: CostCategoryValues
s@CostCategoryValues' {} Maybe Text
a -> CostCategoryValues
s {$sel:key:CostCategoryValues' :: Maybe Text
key = Maybe Text
a} :: CostCategoryValues)
costCategoryValues_matchOptions :: Lens.Lens' CostCategoryValues (Prelude.Maybe [MatchOption])
costCategoryValues_matchOptions :: Lens' CostCategoryValues (Maybe [MatchOption])
costCategoryValues_matchOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategoryValues' {Maybe [MatchOption]
matchOptions :: Maybe [MatchOption]
$sel:matchOptions:CostCategoryValues' :: CostCategoryValues -> Maybe [MatchOption]
matchOptions} -> Maybe [MatchOption]
matchOptions) (\s :: CostCategoryValues
s@CostCategoryValues' {} Maybe [MatchOption]
a -> CostCategoryValues
s {$sel:matchOptions:CostCategoryValues' :: Maybe [MatchOption]
matchOptions = Maybe [MatchOption]
a} :: CostCategoryValues) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
costCategoryValues_values :: Lens.Lens' CostCategoryValues (Prelude.Maybe [Prelude.Text])
costCategoryValues_values :: Lens' CostCategoryValues (Maybe [Text])
costCategoryValues_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CostCategoryValues' {Maybe [Text]
values :: Maybe [Text]
$sel:values:CostCategoryValues' :: CostCategoryValues -> Maybe [Text]
values} -> Maybe [Text]
values) (\s :: CostCategoryValues
s@CostCategoryValues' {} Maybe [Text]
a -> CostCategoryValues
s {$sel:values:CostCategoryValues' :: Maybe [Text]
values = Maybe [Text]
a} :: CostCategoryValues) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON CostCategoryValues where
parseJSON :: Value -> Parser CostCategoryValues
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CostCategoryValues"
( \Object
x ->
Maybe Text
-> Maybe [MatchOption] -> Maybe [Text] -> CostCategoryValues
CostCategoryValues'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe 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 (Maybe a)
Data..:? Key
"MatchOptions" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"Values" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable CostCategoryValues where
hashWithSalt :: Int -> CostCategoryValues -> Int
hashWithSalt Int
_salt CostCategoryValues' {Maybe [Text]
Maybe [MatchOption]
Maybe Text
values :: Maybe [Text]
matchOptions :: Maybe [MatchOption]
key :: Maybe Text
$sel:values:CostCategoryValues' :: CostCategoryValues -> Maybe [Text]
$sel:matchOptions:CostCategoryValues' :: CostCategoryValues -> Maybe [MatchOption]
$sel:key:CostCategoryValues' :: CostCategoryValues -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [MatchOption]
matchOptions
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
values
instance Prelude.NFData CostCategoryValues where
rnf :: CostCategoryValues -> ()
rnf CostCategoryValues' {Maybe [Text]
Maybe [MatchOption]
Maybe Text
values :: Maybe [Text]
matchOptions :: Maybe [MatchOption]
key :: Maybe Text
$sel:values:CostCategoryValues' :: CostCategoryValues -> Maybe [Text]
$sel:matchOptions:CostCategoryValues' :: CostCategoryValues -> Maybe [MatchOption]
$sel:key:CostCategoryValues' :: CostCategoryValues -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MatchOption]
matchOptions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
values
instance Data.ToJSON CostCategoryValues where
toJSON :: CostCategoryValues -> Value
toJSON CostCategoryValues' {Maybe [Text]
Maybe [MatchOption]
Maybe Text
values :: Maybe [Text]
matchOptions :: Maybe [MatchOption]
key :: Maybe Text
$sel:values:CostCategoryValues' :: CostCategoryValues -> Maybe [Text]
$sel:matchOptions:CostCategoryValues' :: CostCategoryValues -> Maybe [MatchOption]
$sel:key:CostCategoryValues' :: CostCategoryValues -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
key,
(Key
"MatchOptions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [MatchOption]
matchOptions,
(Key
"Values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
values
]
)