{-# 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.Inspector.GetAssessmentReport
(
GetAssessmentReport (..),
newGetAssessmentReport,
getAssessmentReport_assessmentRunArn,
getAssessmentReport_reportFileFormat,
getAssessmentReport_reportType,
GetAssessmentReportResponse (..),
newGetAssessmentReportResponse,
getAssessmentReportResponse_url,
getAssessmentReportResponse_httpStatus,
getAssessmentReportResponse_status,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Inspector.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 GetAssessmentReport = GetAssessmentReport'
{
GetAssessmentReport -> Text
assessmentRunArn :: Prelude.Text,
GetAssessmentReport -> ReportFileFormat
reportFileFormat :: ReportFileFormat,
GetAssessmentReport -> ReportType
reportType :: ReportType
}
deriving (GetAssessmentReport -> GetAssessmentReport -> Bool
(GetAssessmentReport -> GetAssessmentReport -> Bool)
-> (GetAssessmentReport -> GetAssessmentReport -> Bool)
-> Eq GetAssessmentReport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAssessmentReport -> GetAssessmentReport -> Bool
$c/= :: GetAssessmentReport -> GetAssessmentReport -> Bool
== :: GetAssessmentReport -> GetAssessmentReport -> Bool
$c== :: GetAssessmentReport -> GetAssessmentReport -> Bool
Prelude.Eq, ReadPrec [GetAssessmentReport]
ReadPrec GetAssessmentReport
Int -> ReadS GetAssessmentReport
ReadS [GetAssessmentReport]
(Int -> ReadS GetAssessmentReport)
-> ReadS [GetAssessmentReport]
-> ReadPrec GetAssessmentReport
-> ReadPrec [GetAssessmentReport]
-> Read GetAssessmentReport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAssessmentReport]
$creadListPrec :: ReadPrec [GetAssessmentReport]
readPrec :: ReadPrec GetAssessmentReport
$creadPrec :: ReadPrec GetAssessmentReport
readList :: ReadS [GetAssessmentReport]
$creadList :: ReadS [GetAssessmentReport]
readsPrec :: Int -> ReadS GetAssessmentReport
$creadsPrec :: Int -> ReadS GetAssessmentReport
Prelude.Read, Int -> GetAssessmentReport -> ShowS
[GetAssessmentReport] -> ShowS
GetAssessmentReport -> String
(Int -> GetAssessmentReport -> ShowS)
-> (GetAssessmentReport -> String)
-> ([GetAssessmentReport] -> ShowS)
-> Show GetAssessmentReport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAssessmentReport] -> ShowS
$cshowList :: [GetAssessmentReport] -> ShowS
show :: GetAssessmentReport -> String
$cshow :: GetAssessmentReport -> String
showsPrec :: Int -> GetAssessmentReport -> ShowS
$cshowsPrec :: Int -> GetAssessmentReport -> ShowS
Prelude.Show, (forall x. GetAssessmentReport -> Rep GetAssessmentReport x)
-> (forall x. Rep GetAssessmentReport x -> GetAssessmentReport)
-> Generic GetAssessmentReport
forall x. Rep GetAssessmentReport x -> GetAssessmentReport
forall x. GetAssessmentReport -> Rep GetAssessmentReport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAssessmentReport x -> GetAssessmentReport
$cfrom :: forall x. GetAssessmentReport -> Rep GetAssessmentReport x
Prelude.Generic)
newGetAssessmentReport ::
Prelude.Text ->
ReportFileFormat ->
ReportType ->
GetAssessmentReport
newGetAssessmentReport :: Text -> ReportFileFormat -> ReportType -> GetAssessmentReport
newGetAssessmentReport
Text
pAssessmentRunArn_
ReportFileFormat
pReportFileFormat_
ReportType
pReportType_ =
GetAssessmentReport' :: Text -> ReportFileFormat -> ReportType -> GetAssessmentReport
GetAssessmentReport'
{ $sel:assessmentRunArn:GetAssessmentReport' :: Text
assessmentRunArn =
Text
pAssessmentRunArn_,
$sel:reportFileFormat:GetAssessmentReport' :: ReportFileFormat
reportFileFormat = ReportFileFormat
pReportFileFormat_,
$sel:reportType:GetAssessmentReport' :: ReportType
reportType = ReportType
pReportType_
}
getAssessmentReport_assessmentRunArn :: Lens.Lens' GetAssessmentReport Prelude.Text
getAssessmentReport_assessmentRunArn :: (Text -> f Text) -> GetAssessmentReport -> f GetAssessmentReport
getAssessmentReport_assessmentRunArn = (GetAssessmentReport -> Text)
-> (GetAssessmentReport -> Text -> GetAssessmentReport)
-> Lens GetAssessmentReport GetAssessmentReport Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssessmentReport' {Text
assessmentRunArn :: Text
$sel:assessmentRunArn:GetAssessmentReport' :: GetAssessmentReport -> Text
assessmentRunArn} -> Text
assessmentRunArn) (\s :: GetAssessmentReport
s@GetAssessmentReport' {} Text
a -> GetAssessmentReport
s {$sel:assessmentRunArn:GetAssessmentReport' :: Text
assessmentRunArn = Text
a} :: GetAssessmentReport)
getAssessmentReport_reportFileFormat :: Lens.Lens' GetAssessmentReport ReportFileFormat
getAssessmentReport_reportFileFormat :: (ReportFileFormat -> f ReportFileFormat)
-> GetAssessmentReport -> f GetAssessmentReport
getAssessmentReport_reportFileFormat = (GetAssessmentReport -> ReportFileFormat)
-> (GetAssessmentReport -> ReportFileFormat -> GetAssessmentReport)
-> Lens
GetAssessmentReport
GetAssessmentReport
ReportFileFormat
ReportFileFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssessmentReport' {ReportFileFormat
reportFileFormat :: ReportFileFormat
$sel:reportFileFormat:GetAssessmentReport' :: GetAssessmentReport -> ReportFileFormat
reportFileFormat} -> ReportFileFormat
reportFileFormat) (\s :: GetAssessmentReport
s@GetAssessmentReport' {} ReportFileFormat
a -> GetAssessmentReport
s {$sel:reportFileFormat:GetAssessmentReport' :: ReportFileFormat
reportFileFormat = ReportFileFormat
a} :: GetAssessmentReport)
getAssessmentReport_reportType :: Lens.Lens' GetAssessmentReport ReportType
getAssessmentReport_reportType :: (ReportType -> f ReportType)
-> GetAssessmentReport -> f GetAssessmentReport
getAssessmentReport_reportType = (GetAssessmentReport -> ReportType)
-> (GetAssessmentReport -> ReportType -> GetAssessmentReport)
-> Lens
GetAssessmentReport GetAssessmentReport ReportType ReportType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssessmentReport' {ReportType
reportType :: ReportType
$sel:reportType:GetAssessmentReport' :: GetAssessmentReport -> ReportType
reportType} -> ReportType
reportType) (\s :: GetAssessmentReport
s@GetAssessmentReport' {} ReportType
a -> GetAssessmentReport
s {$sel:reportType:GetAssessmentReport' :: ReportType
reportType = ReportType
a} :: GetAssessmentReport)
instance Core.AWSRequest GetAssessmentReport where
type
AWSResponse GetAssessmentReport =
GetAssessmentReportResponse
request :: GetAssessmentReport -> Request GetAssessmentReport
request = Service -> GetAssessmentReport -> Request GetAssessmentReport
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetAssessmentReport
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAssessmentReport)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetAssessmentReport))
-> Logger
-> Service
-> Proxy GetAssessmentReport
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAssessmentReport)))
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 Text -> Int -> ReportStatus -> GetAssessmentReportResponse
GetAssessmentReportResponse'
(Maybe Text -> Int -> ReportStatus -> GetAssessmentReportResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> ReportStatus -> GetAssessmentReportResponse)
forall (f :: * -> *) a b. Functor 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
"url")
Either String (Int -> ReportStatus -> GetAssessmentReportResponse)
-> Either String Int
-> Either String (ReportStatus -> GetAssessmentReportResponse)
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))
Either String (ReportStatus -> GetAssessmentReportResponse)
-> Either String ReportStatus
-> Either String GetAssessmentReportResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ReportStatus
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"status")
)
instance Prelude.Hashable GetAssessmentReport
instance Prelude.NFData GetAssessmentReport
instance Core.ToHeaders GetAssessmentReport where
toHeaders :: GetAssessmentReport -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetAssessmentReport -> 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
"InspectorService.GetAssessmentReport" ::
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 GetAssessmentReport where
toJSON :: GetAssessmentReport -> Value
toJSON GetAssessmentReport' {Text
ReportFileFormat
ReportType
reportType :: ReportType
reportFileFormat :: ReportFileFormat
assessmentRunArn :: Text
$sel:reportType:GetAssessmentReport' :: GetAssessmentReport -> ReportType
$sel:reportFileFormat:GetAssessmentReport' :: GetAssessmentReport -> ReportFileFormat
$sel:assessmentRunArn:GetAssessmentReport' :: GetAssessmentReport -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"assessmentRunArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
assessmentRunArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"reportFileFormat" Text -> ReportFileFormat -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ReportFileFormat
reportFileFormat),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"reportType" Text -> ReportType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ReportType
reportType)
]
)
instance Core.ToPath GetAssessmentReport where
toPath :: GetAssessmentReport -> ByteString
toPath = ByteString -> GetAssessmentReport -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetAssessmentReport where
toQuery :: GetAssessmentReport -> QueryString
toQuery = QueryString -> GetAssessmentReport -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetAssessmentReportResponse = GetAssessmentReportResponse'
{
GetAssessmentReportResponse -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
GetAssessmentReportResponse -> Int
httpStatus :: Prelude.Int,
GetAssessmentReportResponse -> ReportStatus
status :: ReportStatus
}
deriving (GetAssessmentReportResponse -> GetAssessmentReportResponse -> Bool
(GetAssessmentReportResponse
-> GetAssessmentReportResponse -> Bool)
-> (GetAssessmentReportResponse
-> GetAssessmentReportResponse -> Bool)
-> Eq GetAssessmentReportResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAssessmentReportResponse -> GetAssessmentReportResponse -> Bool
$c/= :: GetAssessmentReportResponse -> GetAssessmentReportResponse -> Bool
== :: GetAssessmentReportResponse -> GetAssessmentReportResponse -> Bool
$c== :: GetAssessmentReportResponse -> GetAssessmentReportResponse -> Bool
Prelude.Eq, ReadPrec [GetAssessmentReportResponse]
ReadPrec GetAssessmentReportResponse
Int -> ReadS GetAssessmentReportResponse
ReadS [GetAssessmentReportResponse]
(Int -> ReadS GetAssessmentReportResponse)
-> ReadS [GetAssessmentReportResponse]
-> ReadPrec GetAssessmentReportResponse
-> ReadPrec [GetAssessmentReportResponse]
-> Read GetAssessmentReportResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAssessmentReportResponse]
$creadListPrec :: ReadPrec [GetAssessmentReportResponse]
readPrec :: ReadPrec GetAssessmentReportResponse
$creadPrec :: ReadPrec GetAssessmentReportResponse
readList :: ReadS [GetAssessmentReportResponse]
$creadList :: ReadS [GetAssessmentReportResponse]
readsPrec :: Int -> ReadS GetAssessmentReportResponse
$creadsPrec :: Int -> ReadS GetAssessmentReportResponse
Prelude.Read, Int -> GetAssessmentReportResponse -> ShowS
[GetAssessmentReportResponse] -> ShowS
GetAssessmentReportResponse -> String
(Int -> GetAssessmentReportResponse -> ShowS)
-> (GetAssessmentReportResponse -> String)
-> ([GetAssessmentReportResponse] -> ShowS)
-> Show GetAssessmentReportResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAssessmentReportResponse] -> ShowS
$cshowList :: [GetAssessmentReportResponse] -> ShowS
show :: GetAssessmentReportResponse -> String
$cshow :: GetAssessmentReportResponse -> String
showsPrec :: Int -> GetAssessmentReportResponse -> ShowS
$cshowsPrec :: Int -> GetAssessmentReportResponse -> ShowS
Prelude.Show, (forall x.
GetAssessmentReportResponse -> Rep GetAssessmentReportResponse x)
-> (forall x.
Rep GetAssessmentReportResponse x -> GetAssessmentReportResponse)
-> Generic GetAssessmentReportResponse
forall x.
Rep GetAssessmentReportResponse x -> GetAssessmentReportResponse
forall x.
GetAssessmentReportResponse -> Rep GetAssessmentReportResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAssessmentReportResponse x -> GetAssessmentReportResponse
$cfrom :: forall x.
GetAssessmentReportResponse -> Rep GetAssessmentReportResponse x
Prelude.Generic)
newGetAssessmentReportResponse ::
Prelude.Int ->
ReportStatus ->
GetAssessmentReportResponse
newGetAssessmentReportResponse :: Int -> ReportStatus -> GetAssessmentReportResponse
newGetAssessmentReportResponse Int
pHttpStatus_ ReportStatus
pStatus_ =
GetAssessmentReportResponse' :: Maybe Text -> Int -> ReportStatus -> GetAssessmentReportResponse
GetAssessmentReportResponse'
{ $sel:url:GetAssessmentReportResponse' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAssessmentReportResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:status:GetAssessmentReportResponse' :: ReportStatus
status = ReportStatus
pStatus_
}
getAssessmentReportResponse_url :: Lens.Lens' GetAssessmentReportResponse (Prelude.Maybe Prelude.Text)
getAssessmentReportResponse_url :: (Maybe Text -> f (Maybe Text))
-> GetAssessmentReportResponse -> f GetAssessmentReportResponse
getAssessmentReportResponse_url = (GetAssessmentReportResponse -> Maybe Text)
-> (GetAssessmentReportResponse
-> Maybe Text -> GetAssessmentReportResponse)
-> Lens
GetAssessmentReportResponse
GetAssessmentReportResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssessmentReportResponse' {Maybe Text
url :: Maybe Text
$sel:url:GetAssessmentReportResponse' :: GetAssessmentReportResponse -> Maybe Text
url} -> Maybe Text
url) (\s :: GetAssessmentReportResponse
s@GetAssessmentReportResponse' {} Maybe Text
a -> GetAssessmentReportResponse
s {$sel:url:GetAssessmentReportResponse' :: Maybe Text
url = Maybe Text
a} :: GetAssessmentReportResponse)
getAssessmentReportResponse_httpStatus :: Lens.Lens' GetAssessmentReportResponse Prelude.Int
getAssessmentReportResponse_httpStatus :: (Int -> f Int)
-> GetAssessmentReportResponse -> f GetAssessmentReportResponse
getAssessmentReportResponse_httpStatus = (GetAssessmentReportResponse -> Int)
-> (GetAssessmentReportResponse
-> Int -> GetAssessmentReportResponse)
-> Lens
GetAssessmentReportResponse GetAssessmentReportResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssessmentReportResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAssessmentReportResponse' :: GetAssessmentReportResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAssessmentReportResponse
s@GetAssessmentReportResponse' {} Int
a -> GetAssessmentReportResponse
s {$sel:httpStatus:GetAssessmentReportResponse' :: Int
httpStatus = Int
a} :: GetAssessmentReportResponse)
getAssessmentReportResponse_status :: Lens.Lens' GetAssessmentReportResponse ReportStatus
getAssessmentReportResponse_status :: (ReportStatus -> f ReportStatus)
-> GetAssessmentReportResponse -> f GetAssessmentReportResponse
getAssessmentReportResponse_status = (GetAssessmentReportResponse -> ReportStatus)
-> (GetAssessmentReportResponse
-> ReportStatus -> GetAssessmentReportResponse)
-> Lens
GetAssessmentReportResponse
GetAssessmentReportResponse
ReportStatus
ReportStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAssessmentReportResponse' {ReportStatus
status :: ReportStatus
$sel:status:GetAssessmentReportResponse' :: GetAssessmentReportResponse -> ReportStatus
status} -> ReportStatus
status) (\s :: GetAssessmentReportResponse
s@GetAssessmentReportResponse' {} ReportStatus
a -> GetAssessmentReportResponse
s {$sel:status:GetAssessmentReportResponse' :: ReportStatus
status = ReportStatus
a} :: GetAssessmentReportResponse)
instance Prelude.NFData GetAssessmentReportResponse