{-# 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.GetAccessPreview
(
GetAccessPreview (..),
newGetAccessPreview,
getAccessPreview_accessPreviewId,
getAccessPreview_analyzerArn,
GetAccessPreviewResponse (..),
newGetAccessPreviewResponse,
getAccessPreviewResponse_httpStatus,
getAccessPreviewResponse_accessPreview,
)
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 GetAccessPreview = GetAccessPreview'
{
GetAccessPreview -> Text
accessPreviewId :: Prelude.Text,
GetAccessPreview -> Text
analyzerArn :: Prelude.Text
}
deriving (GetAccessPreview -> GetAccessPreview -> Bool
(GetAccessPreview -> GetAccessPreview -> Bool)
-> (GetAccessPreview -> GetAccessPreview -> Bool)
-> Eq GetAccessPreview
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccessPreview -> GetAccessPreview -> Bool
$c/= :: GetAccessPreview -> GetAccessPreview -> Bool
== :: GetAccessPreview -> GetAccessPreview -> Bool
$c== :: GetAccessPreview -> GetAccessPreview -> Bool
Prelude.Eq, ReadPrec [GetAccessPreview]
ReadPrec GetAccessPreview
Int -> ReadS GetAccessPreview
ReadS [GetAccessPreview]
(Int -> ReadS GetAccessPreview)
-> ReadS [GetAccessPreview]
-> ReadPrec GetAccessPreview
-> ReadPrec [GetAccessPreview]
-> Read GetAccessPreview
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccessPreview]
$creadListPrec :: ReadPrec [GetAccessPreview]
readPrec :: ReadPrec GetAccessPreview
$creadPrec :: ReadPrec GetAccessPreview
readList :: ReadS [GetAccessPreview]
$creadList :: ReadS [GetAccessPreview]
readsPrec :: Int -> ReadS GetAccessPreview
$creadsPrec :: Int -> ReadS GetAccessPreview
Prelude.Read, Int -> GetAccessPreview -> ShowS
[GetAccessPreview] -> ShowS
GetAccessPreview -> String
(Int -> GetAccessPreview -> ShowS)
-> (GetAccessPreview -> String)
-> ([GetAccessPreview] -> ShowS)
-> Show GetAccessPreview
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccessPreview] -> ShowS
$cshowList :: [GetAccessPreview] -> ShowS
show :: GetAccessPreview -> String
$cshow :: GetAccessPreview -> String
showsPrec :: Int -> GetAccessPreview -> ShowS
$cshowsPrec :: Int -> GetAccessPreview -> ShowS
Prelude.Show, (forall x. GetAccessPreview -> Rep GetAccessPreview x)
-> (forall x. Rep GetAccessPreview x -> GetAccessPreview)
-> Generic GetAccessPreview
forall x. Rep GetAccessPreview x -> GetAccessPreview
forall x. GetAccessPreview -> Rep GetAccessPreview x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAccessPreview x -> GetAccessPreview
$cfrom :: forall x. GetAccessPreview -> Rep GetAccessPreview x
Prelude.Generic)
newGetAccessPreview ::
Prelude.Text ->
Prelude.Text ->
GetAccessPreview
newGetAccessPreview :: Text -> Text -> GetAccessPreview
newGetAccessPreview Text
pAccessPreviewId_ Text
pAnalyzerArn_ =
GetAccessPreview' :: Text -> Text -> GetAccessPreview
GetAccessPreview'
{ $sel:accessPreviewId:GetAccessPreview' :: Text
accessPreviewId =
Text
pAccessPreviewId_,
$sel:analyzerArn:GetAccessPreview' :: Text
analyzerArn = Text
pAnalyzerArn_
}
getAccessPreview_accessPreviewId :: Lens.Lens' GetAccessPreview Prelude.Text
getAccessPreview_accessPreviewId :: (Text -> f Text) -> GetAccessPreview -> f GetAccessPreview
getAccessPreview_accessPreviewId = (GetAccessPreview -> Text)
-> (GetAccessPreview -> Text -> GetAccessPreview)
-> Lens GetAccessPreview GetAccessPreview Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccessPreview' {Text
accessPreviewId :: Text
$sel:accessPreviewId:GetAccessPreview' :: GetAccessPreview -> Text
accessPreviewId} -> Text
accessPreviewId) (\s :: GetAccessPreview
s@GetAccessPreview' {} Text
a -> GetAccessPreview
s {$sel:accessPreviewId:GetAccessPreview' :: Text
accessPreviewId = Text
a} :: GetAccessPreview)
getAccessPreview_analyzerArn :: Lens.Lens' GetAccessPreview Prelude.Text
getAccessPreview_analyzerArn :: (Text -> f Text) -> GetAccessPreview -> f GetAccessPreview
getAccessPreview_analyzerArn = (GetAccessPreview -> Text)
-> (GetAccessPreview -> Text -> GetAccessPreview)
-> Lens GetAccessPreview GetAccessPreview Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccessPreview' {Text
analyzerArn :: Text
$sel:analyzerArn:GetAccessPreview' :: GetAccessPreview -> Text
analyzerArn} -> Text
analyzerArn) (\s :: GetAccessPreview
s@GetAccessPreview' {} Text
a -> GetAccessPreview
s {$sel:analyzerArn:GetAccessPreview' :: Text
analyzerArn = Text
a} :: GetAccessPreview)
instance Core.AWSRequest GetAccessPreview where
type
AWSResponse GetAccessPreview =
GetAccessPreviewResponse
request :: GetAccessPreview -> Request GetAccessPreview
request = Service -> GetAccessPreview -> Request GetAccessPreview
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetAccessPreview
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAccessPreview)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetAccessPreview))
-> Logger
-> Service
-> Proxy GetAccessPreview
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAccessPreview)))
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 -> AccessPreview -> GetAccessPreviewResponse
GetAccessPreviewResponse'
(Int -> AccessPreview -> GetAccessPreviewResponse)
-> Either String Int
-> Either String (AccessPreview -> GetAccessPreviewResponse)
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 (AccessPreview -> GetAccessPreviewResponse)
-> Either String AccessPreview
-> Either String GetAccessPreviewResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String AccessPreview
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"accessPreview")
)
instance Prelude.Hashable GetAccessPreview
instance Prelude.NFData GetAccessPreview
instance Core.ToHeaders GetAccessPreview where
toHeaders :: GetAccessPreview -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetAccessPreview -> 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 GetAccessPreview where
toPath :: GetAccessPreview -> ByteString
toPath GetAccessPreview' {Text
analyzerArn :: Text
accessPreviewId :: Text
$sel:analyzerArn:GetAccessPreview' :: GetAccessPreview -> Text
$sel:accessPreviewId:GetAccessPreview' :: GetAccessPreview -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/access-preview/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accessPreviewId]
instance Core.ToQuery GetAccessPreview where
toQuery :: GetAccessPreview -> QueryString
toQuery GetAccessPreview' {Text
analyzerArn :: Text
accessPreviewId :: Text
$sel:analyzerArn:GetAccessPreview' :: GetAccessPreview -> Text
$sel:accessPreviewId:GetAccessPreview' :: GetAccessPreview -> 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]
data GetAccessPreviewResponse = GetAccessPreviewResponse'
{
GetAccessPreviewResponse -> Int
httpStatus :: Prelude.Int,
GetAccessPreviewResponse -> AccessPreview
accessPreview :: AccessPreview
}
deriving (GetAccessPreviewResponse -> GetAccessPreviewResponse -> Bool
(GetAccessPreviewResponse -> GetAccessPreviewResponse -> Bool)
-> (GetAccessPreviewResponse -> GetAccessPreviewResponse -> Bool)
-> Eq GetAccessPreviewResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAccessPreviewResponse -> GetAccessPreviewResponse -> Bool
$c/= :: GetAccessPreviewResponse -> GetAccessPreviewResponse -> Bool
== :: GetAccessPreviewResponse -> GetAccessPreviewResponse -> Bool
$c== :: GetAccessPreviewResponse -> GetAccessPreviewResponse -> Bool
Prelude.Eq, ReadPrec [GetAccessPreviewResponse]
ReadPrec GetAccessPreviewResponse
Int -> ReadS GetAccessPreviewResponse
ReadS [GetAccessPreviewResponse]
(Int -> ReadS GetAccessPreviewResponse)
-> ReadS [GetAccessPreviewResponse]
-> ReadPrec GetAccessPreviewResponse
-> ReadPrec [GetAccessPreviewResponse]
-> Read GetAccessPreviewResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAccessPreviewResponse]
$creadListPrec :: ReadPrec [GetAccessPreviewResponse]
readPrec :: ReadPrec GetAccessPreviewResponse
$creadPrec :: ReadPrec GetAccessPreviewResponse
readList :: ReadS [GetAccessPreviewResponse]
$creadList :: ReadS [GetAccessPreviewResponse]
readsPrec :: Int -> ReadS GetAccessPreviewResponse
$creadsPrec :: Int -> ReadS GetAccessPreviewResponse
Prelude.Read, Int -> GetAccessPreviewResponse -> ShowS
[GetAccessPreviewResponse] -> ShowS
GetAccessPreviewResponse -> String
(Int -> GetAccessPreviewResponse -> ShowS)
-> (GetAccessPreviewResponse -> String)
-> ([GetAccessPreviewResponse] -> ShowS)
-> Show GetAccessPreviewResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAccessPreviewResponse] -> ShowS
$cshowList :: [GetAccessPreviewResponse] -> ShowS
show :: GetAccessPreviewResponse -> String
$cshow :: GetAccessPreviewResponse -> String
showsPrec :: Int -> GetAccessPreviewResponse -> ShowS
$cshowsPrec :: Int -> GetAccessPreviewResponse -> ShowS
Prelude.Show, (forall x.
GetAccessPreviewResponse -> Rep GetAccessPreviewResponse x)
-> (forall x.
Rep GetAccessPreviewResponse x -> GetAccessPreviewResponse)
-> Generic GetAccessPreviewResponse
forall x.
Rep GetAccessPreviewResponse x -> GetAccessPreviewResponse
forall x.
GetAccessPreviewResponse -> Rep GetAccessPreviewResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAccessPreviewResponse x -> GetAccessPreviewResponse
$cfrom :: forall x.
GetAccessPreviewResponse -> Rep GetAccessPreviewResponse x
Prelude.Generic)
newGetAccessPreviewResponse ::
Prelude.Int ->
AccessPreview ->
GetAccessPreviewResponse
newGetAccessPreviewResponse :: Int -> AccessPreview -> GetAccessPreviewResponse
newGetAccessPreviewResponse
Int
pHttpStatus_
AccessPreview
pAccessPreview_ =
GetAccessPreviewResponse' :: Int -> AccessPreview -> GetAccessPreviewResponse
GetAccessPreviewResponse'
{ $sel:httpStatus:GetAccessPreviewResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:accessPreview:GetAccessPreviewResponse' :: AccessPreview
accessPreview = AccessPreview
pAccessPreview_
}
getAccessPreviewResponse_httpStatus :: Lens.Lens' GetAccessPreviewResponse Prelude.Int
getAccessPreviewResponse_httpStatus :: (Int -> f Int)
-> GetAccessPreviewResponse -> f GetAccessPreviewResponse
getAccessPreviewResponse_httpStatus = (GetAccessPreviewResponse -> Int)
-> (GetAccessPreviewResponse -> Int -> GetAccessPreviewResponse)
-> Lens GetAccessPreviewResponse GetAccessPreviewResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccessPreviewResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAccessPreviewResponse' :: GetAccessPreviewResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAccessPreviewResponse
s@GetAccessPreviewResponse' {} Int
a -> GetAccessPreviewResponse
s {$sel:httpStatus:GetAccessPreviewResponse' :: Int
httpStatus = Int
a} :: GetAccessPreviewResponse)
getAccessPreviewResponse_accessPreview :: Lens.Lens' GetAccessPreviewResponse AccessPreview
getAccessPreviewResponse_accessPreview :: (AccessPreview -> f AccessPreview)
-> GetAccessPreviewResponse -> f GetAccessPreviewResponse
getAccessPreviewResponse_accessPreview = (GetAccessPreviewResponse -> AccessPreview)
-> (GetAccessPreviewResponse
-> AccessPreview -> GetAccessPreviewResponse)
-> Lens
GetAccessPreviewResponse
GetAccessPreviewResponse
AccessPreview
AccessPreview
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAccessPreviewResponse' {AccessPreview
accessPreview :: AccessPreview
$sel:accessPreview:GetAccessPreviewResponse' :: GetAccessPreviewResponse -> AccessPreview
accessPreview} -> AccessPreview
accessPreview) (\s :: GetAccessPreviewResponse
s@GetAccessPreviewResponse' {} AccessPreview
a -> GetAccessPreviewResponse
s {$sel:accessPreview:GetAccessPreviewResponse' :: AccessPreview
accessPreview = AccessPreview
a} :: GetAccessPreviewResponse)
instance Prelude.NFData GetAccessPreviewResponse