{-# 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.AccessAnalyzer.GetAnalyzedResource
(
GetAnalyzedResource (..),
newGetAnalyzedResource,
getAnalyzedResource_analyzerArn,
getAnalyzedResource_resourceArn,
GetAnalyzedResourceResponse (..),
newGetAnalyzedResourceResponse,
getAnalyzedResourceResponse_resource,
getAnalyzedResourceResponse_httpStatus,
)
where
import Amazonka.AccessAnalyzer.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 GetAnalyzedResource = GetAnalyzedResource'
{
GetAnalyzedResource -> Text
analyzerArn :: Prelude.Text,
GetAnalyzedResource -> Text
resourceArn :: Prelude.Text
}
deriving (GetAnalyzedResource -> GetAnalyzedResource -> Bool
(GetAnalyzedResource -> GetAnalyzedResource -> Bool)
-> (GetAnalyzedResource -> GetAnalyzedResource -> Bool)
-> Eq GetAnalyzedResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAnalyzedResource -> GetAnalyzedResource -> Bool
$c/= :: GetAnalyzedResource -> GetAnalyzedResource -> Bool
== :: GetAnalyzedResource -> GetAnalyzedResource -> Bool
$c== :: GetAnalyzedResource -> GetAnalyzedResource -> Bool
Prelude.Eq, ReadPrec [GetAnalyzedResource]
ReadPrec GetAnalyzedResource
Int -> ReadS GetAnalyzedResource
ReadS [GetAnalyzedResource]
(Int -> ReadS GetAnalyzedResource)
-> ReadS [GetAnalyzedResource]
-> ReadPrec GetAnalyzedResource
-> ReadPrec [GetAnalyzedResource]
-> Read GetAnalyzedResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAnalyzedResource]
$creadListPrec :: ReadPrec [GetAnalyzedResource]
readPrec :: ReadPrec GetAnalyzedResource
$creadPrec :: ReadPrec GetAnalyzedResource
readList :: ReadS [GetAnalyzedResource]
$creadList :: ReadS [GetAnalyzedResource]
readsPrec :: Int -> ReadS GetAnalyzedResource
$creadsPrec :: Int -> ReadS GetAnalyzedResource
Prelude.Read, Int -> GetAnalyzedResource -> ShowS
[GetAnalyzedResource] -> ShowS
GetAnalyzedResource -> String
(Int -> GetAnalyzedResource -> ShowS)
-> (GetAnalyzedResource -> String)
-> ([GetAnalyzedResource] -> ShowS)
-> Show GetAnalyzedResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAnalyzedResource] -> ShowS
$cshowList :: [GetAnalyzedResource] -> ShowS
show :: GetAnalyzedResource -> String
$cshow :: GetAnalyzedResource -> String
showsPrec :: Int -> GetAnalyzedResource -> ShowS
$cshowsPrec :: Int -> GetAnalyzedResource -> ShowS
Prelude.Show, (forall x. GetAnalyzedResource -> Rep GetAnalyzedResource x)
-> (forall x. Rep GetAnalyzedResource x -> GetAnalyzedResource)
-> Generic GetAnalyzedResource
forall x. Rep GetAnalyzedResource x -> GetAnalyzedResource
forall x. GetAnalyzedResource -> Rep GetAnalyzedResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAnalyzedResource x -> GetAnalyzedResource
$cfrom :: forall x. GetAnalyzedResource -> Rep GetAnalyzedResource x
Prelude.Generic)
newGetAnalyzedResource ::
Prelude.Text ->
Prelude.Text ->
GetAnalyzedResource
newGetAnalyzedResource :: Text -> Text -> GetAnalyzedResource
newGetAnalyzedResource Text
pAnalyzerArn_ Text
pResourceArn_ =
GetAnalyzedResource' :: Text -> Text -> GetAnalyzedResource
GetAnalyzedResource'
{ $sel:analyzerArn:GetAnalyzedResource' :: Text
analyzerArn = Text
pAnalyzerArn_,
$sel:resourceArn:GetAnalyzedResource' :: Text
resourceArn = Text
pResourceArn_
}
getAnalyzedResource_analyzerArn :: Lens.Lens' GetAnalyzedResource Prelude.Text
getAnalyzedResource_analyzerArn :: (Text -> f Text) -> GetAnalyzedResource -> f GetAnalyzedResource
getAnalyzedResource_analyzerArn = (GetAnalyzedResource -> Text)
-> (GetAnalyzedResource -> Text -> GetAnalyzedResource)
-> Lens GetAnalyzedResource GetAnalyzedResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnalyzedResource' {Text
analyzerArn :: Text
$sel:analyzerArn:GetAnalyzedResource' :: GetAnalyzedResource -> Text
analyzerArn} -> Text
analyzerArn) (\s :: GetAnalyzedResource
s@GetAnalyzedResource' {} Text
a -> GetAnalyzedResource
s {$sel:analyzerArn:GetAnalyzedResource' :: Text
analyzerArn = Text
a} :: GetAnalyzedResource)
getAnalyzedResource_resourceArn :: Lens.Lens' GetAnalyzedResource Prelude.Text
getAnalyzedResource_resourceArn :: (Text -> f Text) -> GetAnalyzedResource -> f GetAnalyzedResource
getAnalyzedResource_resourceArn = (GetAnalyzedResource -> Text)
-> (GetAnalyzedResource -> Text -> GetAnalyzedResource)
-> Lens GetAnalyzedResource GetAnalyzedResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnalyzedResource' {Text
resourceArn :: Text
$sel:resourceArn:GetAnalyzedResource' :: GetAnalyzedResource -> Text
resourceArn} -> Text
resourceArn) (\s :: GetAnalyzedResource
s@GetAnalyzedResource' {} Text
a -> GetAnalyzedResource
s {$sel:resourceArn:GetAnalyzedResource' :: Text
resourceArn = Text
a} :: GetAnalyzedResource)
instance Core.AWSRequest GetAnalyzedResource where
type
AWSResponse GetAnalyzedResource =
GetAnalyzedResourceResponse
request :: GetAnalyzedResource -> Request GetAnalyzedResource
request = Service -> GetAnalyzedResource -> Request GetAnalyzedResource
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetAnalyzedResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAnalyzedResource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetAnalyzedResource))
-> Logger
-> Service
-> Proxy GetAnalyzedResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAnalyzedResource)))
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 AnalyzedResource -> Int -> GetAnalyzedResourceResponse
GetAnalyzedResourceResponse'
(Maybe AnalyzedResource -> Int -> GetAnalyzedResourceResponse)
-> Either String (Maybe AnalyzedResource)
-> Either String (Int -> GetAnalyzedResourceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe AnalyzedResource)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"resource")
Either String (Int -> GetAnalyzedResourceResponse)
-> Either String Int -> Either String GetAnalyzedResourceResponse
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 GetAnalyzedResource
instance Prelude.NFData GetAnalyzedResource
instance Core.ToHeaders GetAnalyzedResource where
toHeaders :: GetAnalyzedResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetAnalyzedResource -> 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 GetAnalyzedResource where
toPath :: GetAnalyzedResource -> ByteString
toPath = ByteString -> GetAnalyzedResource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/analyzed-resource"
instance Core.ToQuery GetAnalyzedResource where
toQuery :: GetAnalyzedResource -> QueryString
toQuery GetAnalyzedResource' {Text
resourceArn :: Text
analyzerArn :: Text
$sel:resourceArn:GetAnalyzedResource' :: GetAnalyzedResource -> Text
$sel:analyzerArn:GetAnalyzedResource' :: GetAnalyzedResource -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"analyzerArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
analyzerArn,
ByteString
"resourceArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
resourceArn
]
data GetAnalyzedResourceResponse = GetAnalyzedResourceResponse'
{
GetAnalyzedResourceResponse -> Maybe AnalyzedResource
resource :: Prelude.Maybe AnalyzedResource,
GetAnalyzedResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAnalyzedResourceResponse -> GetAnalyzedResourceResponse -> Bool
(GetAnalyzedResourceResponse
-> GetAnalyzedResourceResponse -> Bool)
-> (GetAnalyzedResourceResponse
-> GetAnalyzedResourceResponse -> Bool)
-> Eq GetAnalyzedResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAnalyzedResourceResponse -> GetAnalyzedResourceResponse -> Bool
$c/= :: GetAnalyzedResourceResponse -> GetAnalyzedResourceResponse -> Bool
== :: GetAnalyzedResourceResponse -> GetAnalyzedResourceResponse -> Bool
$c== :: GetAnalyzedResourceResponse -> GetAnalyzedResourceResponse -> Bool
Prelude.Eq, ReadPrec [GetAnalyzedResourceResponse]
ReadPrec GetAnalyzedResourceResponse
Int -> ReadS GetAnalyzedResourceResponse
ReadS [GetAnalyzedResourceResponse]
(Int -> ReadS GetAnalyzedResourceResponse)
-> ReadS [GetAnalyzedResourceResponse]
-> ReadPrec GetAnalyzedResourceResponse
-> ReadPrec [GetAnalyzedResourceResponse]
-> Read GetAnalyzedResourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAnalyzedResourceResponse]
$creadListPrec :: ReadPrec [GetAnalyzedResourceResponse]
readPrec :: ReadPrec GetAnalyzedResourceResponse
$creadPrec :: ReadPrec GetAnalyzedResourceResponse
readList :: ReadS [GetAnalyzedResourceResponse]
$creadList :: ReadS [GetAnalyzedResourceResponse]
readsPrec :: Int -> ReadS GetAnalyzedResourceResponse
$creadsPrec :: Int -> ReadS GetAnalyzedResourceResponse
Prelude.Read, Int -> GetAnalyzedResourceResponse -> ShowS
[GetAnalyzedResourceResponse] -> ShowS
GetAnalyzedResourceResponse -> String
(Int -> GetAnalyzedResourceResponse -> ShowS)
-> (GetAnalyzedResourceResponse -> String)
-> ([GetAnalyzedResourceResponse] -> ShowS)
-> Show GetAnalyzedResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAnalyzedResourceResponse] -> ShowS
$cshowList :: [GetAnalyzedResourceResponse] -> ShowS
show :: GetAnalyzedResourceResponse -> String
$cshow :: GetAnalyzedResourceResponse -> String
showsPrec :: Int -> GetAnalyzedResourceResponse -> ShowS
$cshowsPrec :: Int -> GetAnalyzedResourceResponse -> ShowS
Prelude.Show, (forall x.
GetAnalyzedResourceResponse -> Rep GetAnalyzedResourceResponse x)
-> (forall x.
Rep GetAnalyzedResourceResponse x -> GetAnalyzedResourceResponse)
-> Generic GetAnalyzedResourceResponse
forall x.
Rep GetAnalyzedResourceResponse x -> GetAnalyzedResourceResponse
forall x.
GetAnalyzedResourceResponse -> Rep GetAnalyzedResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAnalyzedResourceResponse x -> GetAnalyzedResourceResponse
$cfrom :: forall x.
GetAnalyzedResourceResponse -> Rep GetAnalyzedResourceResponse x
Prelude.Generic)
newGetAnalyzedResourceResponse ::
Prelude.Int ->
GetAnalyzedResourceResponse
newGetAnalyzedResourceResponse :: Int -> GetAnalyzedResourceResponse
newGetAnalyzedResourceResponse Int
pHttpStatus_ =
GetAnalyzedResourceResponse' :: Maybe AnalyzedResource -> Int -> GetAnalyzedResourceResponse
GetAnalyzedResourceResponse'
{ $sel:resource:GetAnalyzedResourceResponse' :: Maybe AnalyzedResource
resource =
Maybe AnalyzedResource
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAnalyzedResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAnalyzedResourceResponse_resource :: Lens.Lens' GetAnalyzedResourceResponse (Prelude.Maybe AnalyzedResource)
getAnalyzedResourceResponse_resource :: (Maybe AnalyzedResource -> f (Maybe AnalyzedResource))
-> GetAnalyzedResourceResponse -> f GetAnalyzedResourceResponse
getAnalyzedResourceResponse_resource = (GetAnalyzedResourceResponse -> Maybe AnalyzedResource)
-> (GetAnalyzedResourceResponse
-> Maybe AnalyzedResource -> GetAnalyzedResourceResponse)
-> Lens
GetAnalyzedResourceResponse
GetAnalyzedResourceResponse
(Maybe AnalyzedResource)
(Maybe AnalyzedResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnalyzedResourceResponse' {Maybe AnalyzedResource
resource :: Maybe AnalyzedResource
$sel:resource:GetAnalyzedResourceResponse' :: GetAnalyzedResourceResponse -> Maybe AnalyzedResource
resource} -> Maybe AnalyzedResource
resource) (\s :: GetAnalyzedResourceResponse
s@GetAnalyzedResourceResponse' {} Maybe AnalyzedResource
a -> GetAnalyzedResourceResponse
s {$sel:resource:GetAnalyzedResourceResponse' :: Maybe AnalyzedResource
resource = Maybe AnalyzedResource
a} :: GetAnalyzedResourceResponse)
getAnalyzedResourceResponse_httpStatus :: Lens.Lens' GetAnalyzedResourceResponse Prelude.Int
getAnalyzedResourceResponse_httpStatus :: (Int -> f Int)
-> GetAnalyzedResourceResponse -> f GetAnalyzedResourceResponse
getAnalyzedResourceResponse_httpStatus = (GetAnalyzedResourceResponse -> Int)
-> (GetAnalyzedResourceResponse
-> Int -> GetAnalyzedResourceResponse)
-> Lens
GetAnalyzedResourceResponse GetAnalyzedResourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAnalyzedResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAnalyzedResourceResponse' :: GetAnalyzedResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAnalyzedResourceResponse
s@GetAnalyzedResourceResponse' {} Int
a -> GetAnalyzedResourceResponse
s {$sel:httpStatus:GetAnalyzedResourceResponse' :: Int
httpStatus = Int
a} :: GetAnalyzedResourceResponse)
instance Prelude.NFData GetAnalyzedResourceResponse