{-# 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.Backup.ListReportPlans
(
ListReportPlans (..),
newListReportPlans,
listReportPlans_nextToken,
listReportPlans_maxResults,
ListReportPlansResponse (..),
newListReportPlansResponse,
listReportPlansResponse_reportPlans,
listReportPlansResponse_nextToken,
listReportPlansResponse_httpStatus,
)
where
import Amazonka.Backup.Types
import qualified Amazonka.Core as Core
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 ListReportPlans = ListReportPlans'
{
ListReportPlans -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListReportPlans -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListReportPlans -> ListReportPlans -> Bool
(ListReportPlans -> ListReportPlans -> Bool)
-> (ListReportPlans -> ListReportPlans -> Bool)
-> Eq ListReportPlans
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReportPlans -> ListReportPlans -> Bool
$c/= :: ListReportPlans -> ListReportPlans -> Bool
== :: ListReportPlans -> ListReportPlans -> Bool
$c== :: ListReportPlans -> ListReportPlans -> Bool
Prelude.Eq, ReadPrec [ListReportPlans]
ReadPrec ListReportPlans
Int -> ReadS ListReportPlans
ReadS [ListReportPlans]
(Int -> ReadS ListReportPlans)
-> ReadS [ListReportPlans]
-> ReadPrec ListReportPlans
-> ReadPrec [ListReportPlans]
-> Read ListReportPlans
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReportPlans]
$creadListPrec :: ReadPrec [ListReportPlans]
readPrec :: ReadPrec ListReportPlans
$creadPrec :: ReadPrec ListReportPlans
readList :: ReadS [ListReportPlans]
$creadList :: ReadS [ListReportPlans]
readsPrec :: Int -> ReadS ListReportPlans
$creadsPrec :: Int -> ReadS ListReportPlans
Prelude.Read, Int -> ListReportPlans -> ShowS
[ListReportPlans] -> ShowS
ListReportPlans -> String
(Int -> ListReportPlans -> ShowS)
-> (ListReportPlans -> String)
-> ([ListReportPlans] -> ShowS)
-> Show ListReportPlans
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReportPlans] -> ShowS
$cshowList :: [ListReportPlans] -> ShowS
show :: ListReportPlans -> String
$cshow :: ListReportPlans -> String
showsPrec :: Int -> ListReportPlans -> ShowS
$cshowsPrec :: Int -> ListReportPlans -> ShowS
Prelude.Show, (forall x. ListReportPlans -> Rep ListReportPlans x)
-> (forall x. Rep ListReportPlans x -> ListReportPlans)
-> Generic ListReportPlans
forall x. Rep ListReportPlans x -> ListReportPlans
forall x. ListReportPlans -> Rep ListReportPlans x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListReportPlans x -> ListReportPlans
$cfrom :: forall x. ListReportPlans -> Rep ListReportPlans x
Prelude.Generic)
newListReportPlans ::
ListReportPlans
newListReportPlans :: ListReportPlans
newListReportPlans =
ListReportPlans' :: Maybe Text -> Maybe Natural -> ListReportPlans
ListReportPlans'
{ $sel:nextToken:ListReportPlans' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListReportPlans' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listReportPlans_nextToken :: Lens.Lens' ListReportPlans (Prelude.Maybe Prelude.Text)
listReportPlans_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListReportPlans -> f ListReportPlans
listReportPlans_nextToken = (ListReportPlans -> Maybe Text)
-> (ListReportPlans -> Maybe Text -> ListReportPlans)
-> Lens ListReportPlans ListReportPlans (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportPlans' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListReportPlans' :: ListReportPlans -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListReportPlans
s@ListReportPlans' {} Maybe Text
a -> ListReportPlans
s {$sel:nextToken:ListReportPlans' :: Maybe Text
nextToken = Maybe Text
a} :: ListReportPlans)
listReportPlans_maxResults :: Lens.Lens' ListReportPlans (Prelude.Maybe Prelude.Natural)
listReportPlans_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListReportPlans -> f ListReportPlans
listReportPlans_maxResults = (ListReportPlans -> Maybe Natural)
-> (ListReportPlans -> Maybe Natural -> ListReportPlans)
-> Lens
ListReportPlans ListReportPlans (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportPlans' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListReportPlans' :: ListReportPlans -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListReportPlans
s@ListReportPlans' {} Maybe Natural
a -> ListReportPlans
s {$sel:maxResults:ListReportPlans' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListReportPlans)
instance Core.AWSRequest ListReportPlans where
type
AWSResponse ListReportPlans =
ListReportPlansResponse
request :: ListReportPlans -> Request ListReportPlans
request = Service -> ListReportPlans -> Request ListReportPlans
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListReportPlans
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListReportPlans)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListReportPlans))
-> Logger
-> Service
-> Proxy ListReportPlans
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListReportPlans)))
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 [ReportPlan] -> Maybe Text -> Int -> ListReportPlansResponse
ListReportPlansResponse'
(Maybe [ReportPlan]
-> Maybe Text -> Int -> ListReportPlansResponse)
-> Either String (Maybe [ReportPlan])
-> Either String (Maybe Text -> Int -> ListReportPlansResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [ReportPlan]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReportPlans" Either String (Maybe (Maybe [ReportPlan]))
-> Maybe [ReportPlan] -> Either String (Maybe [ReportPlan])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ReportPlan]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListReportPlansResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListReportPlansResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Int -> ListReportPlansResponse)
-> Either String Int -> Either String ListReportPlansResponse
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 ListReportPlans
instance Prelude.NFData ListReportPlans
instance Core.ToHeaders ListReportPlans where
toHeaders :: ListReportPlans -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListReportPlans -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath ListReportPlans where
toPath :: ListReportPlans -> ByteString
toPath = ByteString -> ListReportPlans -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/audit/report-plans"
instance Core.ToQuery ListReportPlans where
toQuery :: ListReportPlans -> QueryString
toQuery ListReportPlans' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListReportPlans' :: ListReportPlans -> Maybe Natural
$sel:nextToken:ListReportPlans' :: ListReportPlans -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"MaxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListReportPlansResponse = ListReportPlansResponse'
{
ListReportPlansResponse -> Maybe [ReportPlan]
reportPlans :: Prelude.Maybe [ReportPlan],
ListReportPlansResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListReportPlansResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListReportPlansResponse -> ListReportPlansResponse -> Bool
(ListReportPlansResponse -> ListReportPlansResponse -> Bool)
-> (ListReportPlansResponse -> ListReportPlansResponse -> Bool)
-> Eq ListReportPlansResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListReportPlansResponse -> ListReportPlansResponse -> Bool
$c/= :: ListReportPlansResponse -> ListReportPlansResponse -> Bool
== :: ListReportPlansResponse -> ListReportPlansResponse -> Bool
$c== :: ListReportPlansResponse -> ListReportPlansResponse -> Bool
Prelude.Eq, ReadPrec [ListReportPlansResponse]
ReadPrec ListReportPlansResponse
Int -> ReadS ListReportPlansResponse
ReadS [ListReportPlansResponse]
(Int -> ReadS ListReportPlansResponse)
-> ReadS [ListReportPlansResponse]
-> ReadPrec ListReportPlansResponse
-> ReadPrec [ListReportPlansResponse]
-> Read ListReportPlansResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListReportPlansResponse]
$creadListPrec :: ReadPrec [ListReportPlansResponse]
readPrec :: ReadPrec ListReportPlansResponse
$creadPrec :: ReadPrec ListReportPlansResponse
readList :: ReadS [ListReportPlansResponse]
$creadList :: ReadS [ListReportPlansResponse]
readsPrec :: Int -> ReadS ListReportPlansResponse
$creadsPrec :: Int -> ReadS ListReportPlansResponse
Prelude.Read, Int -> ListReportPlansResponse -> ShowS
[ListReportPlansResponse] -> ShowS
ListReportPlansResponse -> String
(Int -> ListReportPlansResponse -> ShowS)
-> (ListReportPlansResponse -> String)
-> ([ListReportPlansResponse] -> ShowS)
-> Show ListReportPlansResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListReportPlansResponse] -> ShowS
$cshowList :: [ListReportPlansResponse] -> ShowS
show :: ListReportPlansResponse -> String
$cshow :: ListReportPlansResponse -> String
showsPrec :: Int -> ListReportPlansResponse -> ShowS
$cshowsPrec :: Int -> ListReportPlansResponse -> ShowS
Prelude.Show, (forall x.
ListReportPlansResponse -> Rep ListReportPlansResponse x)
-> (forall x.
Rep ListReportPlansResponse x -> ListReportPlansResponse)
-> Generic ListReportPlansResponse
forall x. Rep ListReportPlansResponse x -> ListReportPlansResponse
forall x. ListReportPlansResponse -> Rep ListReportPlansResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListReportPlansResponse x -> ListReportPlansResponse
$cfrom :: forall x. ListReportPlansResponse -> Rep ListReportPlansResponse x
Prelude.Generic)
newListReportPlansResponse ::
Prelude.Int ->
ListReportPlansResponse
newListReportPlansResponse :: Int -> ListReportPlansResponse
newListReportPlansResponse Int
pHttpStatus_ =
ListReportPlansResponse' :: Maybe [ReportPlan] -> Maybe Text -> Int -> ListReportPlansResponse
ListReportPlansResponse'
{ $sel:reportPlans:ListReportPlansResponse' :: Maybe [ReportPlan]
reportPlans =
Maybe [ReportPlan]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListReportPlansResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListReportPlansResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listReportPlansResponse_reportPlans :: Lens.Lens' ListReportPlansResponse (Prelude.Maybe [ReportPlan])
listReportPlansResponse_reportPlans :: (Maybe [ReportPlan] -> f (Maybe [ReportPlan]))
-> ListReportPlansResponse -> f ListReportPlansResponse
listReportPlansResponse_reportPlans = (ListReportPlansResponse -> Maybe [ReportPlan])
-> (ListReportPlansResponse
-> Maybe [ReportPlan] -> ListReportPlansResponse)
-> Lens
ListReportPlansResponse
ListReportPlansResponse
(Maybe [ReportPlan])
(Maybe [ReportPlan])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportPlansResponse' {Maybe [ReportPlan]
reportPlans :: Maybe [ReportPlan]
$sel:reportPlans:ListReportPlansResponse' :: ListReportPlansResponse -> Maybe [ReportPlan]
reportPlans} -> Maybe [ReportPlan]
reportPlans) (\s :: ListReportPlansResponse
s@ListReportPlansResponse' {} Maybe [ReportPlan]
a -> ListReportPlansResponse
s {$sel:reportPlans:ListReportPlansResponse' :: Maybe [ReportPlan]
reportPlans = Maybe [ReportPlan]
a} :: ListReportPlansResponse) ((Maybe [ReportPlan] -> f (Maybe [ReportPlan]))
-> ListReportPlansResponse -> f ListReportPlansResponse)
-> ((Maybe [ReportPlan] -> f (Maybe [ReportPlan]))
-> Maybe [ReportPlan] -> f (Maybe [ReportPlan]))
-> (Maybe [ReportPlan] -> f (Maybe [ReportPlan]))
-> ListReportPlansResponse
-> f ListReportPlansResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ReportPlan] [ReportPlan] [ReportPlan] [ReportPlan]
-> Iso
(Maybe [ReportPlan])
(Maybe [ReportPlan])
(Maybe [ReportPlan])
(Maybe [ReportPlan])
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 AnIso [ReportPlan] [ReportPlan] [ReportPlan] [ReportPlan]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listReportPlansResponse_nextToken :: Lens.Lens' ListReportPlansResponse (Prelude.Maybe Prelude.Text)
listReportPlansResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListReportPlansResponse -> f ListReportPlansResponse
listReportPlansResponse_nextToken = (ListReportPlansResponse -> Maybe Text)
-> (ListReportPlansResponse
-> Maybe Text -> ListReportPlansResponse)
-> Lens
ListReportPlansResponse
ListReportPlansResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportPlansResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListReportPlansResponse' :: ListReportPlansResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListReportPlansResponse
s@ListReportPlansResponse' {} Maybe Text
a -> ListReportPlansResponse
s {$sel:nextToken:ListReportPlansResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListReportPlansResponse)
listReportPlansResponse_httpStatus :: Lens.Lens' ListReportPlansResponse Prelude.Int
listReportPlansResponse_httpStatus :: (Int -> f Int)
-> ListReportPlansResponse -> f ListReportPlansResponse
listReportPlansResponse_httpStatus = (ListReportPlansResponse -> Int)
-> (ListReportPlansResponse -> Int -> ListReportPlansResponse)
-> Lens ListReportPlansResponse ListReportPlansResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListReportPlansResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListReportPlansResponse' :: ListReportPlansResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListReportPlansResponse
s@ListReportPlansResponse' {} Int
a -> ListReportPlansResponse
s {$sel:httpStatus:ListReportPlansResponse' :: Int
httpStatus = Int
a} :: ListReportPlansResponse)
instance Prelude.NFData ListReportPlansResponse