{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CostExplorer.DescribeCostCategoryDefinition
(
DescribeCostCategoryDefinition (..),
newDescribeCostCategoryDefinition,
describeCostCategoryDefinition_effectiveOn,
describeCostCategoryDefinition_costCategoryArn,
DescribeCostCategoryDefinitionResponse (..),
newDescribeCostCategoryDefinitionResponse,
describeCostCategoryDefinitionResponse_costCategory,
describeCostCategoryDefinitionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeCostCategoryDefinition = DescribeCostCategoryDefinition'
{
DescribeCostCategoryDefinition -> Maybe Text
effectiveOn :: Prelude.Maybe Prelude.Text,
DescribeCostCategoryDefinition -> Text
costCategoryArn :: Prelude.Text
}
deriving (DescribeCostCategoryDefinition
-> DescribeCostCategoryDefinition -> Bool
(DescribeCostCategoryDefinition
-> DescribeCostCategoryDefinition -> Bool)
-> (DescribeCostCategoryDefinition
-> DescribeCostCategoryDefinition -> Bool)
-> Eq DescribeCostCategoryDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCostCategoryDefinition
-> DescribeCostCategoryDefinition -> Bool
$c/= :: DescribeCostCategoryDefinition
-> DescribeCostCategoryDefinition -> Bool
== :: DescribeCostCategoryDefinition
-> DescribeCostCategoryDefinition -> Bool
$c== :: DescribeCostCategoryDefinition
-> DescribeCostCategoryDefinition -> Bool
Prelude.Eq, ReadPrec [DescribeCostCategoryDefinition]
ReadPrec DescribeCostCategoryDefinition
Int -> ReadS DescribeCostCategoryDefinition
ReadS [DescribeCostCategoryDefinition]
(Int -> ReadS DescribeCostCategoryDefinition)
-> ReadS [DescribeCostCategoryDefinition]
-> ReadPrec DescribeCostCategoryDefinition
-> ReadPrec [DescribeCostCategoryDefinition]
-> Read DescribeCostCategoryDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCostCategoryDefinition]
$creadListPrec :: ReadPrec [DescribeCostCategoryDefinition]
readPrec :: ReadPrec DescribeCostCategoryDefinition
$creadPrec :: ReadPrec DescribeCostCategoryDefinition
readList :: ReadS [DescribeCostCategoryDefinition]
$creadList :: ReadS [DescribeCostCategoryDefinition]
readsPrec :: Int -> ReadS DescribeCostCategoryDefinition
$creadsPrec :: Int -> ReadS DescribeCostCategoryDefinition
Prelude.Read, Int -> DescribeCostCategoryDefinition -> ShowS
[DescribeCostCategoryDefinition] -> ShowS
DescribeCostCategoryDefinition -> String
(Int -> DescribeCostCategoryDefinition -> ShowS)
-> (DescribeCostCategoryDefinition -> String)
-> ([DescribeCostCategoryDefinition] -> ShowS)
-> Show DescribeCostCategoryDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCostCategoryDefinition] -> ShowS
$cshowList :: [DescribeCostCategoryDefinition] -> ShowS
show :: DescribeCostCategoryDefinition -> String
$cshow :: DescribeCostCategoryDefinition -> String
showsPrec :: Int -> DescribeCostCategoryDefinition -> ShowS
$cshowsPrec :: Int -> DescribeCostCategoryDefinition -> ShowS
Prelude.Show, (forall x.
DescribeCostCategoryDefinition
-> Rep DescribeCostCategoryDefinition x)
-> (forall x.
Rep DescribeCostCategoryDefinition x
-> DescribeCostCategoryDefinition)
-> Generic DescribeCostCategoryDefinition
forall x.
Rep DescribeCostCategoryDefinition x
-> DescribeCostCategoryDefinition
forall x.
DescribeCostCategoryDefinition
-> Rep DescribeCostCategoryDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCostCategoryDefinition x
-> DescribeCostCategoryDefinition
$cfrom :: forall x.
DescribeCostCategoryDefinition
-> Rep DescribeCostCategoryDefinition x
Prelude.Generic)
newDescribeCostCategoryDefinition ::
Prelude.Text ->
DescribeCostCategoryDefinition
newDescribeCostCategoryDefinition :: Text -> DescribeCostCategoryDefinition
newDescribeCostCategoryDefinition Text
pCostCategoryArn_ =
DescribeCostCategoryDefinition' :: Maybe Text -> Text -> DescribeCostCategoryDefinition
DescribeCostCategoryDefinition'
{ $sel:effectiveOn:DescribeCostCategoryDefinition' :: Maybe Text
effectiveOn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:costCategoryArn:DescribeCostCategoryDefinition' :: Text
costCategoryArn = Text
pCostCategoryArn_
}
describeCostCategoryDefinition_effectiveOn :: Lens.Lens' DescribeCostCategoryDefinition (Prelude.Maybe Prelude.Text)
describeCostCategoryDefinition_effectiveOn :: (Maybe Text -> f (Maybe Text))
-> DescribeCostCategoryDefinition
-> f DescribeCostCategoryDefinition
describeCostCategoryDefinition_effectiveOn = (DescribeCostCategoryDefinition -> Maybe Text)
-> (DescribeCostCategoryDefinition
-> Maybe Text -> DescribeCostCategoryDefinition)
-> Lens
DescribeCostCategoryDefinition
DescribeCostCategoryDefinition
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCostCategoryDefinition' {Maybe Text
effectiveOn :: Maybe Text
$sel:effectiveOn:DescribeCostCategoryDefinition' :: DescribeCostCategoryDefinition -> Maybe Text
effectiveOn} -> Maybe Text
effectiveOn) (\s :: DescribeCostCategoryDefinition
s@DescribeCostCategoryDefinition' {} Maybe Text
a -> DescribeCostCategoryDefinition
s {$sel:effectiveOn:DescribeCostCategoryDefinition' :: Maybe Text
effectiveOn = Maybe Text
a} :: DescribeCostCategoryDefinition)
describeCostCategoryDefinition_costCategoryArn :: Lens.Lens' DescribeCostCategoryDefinition Prelude.Text
describeCostCategoryDefinition_costCategoryArn :: (Text -> f Text)
-> DescribeCostCategoryDefinition
-> f DescribeCostCategoryDefinition
describeCostCategoryDefinition_costCategoryArn = (DescribeCostCategoryDefinition -> Text)
-> (DescribeCostCategoryDefinition
-> Text -> DescribeCostCategoryDefinition)
-> Lens
DescribeCostCategoryDefinition
DescribeCostCategoryDefinition
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCostCategoryDefinition' {Text
costCategoryArn :: Text
$sel:costCategoryArn:DescribeCostCategoryDefinition' :: DescribeCostCategoryDefinition -> Text
costCategoryArn} -> Text
costCategoryArn) (\s :: DescribeCostCategoryDefinition
s@DescribeCostCategoryDefinition' {} Text
a -> DescribeCostCategoryDefinition
s {$sel:costCategoryArn:DescribeCostCategoryDefinition' :: Text
costCategoryArn = Text
a} :: DescribeCostCategoryDefinition)
instance
Core.AWSRequest
DescribeCostCategoryDefinition
where
type
AWSResponse DescribeCostCategoryDefinition =
DescribeCostCategoryDefinitionResponse
request :: DescribeCostCategoryDefinition
-> Request DescribeCostCategoryDefinition
request = Service
-> DescribeCostCategoryDefinition
-> Request DescribeCostCategoryDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeCostCategoryDefinition
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse DescribeCostCategoryDefinition)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeCostCategoryDefinition))
-> Logger
-> Service
-> Proxy DescribeCostCategoryDefinition
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse DescribeCostCategoryDefinition)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe CostCategory -> Int -> DescribeCostCategoryDefinitionResponse
DescribeCostCategoryDefinitionResponse'
(Maybe CostCategory
-> Int -> DescribeCostCategoryDefinitionResponse)
-> Either String (Maybe CostCategory)
-> Either String (Int -> DescribeCostCategoryDefinitionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CostCategory)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CostCategory")
Either String (Int -> DescribeCostCategoryDefinitionResponse)
-> Either String Int
-> Either String DescribeCostCategoryDefinitionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance
Prelude.Hashable
DescribeCostCategoryDefinition
instance
Prelude.NFData
DescribeCostCategoryDefinition
instance
Core.ToHeaders
DescribeCostCategoryDefinition
where
toHeaders :: DescribeCostCategoryDefinition -> ResponseHeaders
toHeaders =
ResponseHeaders
-> DescribeCostCategoryDefinition -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSInsightsIndexService.DescribeCostCategoryDefinition" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON DescribeCostCategoryDefinition where
toJSON :: DescribeCostCategoryDefinition -> Value
toJSON DescribeCostCategoryDefinition' {Maybe Text
Text
costCategoryArn :: Text
effectiveOn :: Maybe Text
$sel:costCategoryArn:DescribeCostCategoryDefinition' :: DescribeCostCategoryDefinition -> Text
$sel:effectiveOn:DescribeCostCategoryDefinition' :: DescribeCostCategoryDefinition -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"EffectiveOn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
effectiveOn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"CostCategoryArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
costCategoryArn)
]
)
instance Core.ToPath DescribeCostCategoryDefinition where
toPath :: DescribeCostCategoryDefinition -> ByteString
toPath = ByteString -> DescribeCostCategoryDefinition -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeCostCategoryDefinition where
toQuery :: DescribeCostCategoryDefinition -> QueryString
toQuery = QueryString -> DescribeCostCategoryDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeCostCategoryDefinitionResponse = DescribeCostCategoryDefinitionResponse'
{ DescribeCostCategoryDefinitionResponse -> Maybe CostCategory
costCategory :: Prelude.Maybe CostCategory,
DescribeCostCategoryDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeCostCategoryDefinitionResponse
-> DescribeCostCategoryDefinitionResponse -> Bool
(DescribeCostCategoryDefinitionResponse
-> DescribeCostCategoryDefinitionResponse -> Bool)
-> (DescribeCostCategoryDefinitionResponse
-> DescribeCostCategoryDefinitionResponse -> Bool)
-> Eq DescribeCostCategoryDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCostCategoryDefinitionResponse
-> DescribeCostCategoryDefinitionResponse -> Bool
$c/= :: DescribeCostCategoryDefinitionResponse
-> DescribeCostCategoryDefinitionResponse -> Bool
== :: DescribeCostCategoryDefinitionResponse
-> DescribeCostCategoryDefinitionResponse -> Bool
$c== :: DescribeCostCategoryDefinitionResponse
-> DescribeCostCategoryDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCostCategoryDefinitionResponse]
ReadPrec DescribeCostCategoryDefinitionResponse
Int -> ReadS DescribeCostCategoryDefinitionResponse
ReadS [DescribeCostCategoryDefinitionResponse]
(Int -> ReadS DescribeCostCategoryDefinitionResponse)
-> ReadS [DescribeCostCategoryDefinitionResponse]
-> ReadPrec DescribeCostCategoryDefinitionResponse
-> ReadPrec [DescribeCostCategoryDefinitionResponse]
-> Read DescribeCostCategoryDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCostCategoryDefinitionResponse]
$creadListPrec :: ReadPrec [DescribeCostCategoryDefinitionResponse]
readPrec :: ReadPrec DescribeCostCategoryDefinitionResponse
$creadPrec :: ReadPrec DescribeCostCategoryDefinitionResponse
readList :: ReadS [DescribeCostCategoryDefinitionResponse]
$creadList :: ReadS [DescribeCostCategoryDefinitionResponse]
readsPrec :: Int -> ReadS DescribeCostCategoryDefinitionResponse
$creadsPrec :: Int -> ReadS DescribeCostCategoryDefinitionResponse
Prelude.Read, Int -> DescribeCostCategoryDefinitionResponse -> ShowS
[DescribeCostCategoryDefinitionResponse] -> ShowS
DescribeCostCategoryDefinitionResponse -> String
(Int -> DescribeCostCategoryDefinitionResponse -> ShowS)
-> (DescribeCostCategoryDefinitionResponse -> String)
-> ([DescribeCostCategoryDefinitionResponse] -> ShowS)
-> Show DescribeCostCategoryDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCostCategoryDefinitionResponse] -> ShowS
$cshowList :: [DescribeCostCategoryDefinitionResponse] -> ShowS
show :: DescribeCostCategoryDefinitionResponse -> String
$cshow :: DescribeCostCategoryDefinitionResponse -> String
showsPrec :: Int -> DescribeCostCategoryDefinitionResponse -> ShowS
$cshowsPrec :: Int -> DescribeCostCategoryDefinitionResponse -> ShowS
Prelude.Show, (forall x.
DescribeCostCategoryDefinitionResponse
-> Rep DescribeCostCategoryDefinitionResponse x)
-> (forall x.
Rep DescribeCostCategoryDefinitionResponse x
-> DescribeCostCategoryDefinitionResponse)
-> Generic DescribeCostCategoryDefinitionResponse
forall x.
Rep DescribeCostCategoryDefinitionResponse x
-> DescribeCostCategoryDefinitionResponse
forall x.
DescribeCostCategoryDefinitionResponse
-> Rep DescribeCostCategoryDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCostCategoryDefinitionResponse x
-> DescribeCostCategoryDefinitionResponse
$cfrom :: forall x.
DescribeCostCategoryDefinitionResponse
-> Rep DescribeCostCategoryDefinitionResponse x
Prelude.Generic)
newDescribeCostCategoryDefinitionResponse ::
Prelude.Int ->
DescribeCostCategoryDefinitionResponse
newDescribeCostCategoryDefinitionResponse :: Int -> DescribeCostCategoryDefinitionResponse
newDescribeCostCategoryDefinitionResponse
Int
pHttpStatus_ =
DescribeCostCategoryDefinitionResponse' :: Maybe CostCategory -> Int -> DescribeCostCategoryDefinitionResponse
DescribeCostCategoryDefinitionResponse'
{ $sel:costCategory:DescribeCostCategoryDefinitionResponse' :: Maybe CostCategory
costCategory =
Maybe CostCategory
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeCostCategoryDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeCostCategoryDefinitionResponse_costCategory :: Lens.Lens' DescribeCostCategoryDefinitionResponse (Prelude.Maybe CostCategory)
describeCostCategoryDefinitionResponse_costCategory :: (Maybe CostCategory -> f (Maybe CostCategory))
-> DescribeCostCategoryDefinitionResponse
-> f DescribeCostCategoryDefinitionResponse
describeCostCategoryDefinitionResponse_costCategory = (DescribeCostCategoryDefinitionResponse -> Maybe CostCategory)
-> (DescribeCostCategoryDefinitionResponse
-> Maybe CostCategory -> DescribeCostCategoryDefinitionResponse)
-> Lens
DescribeCostCategoryDefinitionResponse
DescribeCostCategoryDefinitionResponse
(Maybe CostCategory)
(Maybe CostCategory)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCostCategoryDefinitionResponse' {Maybe CostCategory
costCategory :: Maybe CostCategory
$sel:costCategory:DescribeCostCategoryDefinitionResponse' :: DescribeCostCategoryDefinitionResponse -> Maybe CostCategory
costCategory} -> Maybe CostCategory
costCategory) (\s :: DescribeCostCategoryDefinitionResponse
s@DescribeCostCategoryDefinitionResponse' {} Maybe CostCategory
a -> DescribeCostCategoryDefinitionResponse
s {$sel:costCategory:DescribeCostCategoryDefinitionResponse' :: Maybe CostCategory
costCategory = Maybe CostCategory
a} :: DescribeCostCategoryDefinitionResponse)
describeCostCategoryDefinitionResponse_httpStatus :: Lens.Lens' DescribeCostCategoryDefinitionResponse Prelude.Int
describeCostCategoryDefinitionResponse_httpStatus :: (Int -> f Int)
-> DescribeCostCategoryDefinitionResponse
-> f DescribeCostCategoryDefinitionResponse
describeCostCategoryDefinitionResponse_httpStatus = (DescribeCostCategoryDefinitionResponse -> Int)
-> (DescribeCostCategoryDefinitionResponse
-> Int -> DescribeCostCategoryDefinitionResponse)
-> Lens
DescribeCostCategoryDefinitionResponse
DescribeCostCategoryDefinitionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCostCategoryDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeCostCategoryDefinitionResponse' :: DescribeCostCategoryDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeCostCategoryDefinitionResponse
s@DescribeCostCategoryDefinitionResponse' {} Int
a -> DescribeCostCategoryDefinitionResponse
s {$sel:httpStatus:DescribeCostCategoryDefinitionResponse' :: Int
httpStatus = Int
a} :: DescribeCostCategoryDefinitionResponse)
instance
Prelude.NFData
DescribeCostCategoryDefinitionResponse