{-# 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.ApplicationCostProfiler.ListReportDefinitions
(
ListReportDefinitions (..),
newListReportDefinitions,
listReportDefinitions_maxResults,
listReportDefinitions_nextToken,
ListReportDefinitionsResponse (..),
newListReportDefinitionsResponse,
listReportDefinitionsResponse_nextToken,
listReportDefinitionsResponse_reportDefinitions,
listReportDefinitionsResponse_httpStatus,
)
where
import Amazonka.ApplicationCostProfiler.Types
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListReportDefinitions = ListReportDefinitions'
{
ListReportDefinitions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListReportDefinitions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListReportDefinitions -> ListReportDefinitions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReportDefinitions -> ListReportDefinitions -> Bool
$c/= :: ListReportDefinitions -> ListReportDefinitions -> Bool
== :: ListReportDefinitions -> ListReportDefinitions -> Bool
$c== :: ListReportDefinitions -> ListReportDefinitions -> Bool
Prelude.Eq, ReadPrec [ListReportDefinitions]
ReadPrec ListReportDefinitions
Int -> ReadS ListReportDefinitions
ReadS [ListReportDefinitions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReportDefinitions]
$creadListPrec :: ReadPrec [ListReportDefinitions]
readPrec :: ReadPrec ListReportDefinitions
$creadPrec :: ReadPrec ListReportDefinitions
readList :: ReadS [ListReportDefinitions]
$creadList :: ReadS [ListReportDefinitions]
readsPrec :: Int -> ReadS ListReportDefinitions
$creadsPrec :: Int -> ReadS ListReportDefinitions
Prelude.Read, Int -> ListReportDefinitions -> ShowS
[ListReportDefinitions] -> ShowS
ListReportDefinitions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReportDefinitions] -> ShowS
$cshowList :: [ListReportDefinitions] -> ShowS
show :: ListReportDefinitions -> String
$cshow :: ListReportDefinitions -> String
showsPrec :: Int -> ListReportDefinitions -> ShowS
$cshowsPrec :: Int -> ListReportDefinitions -> ShowS
Prelude.Show, forall x. Rep ListReportDefinitions x -> ListReportDefinitions
forall x. ListReportDefinitions -> Rep ListReportDefinitions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListReportDefinitions x -> ListReportDefinitions
$cfrom :: forall x. ListReportDefinitions -> Rep ListReportDefinitions x
Prelude.Generic)
newListReportDefinitions ::
ListReportDefinitions
newListReportDefinitions :: ListReportDefinitions
newListReportDefinitions =
ListReportDefinitions'
{ $sel:maxResults:ListReportDefinitions' :: Maybe Natural
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListReportDefinitions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listReportDefinitions_maxResults :: Lens.Lens' ListReportDefinitions (Prelude.Maybe Prelude.Natural)
listReportDefinitions_maxResults :: Lens' ListReportDefinitions (Maybe Natural)
listReportDefinitions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportDefinitions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListReportDefinitions' :: ListReportDefinitions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListReportDefinitions
s@ListReportDefinitions' {} Maybe Natural
a -> ListReportDefinitions
s {$sel:maxResults:ListReportDefinitions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListReportDefinitions)
listReportDefinitions_nextToken :: Lens.Lens' ListReportDefinitions (Prelude.Maybe Prelude.Text)
listReportDefinitions_nextToken :: Lens' ListReportDefinitions (Maybe Text)
listReportDefinitions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportDefinitions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListReportDefinitions' :: ListReportDefinitions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListReportDefinitions
s@ListReportDefinitions' {} Maybe Text
a -> ListReportDefinitions
s {$sel:nextToken:ListReportDefinitions' :: Maybe Text
nextToken = Maybe Text
a} :: ListReportDefinitions)
instance Core.AWSPager ListReportDefinitions where
page :: ListReportDefinitions
-> AWSResponse ListReportDefinitions -> Maybe ListReportDefinitions
page ListReportDefinitions
rq AWSResponse ListReportDefinitions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListReportDefinitions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListReportDefinitionsResponse (Maybe Text)
listReportDefinitionsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListReportDefinitions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListReportDefinitionsResponse (Maybe [ReportDefinition])
listReportDefinitionsResponse_reportDefinitions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListReportDefinitions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListReportDefinitions (Maybe Text)
listReportDefinitions_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListReportDefinitions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListReportDefinitionsResponse (Maybe Text)
listReportDefinitionsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListReportDefinitions where
type
AWSResponse ListReportDefinitions =
ListReportDefinitionsResponse
request :: (Service -> Service)
-> ListReportDefinitions -> Request ListReportDefinitions
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListReportDefinitions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListReportDefinitions)))
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 Text
-> Maybe [ReportDefinition] -> Int -> ListReportDefinitionsResponse
ListReportDefinitionsResponse'
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
"nextToken")
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
"reportDefinitions"
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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListReportDefinitions where
hashWithSalt :: Int -> ListReportDefinitions -> Int
hashWithSalt Int
_salt ListReportDefinitions' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListReportDefinitions' :: ListReportDefinitions -> Maybe Text
$sel:maxResults:ListReportDefinitions' :: ListReportDefinitions -> Maybe Natural
..} =
Int
_salt
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 ListReportDefinitions where
rnf :: ListReportDefinitions -> ()
rnf ListReportDefinitions' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListReportDefinitions' :: ListReportDefinitions -> Maybe Text
$sel:maxResults:ListReportDefinitions' :: ListReportDefinitions -> Maybe Natural
..} =
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 ListReportDefinitions where
toHeaders :: ListReportDefinitions -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListReportDefinitions where
toPath :: ListReportDefinitions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/reportDefinition"
instance Data.ToQuery ListReportDefinitions where
toQuery :: ListReportDefinitions -> QueryString
toQuery ListReportDefinitions' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListReportDefinitions' :: ListReportDefinitions -> Maybe Text
$sel:maxResults:ListReportDefinitions' :: ListReportDefinitions -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListReportDefinitionsResponse = ListReportDefinitionsResponse'
{
ListReportDefinitionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListReportDefinitionsResponse -> Maybe [ReportDefinition]
reportDefinitions :: Prelude.Maybe [ReportDefinition],
ListReportDefinitionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListReportDefinitionsResponse
-> ListReportDefinitionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReportDefinitionsResponse
-> ListReportDefinitionsResponse -> Bool
$c/= :: ListReportDefinitionsResponse
-> ListReportDefinitionsResponse -> Bool
== :: ListReportDefinitionsResponse
-> ListReportDefinitionsResponse -> Bool
$c== :: ListReportDefinitionsResponse
-> ListReportDefinitionsResponse -> Bool
Prelude.Eq, ReadPrec [ListReportDefinitionsResponse]
ReadPrec ListReportDefinitionsResponse
Int -> ReadS ListReportDefinitionsResponse
ReadS [ListReportDefinitionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReportDefinitionsResponse]
$creadListPrec :: ReadPrec [ListReportDefinitionsResponse]
readPrec :: ReadPrec ListReportDefinitionsResponse
$creadPrec :: ReadPrec ListReportDefinitionsResponse
readList :: ReadS [ListReportDefinitionsResponse]
$creadList :: ReadS [ListReportDefinitionsResponse]
readsPrec :: Int -> ReadS ListReportDefinitionsResponse
$creadsPrec :: Int -> ReadS ListReportDefinitionsResponse
Prelude.Read, Int -> ListReportDefinitionsResponse -> ShowS
[ListReportDefinitionsResponse] -> ShowS
ListReportDefinitionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReportDefinitionsResponse] -> ShowS
$cshowList :: [ListReportDefinitionsResponse] -> ShowS
show :: ListReportDefinitionsResponse -> String
$cshow :: ListReportDefinitionsResponse -> String
showsPrec :: Int -> ListReportDefinitionsResponse -> ShowS
$cshowsPrec :: Int -> ListReportDefinitionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListReportDefinitionsResponse x
-> ListReportDefinitionsResponse
forall x.
ListReportDefinitionsResponse
-> Rep ListReportDefinitionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListReportDefinitionsResponse x
-> ListReportDefinitionsResponse
$cfrom :: forall x.
ListReportDefinitionsResponse
-> Rep ListReportDefinitionsResponse x
Prelude.Generic)
newListReportDefinitionsResponse ::
Prelude.Int ->
ListReportDefinitionsResponse
newListReportDefinitionsResponse :: Int -> ListReportDefinitionsResponse
newListReportDefinitionsResponse Int
pHttpStatus_ =
ListReportDefinitionsResponse'
{ $sel:nextToken:ListReportDefinitionsResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:reportDefinitions:ListReportDefinitionsResponse' :: Maybe [ReportDefinition]
reportDefinitions = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListReportDefinitionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listReportDefinitionsResponse_nextToken :: Lens.Lens' ListReportDefinitionsResponse (Prelude.Maybe Prelude.Text)
listReportDefinitionsResponse_nextToken :: Lens' ListReportDefinitionsResponse (Maybe Text)
listReportDefinitionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportDefinitionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListReportDefinitionsResponse' :: ListReportDefinitionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListReportDefinitionsResponse
s@ListReportDefinitionsResponse' {} Maybe Text
a -> ListReportDefinitionsResponse
s {$sel:nextToken:ListReportDefinitionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListReportDefinitionsResponse)
listReportDefinitionsResponse_reportDefinitions :: Lens.Lens' ListReportDefinitionsResponse (Prelude.Maybe [ReportDefinition])
listReportDefinitionsResponse_reportDefinitions :: Lens' ListReportDefinitionsResponse (Maybe [ReportDefinition])
listReportDefinitionsResponse_reportDefinitions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportDefinitionsResponse' {Maybe [ReportDefinition]
reportDefinitions :: Maybe [ReportDefinition]
$sel:reportDefinitions:ListReportDefinitionsResponse' :: ListReportDefinitionsResponse -> Maybe [ReportDefinition]
reportDefinitions} -> Maybe [ReportDefinition]
reportDefinitions) (\s :: ListReportDefinitionsResponse
s@ListReportDefinitionsResponse' {} Maybe [ReportDefinition]
a -> ListReportDefinitionsResponse
s {$sel:reportDefinitions:ListReportDefinitionsResponse' :: Maybe [ReportDefinition]
reportDefinitions = Maybe [ReportDefinition]
a} :: ListReportDefinitionsResponse) 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
listReportDefinitionsResponse_httpStatus :: Lens.Lens' ListReportDefinitionsResponse Prelude.Int
listReportDefinitionsResponse_httpStatus :: Lens' ListReportDefinitionsResponse Int
listReportDefinitionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportDefinitionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListReportDefinitionsResponse' :: ListReportDefinitionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListReportDefinitionsResponse
s@ListReportDefinitionsResponse' {} Int
a -> ListReportDefinitionsResponse
s {$sel:httpStatus:ListReportDefinitionsResponse' :: Int
httpStatus = Int
a} :: ListReportDefinitionsResponse)
instance Prelude.NFData ListReportDefinitionsResponse where
rnf :: ListReportDefinitionsResponse -> ()
rnf ListReportDefinitionsResponse' {Int
Maybe [ReportDefinition]
Maybe Text
httpStatus :: Int
reportDefinitions :: Maybe [ReportDefinition]
nextToken :: Maybe Text
$sel:httpStatus:ListReportDefinitionsResponse' :: ListReportDefinitionsResponse -> Int
$sel:reportDefinitions:ListReportDefinitionsResponse' :: ListReportDefinitionsResponse -> Maybe [ReportDefinition]
$sel:nextToken:ListReportDefinitionsResponse' :: ListReportDefinitionsResponse -> Maybe Text
..} =
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 Maybe [ReportDefinition]
reportDefinitions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus