{-# 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.DescribeReportPlan
(
DescribeReportPlan (..),
newDescribeReportPlan,
describeReportPlan_reportPlanName,
DescribeReportPlanResponse (..),
newDescribeReportPlanResponse,
describeReportPlanResponse_reportPlan,
describeReportPlanResponse_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 DescribeReportPlan = DescribeReportPlan'
{
DescribeReportPlan -> Text
reportPlanName :: Prelude.Text
}
deriving (DescribeReportPlan -> DescribeReportPlan -> Bool
(DescribeReportPlan -> DescribeReportPlan -> Bool)
-> (DescribeReportPlan -> DescribeReportPlan -> Bool)
-> Eq DescribeReportPlan
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReportPlan -> DescribeReportPlan -> Bool
$c/= :: DescribeReportPlan -> DescribeReportPlan -> Bool
== :: DescribeReportPlan -> DescribeReportPlan -> Bool
$c== :: DescribeReportPlan -> DescribeReportPlan -> Bool
Prelude.Eq, ReadPrec [DescribeReportPlan]
ReadPrec DescribeReportPlan
Int -> ReadS DescribeReportPlan
ReadS [DescribeReportPlan]
(Int -> ReadS DescribeReportPlan)
-> ReadS [DescribeReportPlan]
-> ReadPrec DescribeReportPlan
-> ReadPrec [DescribeReportPlan]
-> Read DescribeReportPlan
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReportPlan]
$creadListPrec :: ReadPrec [DescribeReportPlan]
readPrec :: ReadPrec DescribeReportPlan
$creadPrec :: ReadPrec DescribeReportPlan
readList :: ReadS [DescribeReportPlan]
$creadList :: ReadS [DescribeReportPlan]
readsPrec :: Int -> ReadS DescribeReportPlan
$creadsPrec :: Int -> ReadS DescribeReportPlan
Prelude.Read, Int -> DescribeReportPlan -> ShowS
[DescribeReportPlan] -> ShowS
DescribeReportPlan -> String
(Int -> DescribeReportPlan -> ShowS)
-> (DescribeReportPlan -> String)
-> ([DescribeReportPlan] -> ShowS)
-> Show DescribeReportPlan
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReportPlan] -> ShowS
$cshowList :: [DescribeReportPlan] -> ShowS
show :: DescribeReportPlan -> String
$cshow :: DescribeReportPlan -> String
showsPrec :: Int -> DescribeReportPlan -> ShowS
$cshowsPrec :: Int -> DescribeReportPlan -> ShowS
Prelude.Show, (forall x. DescribeReportPlan -> Rep DescribeReportPlan x)
-> (forall x. Rep DescribeReportPlan x -> DescribeReportPlan)
-> Generic DescribeReportPlan
forall x. Rep DescribeReportPlan x -> DescribeReportPlan
forall x. DescribeReportPlan -> Rep DescribeReportPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeReportPlan x -> DescribeReportPlan
$cfrom :: forall x. DescribeReportPlan -> Rep DescribeReportPlan x
Prelude.Generic)
newDescribeReportPlan ::
Prelude.Text ->
DescribeReportPlan
newDescribeReportPlan :: Text -> DescribeReportPlan
newDescribeReportPlan Text
pReportPlanName_ =
DescribeReportPlan' :: Text -> DescribeReportPlan
DescribeReportPlan'
{ $sel:reportPlanName:DescribeReportPlan' :: Text
reportPlanName =
Text
pReportPlanName_
}
describeReportPlan_reportPlanName :: Lens.Lens' DescribeReportPlan Prelude.Text
describeReportPlan_reportPlanName :: (Text -> f Text) -> DescribeReportPlan -> f DescribeReportPlan
describeReportPlan_reportPlanName = (DescribeReportPlan -> Text)
-> (DescribeReportPlan -> Text -> DescribeReportPlan)
-> Lens DescribeReportPlan DescribeReportPlan Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReportPlan' {Text
reportPlanName :: Text
$sel:reportPlanName:DescribeReportPlan' :: DescribeReportPlan -> Text
reportPlanName} -> Text
reportPlanName) (\s :: DescribeReportPlan
s@DescribeReportPlan' {} Text
a -> DescribeReportPlan
s {$sel:reportPlanName:DescribeReportPlan' :: Text
reportPlanName = Text
a} :: DescribeReportPlan)
instance Core.AWSRequest DescribeReportPlan where
type
AWSResponse DescribeReportPlan =
DescribeReportPlanResponse
request :: DescribeReportPlan -> Request DescribeReportPlan
request = Service -> DescribeReportPlan -> Request DescribeReportPlan
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeReportPlan
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeReportPlan)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeReportPlan))
-> Logger
-> Service
-> Proxy DescribeReportPlan
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeReportPlan)))
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 -> Int -> DescribeReportPlanResponse
DescribeReportPlanResponse'
(Maybe ReportPlan -> Int -> DescribeReportPlanResponse)
-> Either String (Maybe ReportPlan)
-> Either String (Int -> DescribeReportPlanResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ReportPlan)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ReportPlan")
Either String (Int -> DescribeReportPlanResponse)
-> Either String Int -> Either String DescribeReportPlanResponse
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 DescribeReportPlan
instance Prelude.NFData DescribeReportPlan
instance Core.ToHeaders DescribeReportPlan where
toHeaders :: DescribeReportPlan -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeReportPlan -> 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 DescribeReportPlan where
toPath :: DescribeReportPlan -> ByteString
toPath DescribeReportPlan' {Text
reportPlanName :: Text
$sel:reportPlanName:DescribeReportPlan' :: DescribeReportPlan -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/audit/report-plans/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
reportPlanName]
instance Core.ToQuery DescribeReportPlan where
toQuery :: DescribeReportPlan -> QueryString
toQuery = QueryString -> DescribeReportPlan -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeReportPlanResponse = DescribeReportPlanResponse'
{
DescribeReportPlanResponse -> Maybe ReportPlan
reportPlan :: Prelude.Maybe ReportPlan,
DescribeReportPlanResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeReportPlanResponse -> DescribeReportPlanResponse -> Bool
(DescribeReportPlanResponse -> DescribeReportPlanResponse -> Bool)
-> (DescribeReportPlanResponse
-> DescribeReportPlanResponse -> Bool)
-> Eq DescribeReportPlanResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeReportPlanResponse -> DescribeReportPlanResponse -> Bool
$c/= :: DescribeReportPlanResponse -> DescribeReportPlanResponse -> Bool
== :: DescribeReportPlanResponse -> DescribeReportPlanResponse -> Bool
$c== :: DescribeReportPlanResponse -> DescribeReportPlanResponse -> Bool
Prelude.Eq, ReadPrec [DescribeReportPlanResponse]
ReadPrec DescribeReportPlanResponse
Int -> ReadS DescribeReportPlanResponse
ReadS [DescribeReportPlanResponse]
(Int -> ReadS DescribeReportPlanResponse)
-> ReadS [DescribeReportPlanResponse]
-> ReadPrec DescribeReportPlanResponse
-> ReadPrec [DescribeReportPlanResponse]
-> Read DescribeReportPlanResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeReportPlanResponse]
$creadListPrec :: ReadPrec [DescribeReportPlanResponse]
readPrec :: ReadPrec DescribeReportPlanResponse
$creadPrec :: ReadPrec DescribeReportPlanResponse
readList :: ReadS [DescribeReportPlanResponse]
$creadList :: ReadS [DescribeReportPlanResponse]
readsPrec :: Int -> ReadS DescribeReportPlanResponse
$creadsPrec :: Int -> ReadS DescribeReportPlanResponse
Prelude.Read, Int -> DescribeReportPlanResponse -> ShowS
[DescribeReportPlanResponse] -> ShowS
DescribeReportPlanResponse -> String
(Int -> DescribeReportPlanResponse -> ShowS)
-> (DescribeReportPlanResponse -> String)
-> ([DescribeReportPlanResponse] -> ShowS)
-> Show DescribeReportPlanResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeReportPlanResponse] -> ShowS
$cshowList :: [DescribeReportPlanResponse] -> ShowS
show :: DescribeReportPlanResponse -> String
$cshow :: DescribeReportPlanResponse -> String
showsPrec :: Int -> DescribeReportPlanResponse -> ShowS
$cshowsPrec :: Int -> DescribeReportPlanResponse -> ShowS
Prelude.Show, (forall x.
DescribeReportPlanResponse -> Rep DescribeReportPlanResponse x)
-> (forall x.
Rep DescribeReportPlanResponse x -> DescribeReportPlanResponse)
-> Generic DescribeReportPlanResponse
forall x.
Rep DescribeReportPlanResponse x -> DescribeReportPlanResponse
forall x.
DescribeReportPlanResponse -> Rep DescribeReportPlanResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeReportPlanResponse x -> DescribeReportPlanResponse
$cfrom :: forall x.
DescribeReportPlanResponse -> Rep DescribeReportPlanResponse x
Prelude.Generic)
newDescribeReportPlanResponse ::
Prelude.Int ->
DescribeReportPlanResponse
newDescribeReportPlanResponse :: Int -> DescribeReportPlanResponse
newDescribeReportPlanResponse Int
pHttpStatus_ =
DescribeReportPlanResponse' :: Maybe ReportPlan -> Int -> DescribeReportPlanResponse
DescribeReportPlanResponse'
{ $sel:reportPlan:DescribeReportPlanResponse' :: Maybe ReportPlan
reportPlan =
Maybe ReportPlan
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeReportPlanResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeReportPlanResponse_reportPlan :: Lens.Lens' DescribeReportPlanResponse (Prelude.Maybe ReportPlan)
describeReportPlanResponse_reportPlan :: (Maybe ReportPlan -> f (Maybe ReportPlan))
-> DescribeReportPlanResponse -> f DescribeReportPlanResponse
describeReportPlanResponse_reportPlan = (DescribeReportPlanResponse -> Maybe ReportPlan)
-> (DescribeReportPlanResponse
-> Maybe ReportPlan -> DescribeReportPlanResponse)
-> Lens
DescribeReportPlanResponse
DescribeReportPlanResponse
(Maybe ReportPlan)
(Maybe ReportPlan)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReportPlanResponse' {Maybe ReportPlan
reportPlan :: Maybe ReportPlan
$sel:reportPlan:DescribeReportPlanResponse' :: DescribeReportPlanResponse -> Maybe ReportPlan
reportPlan} -> Maybe ReportPlan
reportPlan) (\s :: DescribeReportPlanResponse
s@DescribeReportPlanResponse' {} Maybe ReportPlan
a -> DescribeReportPlanResponse
s {$sel:reportPlan:DescribeReportPlanResponse' :: Maybe ReportPlan
reportPlan = Maybe ReportPlan
a} :: DescribeReportPlanResponse)
describeReportPlanResponse_httpStatus :: Lens.Lens' DescribeReportPlanResponse Prelude.Int
describeReportPlanResponse_httpStatus :: (Int -> f Int)
-> DescribeReportPlanResponse -> f DescribeReportPlanResponse
describeReportPlanResponse_httpStatus = (DescribeReportPlanResponse -> Int)
-> (DescribeReportPlanResponse
-> Int -> DescribeReportPlanResponse)
-> Lens
DescribeReportPlanResponse DescribeReportPlanResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeReportPlanResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeReportPlanResponse' :: DescribeReportPlanResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeReportPlanResponse
s@DescribeReportPlanResponse' {} Int
a -> DescribeReportPlanResponse
s {$sel:httpStatus:DescribeReportPlanResponse' :: Int
httpStatus = Int
a} :: DescribeReportPlanResponse)
instance Prelude.NFData DescribeReportPlanResponse