{-# 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.SecurityHub.GetInsightResults
(
GetInsightResults (..),
newGetInsightResults,
getInsightResults_insightArn,
GetInsightResultsResponse (..),
newGetInsightResultsResponse,
getInsightResultsResponse_httpStatus,
getInsightResultsResponse_insightResults,
)
where
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
import Amazonka.SecurityHub.Types
data GetInsightResults = GetInsightResults'
{
GetInsightResults -> Text
insightArn :: Prelude.Text
}
deriving (GetInsightResults -> GetInsightResults -> Bool
(GetInsightResults -> GetInsightResults -> Bool)
-> (GetInsightResults -> GetInsightResults -> Bool)
-> Eq GetInsightResults
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightResults -> GetInsightResults -> Bool
$c/= :: GetInsightResults -> GetInsightResults -> Bool
== :: GetInsightResults -> GetInsightResults -> Bool
$c== :: GetInsightResults -> GetInsightResults -> Bool
Prelude.Eq, ReadPrec [GetInsightResults]
ReadPrec GetInsightResults
Int -> ReadS GetInsightResults
ReadS [GetInsightResults]
(Int -> ReadS GetInsightResults)
-> ReadS [GetInsightResults]
-> ReadPrec GetInsightResults
-> ReadPrec [GetInsightResults]
-> Read GetInsightResults
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightResults]
$creadListPrec :: ReadPrec [GetInsightResults]
readPrec :: ReadPrec GetInsightResults
$creadPrec :: ReadPrec GetInsightResults
readList :: ReadS [GetInsightResults]
$creadList :: ReadS [GetInsightResults]
readsPrec :: Int -> ReadS GetInsightResults
$creadsPrec :: Int -> ReadS GetInsightResults
Prelude.Read, Int -> GetInsightResults -> ShowS
[GetInsightResults] -> ShowS
GetInsightResults -> String
(Int -> GetInsightResults -> ShowS)
-> (GetInsightResults -> String)
-> ([GetInsightResults] -> ShowS)
-> Show GetInsightResults
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightResults] -> ShowS
$cshowList :: [GetInsightResults] -> ShowS
show :: GetInsightResults -> String
$cshow :: GetInsightResults -> String
showsPrec :: Int -> GetInsightResults -> ShowS
$cshowsPrec :: Int -> GetInsightResults -> ShowS
Prelude.Show, (forall x. GetInsightResults -> Rep GetInsightResults x)
-> (forall x. Rep GetInsightResults x -> GetInsightResults)
-> Generic GetInsightResults
forall x. Rep GetInsightResults x -> GetInsightResults
forall x. GetInsightResults -> Rep GetInsightResults x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetInsightResults x -> GetInsightResults
$cfrom :: forall x. GetInsightResults -> Rep GetInsightResults x
Prelude.Generic)
newGetInsightResults ::
Prelude.Text ->
GetInsightResults
newGetInsightResults :: Text -> GetInsightResults
newGetInsightResults Text
pInsightArn_ =
GetInsightResults' :: Text -> GetInsightResults
GetInsightResults' {$sel:insightArn:GetInsightResults' :: Text
insightArn = Text
pInsightArn_}
getInsightResults_insightArn :: Lens.Lens' GetInsightResults Prelude.Text
getInsightResults_insightArn :: (Text -> f Text) -> GetInsightResults -> f GetInsightResults
getInsightResults_insightArn = (GetInsightResults -> Text)
-> (GetInsightResults -> Text -> GetInsightResults)
-> Lens GetInsightResults GetInsightResults Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightResults' {Text
insightArn :: Text
$sel:insightArn:GetInsightResults' :: GetInsightResults -> Text
insightArn} -> Text
insightArn) (\s :: GetInsightResults
s@GetInsightResults' {} Text
a -> GetInsightResults
s {$sel:insightArn:GetInsightResults' :: Text
insightArn = Text
a} :: GetInsightResults)
instance Core.AWSRequest GetInsightResults where
type
AWSResponse GetInsightResults =
GetInsightResultsResponse
request :: GetInsightResults -> Request GetInsightResults
request = Service -> GetInsightResults -> Request GetInsightResults
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetInsightResults
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInsightResults)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetInsightResults))
-> Logger
-> Service
-> Proxy GetInsightResults
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetInsightResults)))
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 ->
Int -> InsightResults -> GetInsightResultsResponse
GetInsightResultsResponse'
(Int -> InsightResults -> GetInsightResultsResponse)
-> Either String Int
-> Either String (InsightResults -> GetInsightResultsResponse)
forall (f :: * -> *) a b. Functor 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 (InsightResults -> GetInsightResultsResponse)
-> Either String InsightResults
-> Either String GetInsightResultsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String InsightResults
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"InsightResults")
)
instance Prelude.Hashable GetInsightResults
instance Prelude.NFData GetInsightResults
instance Core.ToHeaders GetInsightResults where
toHeaders :: GetInsightResults -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetInsightResults -> 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 GetInsightResults where
toPath :: GetInsightResults -> ByteString
toPath GetInsightResults' {Text
insightArn :: Text
$sel:insightArn:GetInsightResults' :: GetInsightResults -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/insights/results/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
insightArn]
instance Core.ToQuery GetInsightResults where
toQuery :: GetInsightResults -> QueryString
toQuery = QueryString -> GetInsightResults -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetInsightResultsResponse = GetInsightResultsResponse'
{
GetInsightResultsResponse -> Int
httpStatus :: Prelude.Int,
GetInsightResultsResponse -> InsightResults
insightResults :: InsightResults
}
deriving (GetInsightResultsResponse -> GetInsightResultsResponse -> Bool
(GetInsightResultsResponse -> GetInsightResultsResponse -> Bool)
-> (GetInsightResultsResponse -> GetInsightResultsResponse -> Bool)
-> Eq GetInsightResultsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInsightResultsResponse -> GetInsightResultsResponse -> Bool
$c/= :: GetInsightResultsResponse -> GetInsightResultsResponse -> Bool
== :: GetInsightResultsResponse -> GetInsightResultsResponse -> Bool
$c== :: GetInsightResultsResponse -> GetInsightResultsResponse -> Bool
Prelude.Eq, ReadPrec [GetInsightResultsResponse]
ReadPrec GetInsightResultsResponse
Int -> ReadS GetInsightResultsResponse
ReadS [GetInsightResultsResponse]
(Int -> ReadS GetInsightResultsResponse)
-> ReadS [GetInsightResultsResponse]
-> ReadPrec GetInsightResultsResponse
-> ReadPrec [GetInsightResultsResponse]
-> Read GetInsightResultsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInsightResultsResponse]
$creadListPrec :: ReadPrec [GetInsightResultsResponse]
readPrec :: ReadPrec GetInsightResultsResponse
$creadPrec :: ReadPrec GetInsightResultsResponse
readList :: ReadS [GetInsightResultsResponse]
$creadList :: ReadS [GetInsightResultsResponse]
readsPrec :: Int -> ReadS GetInsightResultsResponse
$creadsPrec :: Int -> ReadS GetInsightResultsResponse
Prelude.Read, Int -> GetInsightResultsResponse -> ShowS
[GetInsightResultsResponse] -> ShowS
GetInsightResultsResponse -> String
(Int -> GetInsightResultsResponse -> ShowS)
-> (GetInsightResultsResponse -> String)
-> ([GetInsightResultsResponse] -> ShowS)
-> Show GetInsightResultsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInsightResultsResponse] -> ShowS
$cshowList :: [GetInsightResultsResponse] -> ShowS
show :: GetInsightResultsResponse -> String
$cshow :: GetInsightResultsResponse -> String
showsPrec :: Int -> GetInsightResultsResponse -> ShowS
$cshowsPrec :: Int -> GetInsightResultsResponse -> ShowS
Prelude.Show, (forall x.
GetInsightResultsResponse -> Rep GetInsightResultsResponse x)
-> (forall x.
Rep GetInsightResultsResponse x -> GetInsightResultsResponse)
-> Generic GetInsightResultsResponse
forall x.
Rep GetInsightResultsResponse x -> GetInsightResultsResponse
forall x.
GetInsightResultsResponse -> Rep GetInsightResultsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInsightResultsResponse x -> GetInsightResultsResponse
$cfrom :: forall x.
GetInsightResultsResponse -> Rep GetInsightResultsResponse x
Prelude.Generic)
newGetInsightResultsResponse ::
Prelude.Int ->
InsightResults ->
GetInsightResultsResponse
newGetInsightResultsResponse :: Int -> InsightResults -> GetInsightResultsResponse
newGetInsightResultsResponse
Int
pHttpStatus_
InsightResults
pInsightResults_ =
GetInsightResultsResponse' :: Int -> InsightResults -> GetInsightResultsResponse
GetInsightResultsResponse'
{ $sel:httpStatus:GetInsightResultsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:insightResults:GetInsightResultsResponse' :: InsightResults
insightResults = InsightResults
pInsightResults_
}
getInsightResultsResponse_httpStatus :: Lens.Lens' GetInsightResultsResponse Prelude.Int
getInsightResultsResponse_httpStatus :: (Int -> f Int)
-> GetInsightResultsResponse -> f GetInsightResultsResponse
getInsightResultsResponse_httpStatus = (GetInsightResultsResponse -> Int)
-> (GetInsightResultsResponse -> Int -> GetInsightResultsResponse)
-> Lens GetInsightResultsResponse GetInsightResultsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightResultsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInsightResultsResponse' :: GetInsightResultsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInsightResultsResponse
s@GetInsightResultsResponse' {} Int
a -> GetInsightResultsResponse
s {$sel:httpStatus:GetInsightResultsResponse' :: Int
httpStatus = Int
a} :: GetInsightResultsResponse)
getInsightResultsResponse_insightResults :: Lens.Lens' GetInsightResultsResponse InsightResults
getInsightResultsResponse_insightResults :: (InsightResults -> f InsightResults)
-> GetInsightResultsResponse -> f GetInsightResultsResponse
getInsightResultsResponse_insightResults = (GetInsightResultsResponse -> InsightResults)
-> (GetInsightResultsResponse
-> InsightResults -> GetInsightResultsResponse)
-> Lens
GetInsightResultsResponse
GetInsightResultsResponse
InsightResults
InsightResults
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInsightResultsResponse' {InsightResults
insightResults :: InsightResults
$sel:insightResults:GetInsightResultsResponse' :: GetInsightResultsResponse -> InsightResults
insightResults} -> InsightResults
insightResults) (\s :: GetInsightResultsResponse
s@GetInsightResultsResponse' {} InsightResults
a -> GetInsightResultsResponse
s {$sel:insightResults:GetInsightResultsResponse' :: InsightResults
insightResults = InsightResults
a} :: GetInsightResultsResponse)
instance Prelude.NFData GetInsightResultsResponse