{-# 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.ListCostCategoryDefinitions
(
ListCostCategoryDefinitions (..),
newListCostCategoryDefinitions,
listCostCategoryDefinitions_effectiveOn,
listCostCategoryDefinitions_maxResults,
listCostCategoryDefinitions_nextToken,
ListCostCategoryDefinitionsResponse (..),
newListCostCategoryDefinitionsResponse,
listCostCategoryDefinitionsResponse_costCategoryReferences,
listCostCategoryDefinitionsResponse_nextToken,
listCostCategoryDefinitionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CostExplorer.Types
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListCostCategoryDefinitions = ListCostCategoryDefinitions'
{
ListCostCategoryDefinitions -> Maybe Text
effectiveOn :: Prelude.Maybe Prelude.Text,
ListCostCategoryDefinitions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListCostCategoryDefinitions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListCostCategoryDefinitions -> ListCostCategoryDefinitions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCostCategoryDefinitions -> ListCostCategoryDefinitions -> Bool
$c/= :: ListCostCategoryDefinitions -> ListCostCategoryDefinitions -> Bool
== :: ListCostCategoryDefinitions -> ListCostCategoryDefinitions -> Bool
$c== :: ListCostCategoryDefinitions -> ListCostCategoryDefinitions -> Bool
Prelude.Eq, ReadPrec [ListCostCategoryDefinitions]
ReadPrec ListCostCategoryDefinitions
Int -> ReadS ListCostCategoryDefinitions
ReadS [ListCostCategoryDefinitions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCostCategoryDefinitions]
$creadListPrec :: ReadPrec [ListCostCategoryDefinitions]
readPrec :: ReadPrec ListCostCategoryDefinitions
$creadPrec :: ReadPrec ListCostCategoryDefinitions
readList :: ReadS [ListCostCategoryDefinitions]
$creadList :: ReadS [ListCostCategoryDefinitions]
readsPrec :: Int -> ReadS ListCostCategoryDefinitions
$creadsPrec :: Int -> ReadS ListCostCategoryDefinitions
Prelude.Read, Int -> ListCostCategoryDefinitions -> ShowS
[ListCostCategoryDefinitions] -> ShowS
ListCostCategoryDefinitions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCostCategoryDefinitions] -> ShowS
$cshowList :: [ListCostCategoryDefinitions] -> ShowS
show :: ListCostCategoryDefinitions -> String
$cshow :: ListCostCategoryDefinitions -> String
showsPrec :: Int -> ListCostCategoryDefinitions -> ShowS
$cshowsPrec :: Int -> ListCostCategoryDefinitions -> ShowS
Prelude.Show, forall x.
Rep ListCostCategoryDefinitions x -> ListCostCategoryDefinitions
forall x.
ListCostCategoryDefinitions -> Rep ListCostCategoryDefinitions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCostCategoryDefinitions x -> ListCostCategoryDefinitions
$cfrom :: forall x.
ListCostCategoryDefinitions -> Rep ListCostCategoryDefinitions x
Prelude.Generic)
newListCostCategoryDefinitions ::
ListCostCategoryDefinitions
newListCostCategoryDefinitions :: ListCostCategoryDefinitions
newListCostCategoryDefinitions =
ListCostCategoryDefinitions'
{ $sel:effectiveOn:ListCostCategoryDefinitions' :: Maybe Text
effectiveOn =
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListCostCategoryDefinitions' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCostCategoryDefinitions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listCostCategoryDefinitions_effectiveOn :: Lens.Lens' ListCostCategoryDefinitions (Prelude.Maybe Prelude.Text)
listCostCategoryDefinitions_effectiveOn :: Lens' ListCostCategoryDefinitions (Maybe Text)
listCostCategoryDefinitions_effectiveOn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCostCategoryDefinitions' {Maybe Text
effectiveOn :: Maybe Text
$sel:effectiveOn:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Text
effectiveOn} -> Maybe Text
effectiveOn) (\s :: ListCostCategoryDefinitions
s@ListCostCategoryDefinitions' {} Maybe Text
a -> ListCostCategoryDefinitions
s {$sel:effectiveOn:ListCostCategoryDefinitions' :: Maybe Text
effectiveOn = Maybe Text
a} :: ListCostCategoryDefinitions)
listCostCategoryDefinitions_maxResults :: Lens.Lens' ListCostCategoryDefinitions (Prelude.Maybe Prelude.Natural)
listCostCategoryDefinitions_maxResults :: Lens' ListCostCategoryDefinitions (Maybe Natural)
listCostCategoryDefinitions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCostCategoryDefinitions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCostCategoryDefinitions
s@ListCostCategoryDefinitions' {} Maybe Natural
a -> ListCostCategoryDefinitions
s {$sel:maxResults:ListCostCategoryDefinitions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCostCategoryDefinitions)
listCostCategoryDefinitions_nextToken :: Lens.Lens' ListCostCategoryDefinitions (Prelude.Maybe Prelude.Text)
listCostCategoryDefinitions_nextToken :: Lens' ListCostCategoryDefinitions (Maybe Text)
listCostCategoryDefinitions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCostCategoryDefinitions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCostCategoryDefinitions
s@ListCostCategoryDefinitions' {} Maybe Text
a -> ListCostCategoryDefinitions
s {$sel:nextToken:ListCostCategoryDefinitions' :: Maybe Text
nextToken = Maybe Text
a} :: ListCostCategoryDefinitions)
instance Core.AWSRequest ListCostCategoryDefinitions where
type
AWSResponse ListCostCategoryDefinitions =
ListCostCategoryDefinitionsResponse
request :: (Service -> Service)
-> ListCostCategoryDefinitions
-> Request ListCostCategoryDefinitions
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListCostCategoryDefinitions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListCostCategoryDefinitions)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [CostCategoryReference]
-> Maybe Text -> Int -> ListCostCategoryDefinitionsResponse
ListCostCategoryDefinitionsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CostCategoryReferences"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ 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 -> Either String (Maybe a)
Data..?> Key
"NextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListCostCategoryDefinitions where
hashWithSalt :: Int -> ListCostCategoryDefinitions -> Int
hashWithSalt Int
_salt ListCostCategoryDefinitions' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
effectiveOn :: Maybe Text
$sel:nextToken:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Text
$sel:maxResults:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Natural
$sel:effectiveOn:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
effectiveOn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListCostCategoryDefinitions where
rnf :: ListCostCategoryDefinitions -> ()
rnf ListCostCategoryDefinitions' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
effectiveOn :: Maybe Text
$sel:nextToken:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Text
$sel:maxResults:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Natural
$sel:effectiveOn:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
effectiveOn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListCostCategoryDefinitions where
toHeaders :: ListCostCategoryDefinitions -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSInsightsIndexService.ListCostCategoryDefinitions" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListCostCategoryDefinitions where
toJSON :: ListCostCategoryDefinitions -> Value
toJSON ListCostCategoryDefinitions' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
effectiveOn :: Maybe Text
$sel:nextToken:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Text
$sel:maxResults:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Natural
$sel:effectiveOn:ListCostCategoryDefinitions' :: ListCostCategoryDefinitions -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"EffectiveOn" 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
effectiveOn,
(Key
"MaxResults" 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 Natural
maxResults,
(Key
"NextToken" 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
nextToken
]
)
instance Data.ToPath ListCostCategoryDefinitions where
toPath :: ListCostCategoryDefinitions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListCostCategoryDefinitions where
toQuery :: ListCostCategoryDefinitions -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListCostCategoryDefinitionsResponse = ListCostCategoryDefinitionsResponse'
{
ListCostCategoryDefinitionsResponse
-> Maybe [CostCategoryReference]
costCategoryReferences :: Prelude.Maybe [CostCategoryReference],
ListCostCategoryDefinitionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListCostCategoryDefinitionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListCostCategoryDefinitionsResponse
-> ListCostCategoryDefinitionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCostCategoryDefinitionsResponse
-> ListCostCategoryDefinitionsResponse -> Bool
$c/= :: ListCostCategoryDefinitionsResponse
-> ListCostCategoryDefinitionsResponse -> Bool
== :: ListCostCategoryDefinitionsResponse
-> ListCostCategoryDefinitionsResponse -> Bool
$c== :: ListCostCategoryDefinitionsResponse
-> ListCostCategoryDefinitionsResponse -> Bool
Prelude.Eq, ReadPrec [ListCostCategoryDefinitionsResponse]
ReadPrec ListCostCategoryDefinitionsResponse
Int -> ReadS ListCostCategoryDefinitionsResponse
ReadS [ListCostCategoryDefinitionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCostCategoryDefinitionsResponse]
$creadListPrec :: ReadPrec [ListCostCategoryDefinitionsResponse]
readPrec :: ReadPrec ListCostCategoryDefinitionsResponse
$creadPrec :: ReadPrec ListCostCategoryDefinitionsResponse
readList :: ReadS [ListCostCategoryDefinitionsResponse]
$creadList :: ReadS [ListCostCategoryDefinitionsResponse]
readsPrec :: Int -> ReadS ListCostCategoryDefinitionsResponse
$creadsPrec :: Int -> ReadS ListCostCategoryDefinitionsResponse
Prelude.Read, Int -> ListCostCategoryDefinitionsResponse -> ShowS
[ListCostCategoryDefinitionsResponse] -> ShowS
ListCostCategoryDefinitionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCostCategoryDefinitionsResponse] -> ShowS
$cshowList :: [ListCostCategoryDefinitionsResponse] -> ShowS
show :: ListCostCategoryDefinitionsResponse -> String
$cshow :: ListCostCategoryDefinitionsResponse -> String
showsPrec :: Int -> ListCostCategoryDefinitionsResponse -> ShowS
$cshowsPrec :: Int -> ListCostCategoryDefinitionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListCostCategoryDefinitionsResponse x
-> ListCostCategoryDefinitionsResponse
forall x.
ListCostCategoryDefinitionsResponse
-> Rep ListCostCategoryDefinitionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCostCategoryDefinitionsResponse x
-> ListCostCategoryDefinitionsResponse
$cfrom :: forall x.
ListCostCategoryDefinitionsResponse
-> Rep ListCostCategoryDefinitionsResponse x
Prelude.Generic)
newListCostCategoryDefinitionsResponse ::
Prelude.Int ->
ListCostCategoryDefinitionsResponse
newListCostCategoryDefinitionsResponse :: Int -> ListCostCategoryDefinitionsResponse
newListCostCategoryDefinitionsResponse Int
pHttpStatus_ =
ListCostCategoryDefinitionsResponse'
{ $sel:costCategoryReferences:ListCostCategoryDefinitionsResponse' :: Maybe [CostCategoryReference]
costCategoryReferences =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCostCategoryDefinitionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListCostCategoryDefinitionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listCostCategoryDefinitionsResponse_costCategoryReferences :: Lens.Lens' ListCostCategoryDefinitionsResponse (Prelude.Maybe [CostCategoryReference])
listCostCategoryDefinitionsResponse_costCategoryReferences :: Lens'
ListCostCategoryDefinitionsResponse (Maybe [CostCategoryReference])
listCostCategoryDefinitionsResponse_costCategoryReferences = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCostCategoryDefinitionsResponse' {Maybe [CostCategoryReference]
costCategoryReferences :: Maybe [CostCategoryReference]
$sel:costCategoryReferences:ListCostCategoryDefinitionsResponse' :: ListCostCategoryDefinitionsResponse
-> Maybe [CostCategoryReference]
costCategoryReferences} -> Maybe [CostCategoryReference]
costCategoryReferences) (\s :: ListCostCategoryDefinitionsResponse
s@ListCostCategoryDefinitionsResponse' {} Maybe [CostCategoryReference]
a -> ListCostCategoryDefinitionsResponse
s {$sel:costCategoryReferences:ListCostCategoryDefinitionsResponse' :: Maybe [CostCategoryReference]
costCategoryReferences = Maybe [CostCategoryReference]
a} :: ListCostCategoryDefinitionsResponse) 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
listCostCategoryDefinitionsResponse_nextToken :: Lens.Lens' ListCostCategoryDefinitionsResponse (Prelude.Maybe Prelude.Text)
listCostCategoryDefinitionsResponse_nextToken :: Lens' ListCostCategoryDefinitionsResponse (Maybe Text)
listCostCategoryDefinitionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCostCategoryDefinitionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCostCategoryDefinitionsResponse' :: ListCostCategoryDefinitionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCostCategoryDefinitionsResponse
s@ListCostCategoryDefinitionsResponse' {} Maybe Text
a -> ListCostCategoryDefinitionsResponse
s {$sel:nextToken:ListCostCategoryDefinitionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCostCategoryDefinitionsResponse)
listCostCategoryDefinitionsResponse_httpStatus :: Lens.Lens' ListCostCategoryDefinitionsResponse Prelude.Int
listCostCategoryDefinitionsResponse_httpStatus :: Lens' ListCostCategoryDefinitionsResponse Int
listCostCategoryDefinitionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCostCategoryDefinitionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListCostCategoryDefinitionsResponse' :: ListCostCategoryDefinitionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListCostCategoryDefinitionsResponse
s@ListCostCategoryDefinitionsResponse' {} Int
a -> ListCostCategoryDefinitionsResponse
s {$sel:httpStatus:ListCostCategoryDefinitionsResponse' :: Int
httpStatus = Int
a} :: ListCostCategoryDefinitionsResponse)
instance
Prelude.NFData
ListCostCategoryDefinitionsResponse
where
rnf :: ListCostCategoryDefinitionsResponse -> ()
rnf ListCostCategoryDefinitionsResponse' {Int
Maybe [CostCategoryReference]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
costCategoryReferences :: Maybe [CostCategoryReference]
$sel:httpStatus:ListCostCategoryDefinitionsResponse' :: ListCostCategoryDefinitionsResponse -> Int
$sel:nextToken:ListCostCategoryDefinitionsResponse' :: ListCostCategoryDefinitionsResponse -> Maybe Text
$sel:costCategoryReferences:ListCostCategoryDefinitionsResponse' :: ListCostCategoryDefinitionsResponse
-> Maybe [CostCategoryReference]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [CostCategoryReference]
costCategoryReferences
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus