{-# 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.CreateAccessPreview
(
CreateAccessPreview (..),
newCreateAccessPreview,
createAccessPreview_clientToken,
createAccessPreview_analyzerArn,
createAccessPreview_configurations,
CreateAccessPreviewResponse (..),
newCreateAccessPreviewResponse,
createAccessPreviewResponse_httpStatus,
createAccessPreviewResponse_id,
)
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 CreateAccessPreview = CreateAccessPreview'
{
CreateAccessPreview -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateAccessPreview -> Text
analyzerArn :: Prelude.Text,
CreateAccessPreview -> HashMap Text Configuration
configurations :: Prelude.HashMap Prelude.Text Configuration
}
deriving (CreateAccessPreview -> CreateAccessPreview -> Bool
(CreateAccessPreview -> CreateAccessPreview -> Bool)
-> (CreateAccessPreview -> CreateAccessPreview -> Bool)
-> Eq CreateAccessPreview
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccessPreview -> CreateAccessPreview -> Bool
$c/= :: CreateAccessPreview -> CreateAccessPreview -> Bool
== :: CreateAccessPreview -> CreateAccessPreview -> Bool
$c== :: CreateAccessPreview -> CreateAccessPreview -> Bool
Prelude.Eq, ReadPrec [CreateAccessPreview]
ReadPrec CreateAccessPreview
Int -> ReadS CreateAccessPreview
ReadS [CreateAccessPreview]
(Int -> ReadS CreateAccessPreview)
-> ReadS [CreateAccessPreview]
-> ReadPrec CreateAccessPreview
-> ReadPrec [CreateAccessPreview]
-> Read CreateAccessPreview
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccessPreview]
$creadListPrec :: ReadPrec [CreateAccessPreview]
readPrec :: ReadPrec CreateAccessPreview
$creadPrec :: ReadPrec CreateAccessPreview
readList :: ReadS [CreateAccessPreview]
$creadList :: ReadS [CreateAccessPreview]
readsPrec :: Int -> ReadS CreateAccessPreview
$creadsPrec :: Int -> ReadS CreateAccessPreview
Prelude.Read, Int -> CreateAccessPreview -> ShowS
[CreateAccessPreview] -> ShowS
CreateAccessPreview -> String
(Int -> CreateAccessPreview -> ShowS)
-> (CreateAccessPreview -> String)
-> ([CreateAccessPreview] -> ShowS)
-> Show CreateAccessPreview
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccessPreview] -> ShowS
$cshowList :: [CreateAccessPreview] -> ShowS
show :: CreateAccessPreview -> String
$cshow :: CreateAccessPreview -> String
showsPrec :: Int -> CreateAccessPreview -> ShowS
$cshowsPrec :: Int -> CreateAccessPreview -> ShowS
Prelude.Show, (forall x. CreateAccessPreview -> Rep CreateAccessPreview x)
-> (forall x. Rep CreateAccessPreview x -> CreateAccessPreview)
-> Generic CreateAccessPreview
forall x. Rep CreateAccessPreview x -> CreateAccessPreview
forall x. CreateAccessPreview -> Rep CreateAccessPreview x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAccessPreview x -> CreateAccessPreview
$cfrom :: forall x. CreateAccessPreview -> Rep CreateAccessPreview x
Prelude.Generic)
newCreateAccessPreview ::
Prelude.Text ->
CreateAccessPreview
newCreateAccessPreview :: Text -> CreateAccessPreview
newCreateAccessPreview Text
pAnalyzerArn_ =
CreateAccessPreview' :: Maybe Text
-> Text -> HashMap Text Configuration -> CreateAccessPreview
CreateAccessPreview'
{ $sel:clientToken:CreateAccessPreview' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:analyzerArn:CreateAccessPreview' :: Text
analyzerArn = Text
pAnalyzerArn_,
$sel:configurations:CreateAccessPreview' :: HashMap Text Configuration
configurations = HashMap Text Configuration
forall a. Monoid a => a
Prelude.mempty
}
createAccessPreview_clientToken :: Lens.Lens' CreateAccessPreview (Prelude.Maybe Prelude.Text)
createAccessPreview_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateAccessPreview -> f CreateAccessPreview
createAccessPreview_clientToken = (CreateAccessPreview -> Maybe Text)
-> (CreateAccessPreview -> Maybe Text -> CreateAccessPreview)
-> Lens
CreateAccessPreview CreateAccessPreview (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPreview' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateAccessPreview' :: CreateAccessPreview -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateAccessPreview
s@CreateAccessPreview' {} Maybe Text
a -> CreateAccessPreview
s {$sel:clientToken:CreateAccessPreview' :: Maybe Text
clientToken = Maybe Text
a} :: CreateAccessPreview)
createAccessPreview_analyzerArn :: Lens.Lens' CreateAccessPreview Prelude.Text
createAccessPreview_analyzerArn :: (Text -> f Text) -> CreateAccessPreview -> f CreateAccessPreview
createAccessPreview_analyzerArn = (CreateAccessPreview -> Text)
-> (CreateAccessPreview -> Text -> CreateAccessPreview)
-> Lens CreateAccessPreview CreateAccessPreview Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPreview' {Text
analyzerArn :: Text
$sel:analyzerArn:CreateAccessPreview' :: CreateAccessPreview -> Text
analyzerArn} -> Text
analyzerArn) (\s :: CreateAccessPreview
s@CreateAccessPreview' {} Text
a -> CreateAccessPreview
s {$sel:analyzerArn:CreateAccessPreview' :: Text
analyzerArn = Text
a} :: CreateAccessPreview)
createAccessPreview_configurations :: Lens.Lens' CreateAccessPreview (Prelude.HashMap Prelude.Text Configuration)
createAccessPreview_configurations :: (HashMap Text Configuration -> f (HashMap Text Configuration))
-> CreateAccessPreview -> f CreateAccessPreview
createAccessPreview_configurations = (CreateAccessPreview -> HashMap Text Configuration)
-> (CreateAccessPreview
-> HashMap Text Configuration -> CreateAccessPreview)
-> Lens
CreateAccessPreview
CreateAccessPreview
(HashMap Text Configuration)
(HashMap Text Configuration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPreview' {HashMap Text Configuration
configurations :: HashMap Text Configuration
$sel:configurations:CreateAccessPreview' :: CreateAccessPreview -> HashMap Text Configuration
configurations} -> HashMap Text Configuration
configurations) (\s :: CreateAccessPreview
s@CreateAccessPreview' {} HashMap Text Configuration
a -> CreateAccessPreview
s {$sel:configurations:CreateAccessPreview' :: HashMap Text Configuration
configurations = HashMap Text Configuration
a} :: CreateAccessPreview) ((HashMap Text Configuration -> f (HashMap Text Configuration))
-> CreateAccessPreview -> f CreateAccessPreview)
-> ((HashMap Text Configuration -> f (HashMap Text Configuration))
-> HashMap Text Configuration -> f (HashMap Text Configuration))
-> (HashMap Text Configuration -> f (HashMap Text Configuration))
-> CreateAccessPreview
-> f CreateAccessPreview
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Configuration -> f (HashMap Text Configuration))
-> HashMap Text Configuration -> f (HashMap Text Configuration)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateAccessPreview where
type
AWSResponse CreateAccessPreview =
CreateAccessPreviewResponse
request :: CreateAccessPreview -> Request CreateAccessPreview
request = Service -> CreateAccessPreview -> Request CreateAccessPreview
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateAccessPreview
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAccessPreview)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateAccessPreview))
-> Logger
-> Service
-> Proxy CreateAccessPreview
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateAccessPreview)))
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 -> Text -> CreateAccessPreviewResponse
CreateAccessPreviewResponse'
(Int -> Text -> CreateAccessPreviewResponse)
-> Either String Int
-> Either String (Text -> CreateAccessPreviewResponse)
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 (Text -> CreateAccessPreviewResponse)
-> Either String Text -> Either String CreateAccessPreviewResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"id")
)
instance Prelude.Hashable CreateAccessPreview
instance Prelude.NFData CreateAccessPreview
instance Core.ToHeaders CreateAccessPreview where
toHeaders :: CreateAccessPreview -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateAccessPreview -> 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.ToJSON CreateAccessPreview where
toJSON :: CreateAccessPreview -> Value
toJSON CreateAccessPreview' {Maybe Text
Text
HashMap Text Configuration
configurations :: HashMap Text Configuration
analyzerArn :: Text
clientToken :: Maybe Text
$sel:configurations:CreateAccessPreview' :: CreateAccessPreview -> HashMap Text Configuration
$sel:analyzerArn:CreateAccessPreview' :: CreateAccessPreview -> Text
$sel:clientToken:CreateAccessPreview' :: CreateAccessPreview -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"analyzerArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
analyzerArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"configurations" Text -> HashMap Text Configuration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text Configuration
configurations)
]
)
instance Core.ToPath CreateAccessPreview where
toPath :: CreateAccessPreview -> ByteString
toPath = ByteString -> CreateAccessPreview -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/access-preview"
instance Core.ToQuery CreateAccessPreview where
toQuery :: CreateAccessPreview -> QueryString
toQuery = QueryString -> CreateAccessPreview -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateAccessPreviewResponse = CreateAccessPreviewResponse'
{
CreateAccessPreviewResponse -> Int
httpStatus :: Prelude.Int,
CreateAccessPreviewResponse -> Text
id :: Prelude.Text
}
deriving (CreateAccessPreviewResponse -> CreateAccessPreviewResponse -> Bool
(CreateAccessPreviewResponse
-> CreateAccessPreviewResponse -> Bool)
-> (CreateAccessPreviewResponse
-> CreateAccessPreviewResponse -> Bool)
-> Eq CreateAccessPreviewResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccessPreviewResponse -> CreateAccessPreviewResponse -> Bool
$c/= :: CreateAccessPreviewResponse -> CreateAccessPreviewResponse -> Bool
== :: CreateAccessPreviewResponse -> CreateAccessPreviewResponse -> Bool
$c== :: CreateAccessPreviewResponse -> CreateAccessPreviewResponse -> Bool
Prelude.Eq, ReadPrec [CreateAccessPreviewResponse]
ReadPrec CreateAccessPreviewResponse
Int -> ReadS CreateAccessPreviewResponse
ReadS [CreateAccessPreviewResponse]
(Int -> ReadS CreateAccessPreviewResponse)
-> ReadS [CreateAccessPreviewResponse]
-> ReadPrec CreateAccessPreviewResponse
-> ReadPrec [CreateAccessPreviewResponse]
-> Read CreateAccessPreviewResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccessPreviewResponse]
$creadListPrec :: ReadPrec [CreateAccessPreviewResponse]
readPrec :: ReadPrec CreateAccessPreviewResponse
$creadPrec :: ReadPrec CreateAccessPreviewResponse
readList :: ReadS [CreateAccessPreviewResponse]
$creadList :: ReadS [CreateAccessPreviewResponse]
readsPrec :: Int -> ReadS CreateAccessPreviewResponse
$creadsPrec :: Int -> ReadS CreateAccessPreviewResponse
Prelude.Read, Int -> CreateAccessPreviewResponse -> ShowS
[CreateAccessPreviewResponse] -> ShowS
CreateAccessPreviewResponse -> String
(Int -> CreateAccessPreviewResponse -> ShowS)
-> (CreateAccessPreviewResponse -> String)
-> ([CreateAccessPreviewResponse] -> ShowS)
-> Show CreateAccessPreviewResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccessPreviewResponse] -> ShowS
$cshowList :: [CreateAccessPreviewResponse] -> ShowS
show :: CreateAccessPreviewResponse -> String
$cshow :: CreateAccessPreviewResponse -> String
showsPrec :: Int -> CreateAccessPreviewResponse -> ShowS
$cshowsPrec :: Int -> CreateAccessPreviewResponse -> ShowS
Prelude.Show, (forall x.
CreateAccessPreviewResponse -> Rep CreateAccessPreviewResponse x)
-> (forall x.
Rep CreateAccessPreviewResponse x -> CreateAccessPreviewResponse)
-> Generic CreateAccessPreviewResponse
forall x.
Rep CreateAccessPreviewResponse x -> CreateAccessPreviewResponse
forall x.
CreateAccessPreviewResponse -> Rep CreateAccessPreviewResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateAccessPreviewResponse x -> CreateAccessPreviewResponse
$cfrom :: forall x.
CreateAccessPreviewResponse -> Rep CreateAccessPreviewResponse x
Prelude.Generic)
newCreateAccessPreviewResponse ::
Prelude.Int ->
Prelude.Text ->
CreateAccessPreviewResponse
newCreateAccessPreviewResponse :: Int -> Text -> CreateAccessPreviewResponse
newCreateAccessPreviewResponse Int
pHttpStatus_ Text
pId_ =
CreateAccessPreviewResponse' :: Int -> Text -> CreateAccessPreviewResponse
CreateAccessPreviewResponse'
{ $sel:httpStatus:CreateAccessPreviewResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:id:CreateAccessPreviewResponse' :: Text
id = Text
pId_
}
createAccessPreviewResponse_httpStatus :: Lens.Lens' CreateAccessPreviewResponse Prelude.Int
createAccessPreviewResponse_httpStatus :: (Int -> f Int)
-> CreateAccessPreviewResponse -> f CreateAccessPreviewResponse
createAccessPreviewResponse_httpStatus = (CreateAccessPreviewResponse -> Int)
-> (CreateAccessPreviewResponse
-> Int -> CreateAccessPreviewResponse)
-> Lens
CreateAccessPreviewResponse CreateAccessPreviewResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPreviewResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateAccessPreviewResponse' :: CreateAccessPreviewResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateAccessPreviewResponse
s@CreateAccessPreviewResponse' {} Int
a -> CreateAccessPreviewResponse
s {$sel:httpStatus:CreateAccessPreviewResponse' :: Int
httpStatus = Int
a} :: CreateAccessPreviewResponse)
createAccessPreviewResponse_id :: Lens.Lens' CreateAccessPreviewResponse Prelude.Text
createAccessPreviewResponse_id :: (Text -> f Text)
-> CreateAccessPreviewResponse -> f CreateAccessPreviewResponse
createAccessPreviewResponse_id = (CreateAccessPreviewResponse -> Text)
-> (CreateAccessPreviewResponse
-> Text -> CreateAccessPreviewResponse)
-> Lens
CreateAccessPreviewResponse CreateAccessPreviewResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessPreviewResponse' {Text
id :: Text
$sel:id:CreateAccessPreviewResponse' :: CreateAccessPreviewResponse -> Text
id} -> Text
id) (\s :: CreateAccessPreviewResponse
s@CreateAccessPreviewResponse' {} Text
a -> CreateAccessPreviewResponse
s {$sel:id:CreateAccessPreviewResponse' :: Text
id = Text
a} :: CreateAccessPreviewResponse)
instance Prelude.NFData CreateAccessPreviewResponse