{-# 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.GroupDefinition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CostExplorer.Types.GroupDefinitionType
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data GroupDefinition = GroupDefinition'
{
GroupDefinition -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
GroupDefinition -> Maybe GroupDefinitionType
type' :: Prelude.Maybe GroupDefinitionType
}
deriving (GroupDefinition -> GroupDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GroupDefinition -> GroupDefinition -> Bool
$c/= :: GroupDefinition -> GroupDefinition -> Bool
== :: GroupDefinition -> GroupDefinition -> Bool
$c== :: GroupDefinition -> GroupDefinition -> Bool
Prelude.Eq, ReadPrec [GroupDefinition]
ReadPrec GroupDefinition
Int -> ReadS GroupDefinition
ReadS [GroupDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GroupDefinition]
$creadListPrec :: ReadPrec [GroupDefinition]
readPrec :: ReadPrec GroupDefinition
$creadPrec :: ReadPrec GroupDefinition
readList :: ReadS [GroupDefinition]
$creadList :: ReadS [GroupDefinition]
readsPrec :: Int -> ReadS GroupDefinition
$creadsPrec :: Int -> ReadS GroupDefinition
Prelude.Read, Int -> GroupDefinition -> ShowS
[GroupDefinition] -> ShowS
GroupDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GroupDefinition] -> ShowS
$cshowList :: [GroupDefinition] -> ShowS
show :: GroupDefinition -> String
$cshow :: GroupDefinition -> String
showsPrec :: Int -> GroupDefinition -> ShowS
$cshowsPrec :: Int -> GroupDefinition -> ShowS
Prelude.Show, forall x. Rep GroupDefinition x -> GroupDefinition
forall x. GroupDefinition -> Rep GroupDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GroupDefinition x -> GroupDefinition
$cfrom :: forall x. GroupDefinition -> Rep GroupDefinition x
Prelude.Generic)
newGroupDefinition ::
GroupDefinition
newGroupDefinition :: GroupDefinition
newGroupDefinition =
GroupDefinition'
{ $sel:key:GroupDefinition' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
$sel:type':GroupDefinition' :: Maybe GroupDefinitionType
type' = forall a. Maybe a
Prelude.Nothing
}
groupDefinition_key :: Lens.Lens' GroupDefinition (Prelude.Maybe Prelude.Text)
groupDefinition_key :: Lens' GroupDefinition (Maybe Text)
groupDefinition_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupDefinition' {Maybe Text
key :: Maybe Text
$sel:key:GroupDefinition' :: GroupDefinition -> Maybe Text
key} -> Maybe Text
key) (\s :: GroupDefinition
s@GroupDefinition' {} Maybe Text
a -> GroupDefinition
s {$sel:key:GroupDefinition' :: Maybe Text
key = Maybe Text
a} :: GroupDefinition)
groupDefinition_type :: Lens.Lens' GroupDefinition (Prelude.Maybe GroupDefinitionType)
groupDefinition_type :: Lens' GroupDefinition (Maybe GroupDefinitionType)
groupDefinition_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GroupDefinition' {Maybe GroupDefinitionType
type' :: Maybe GroupDefinitionType
$sel:type':GroupDefinition' :: GroupDefinition -> Maybe GroupDefinitionType
type'} -> Maybe GroupDefinitionType
type') (\s :: GroupDefinition
s@GroupDefinition' {} Maybe GroupDefinitionType
a -> GroupDefinition
s {$sel:type':GroupDefinition' :: Maybe GroupDefinitionType
type' = Maybe GroupDefinitionType
a} :: GroupDefinition)
instance Data.FromJSON GroupDefinition where
parseJSON :: Value -> Parser GroupDefinition
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"GroupDefinition"
( \Object
x ->
Maybe Text -> Maybe GroupDefinitionType -> GroupDefinition
GroupDefinition'
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
"Type")
)
instance Prelude.Hashable GroupDefinition where
hashWithSalt :: Int -> GroupDefinition -> Int
hashWithSalt Int
_salt GroupDefinition' {Maybe Text
Maybe GroupDefinitionType
type' :: Maybe GroupDefinitionType
key :: Maybe Text
$sel:type':GroupDefinition' :: GroupDefinition -> Maybe GroupDefinitionType
$sel:key:GroupDefinition' :: GroupDefinition -> 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 GroupDefinitionType
type'
instance Prelude.NFData GroupDefinition where
rnf :: GroupDefinition -> ()
rnf GroupDefinition' {Maybe Text
Maybe GroupDefinitionType
type' :: Maybe GroupDefinitionType
key :: Maybe Text
$sel:type':GroupDefinition' :: GroupDefinition -> Maybe GroupDefinitionType
$sel:key:GroupDefinition' :: GroupDefinition -> 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 GroupDefinitionType
type'
instance Data.ToJSON GroupDefinition where
toJSON :: GroupDefinition -> Value
toJSON GroupDefinition' {Maybe Text
Maybe GroupDefinitionType
type' :: Maybe GroupDefinitionType
key :: Maybe Text
$sel:type':GroupDefinition' :: GroupDefinition -> Maybe GroupDefinitionType
$sel:key:GroupDefinition' :: GroupDefinition -> 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
"Type" 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 GroupDefinitionType
type'
]
)