{-# 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.StartPolicyGeneration
(
StartPolicyGeneration (..),
newStartPolicyGeneration,
startPolicyGeneration_clientToken,
startPolicyGeneration_cloudTrailDetails,
startPolicyGeneration_policyGenerationDetails,
StartPolicyGenerationResponse (..),
newStartPolicyGenerationResponse,
startPolicyGenerationResponse_httpStatus,
startPolicyGenerationResponse_jobId,
)
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 StartPolicyGeneration = StartPolicyGeneration'
{
StartPolicyGeneration -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
StartPolicyGeneration -> Maybe CloudTrailDetails
cloudTrailDetails :: Prelude.Maybe CloudTrailDetails,
StartPolicyGeneration -> PolicyGenerationDetails
policyGenerationDetails :: PolicyGenerationDetails
}
deriving (StartPolicyGeneration -> StartPolicyGeneration -> Bool
(StartPolicyGeneration -> StartPolicyGeneration -> Bool)
-> (StartPolicyGeneration -> StartPolicyGeneration -> Bool)
-> Eq StartPolicyGeneration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartPolicyGeneration -> StartPolicyGeneration -> Bool
$c/= :: StartPolicyGeneration -> StartPolicyGeneration -> Bool
== :: StartPolicyGeneration -> StartPolicyGeneration -> Bool
$c== :: StartPolicyGeneration -> StartPolicyGeneration -> Bool
Prelude.Eq, ReadPrec [StartPolicyGeneration]
ReadPrec StartPolicyGeneration
Int -> ReadS StartPolicyGeneration
ReadS [StartPolicyGeneration]
(Int -> ReadS StartPolicyGeneration)
-> ReadS [StartPolicyGeneration]
-> ReadPrec StartPolicyGeneration
-> ReadPrec [StartPolicyGeneration]
-> Read StartPolicyGeneration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartPolicyGeneration]
$creadListPrec :: ReadPrec [StartPolicyGeneration]
readPrec :: ReadPrec StartPolicyGeneration
$creadPrec :: ReadPrec StartPolicyGeneration
readList :: ReadS [StartPolicyGeneration]
$creadList :: ReadS [StartPolicyGeneration]
readsPrec :: Int -> ReadS StartPolicyGeneration
$creadsPrec :: Int -> ReadS StartPolicyGeneration
Prelude.Read, Int -> StartPolicyGeneration -> ShowS
[StartPolicyGeneration] -> ShowS
StartPolicyGeneration -> String
(Int -> StartPolicyGeneration -> ShowS)
-> (StartPolicyGeneration -> String)
-> ([StartPolicyGeneration] -> ShowS)
-> Show StartPolicyGeneration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartPolicyGeneration] -> ShowS
$cshowList :: [StartPolicyGeneration] -> ShowS
show :: StartPolicyGeneration -> String
$cshow :: StartPolicyGeneration -> String
showsPrec :: Int -> StartPolicyGeneration -> ShowS
$cshowsPrec :: Int -> StartPolicyGeneration -> ShowS
Prelude.Show, (forall x. StartPolicyGeneration -> Rep StartPolicyGeneration x)
-> (forall x. Rep StartPolicyGeneration x -> StartPolicyGeneration)
-> Generic StartPolicyGeneration
forall x. Rep StartPolicyGeneration x -> StartPolicyGeneration
forall x. StartPolicyGeneration -> Rep StartPolicyGeneration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartPolicyGeneration x -> StartPolicyGeneration
$cfrom :: forall x. StartPolicyGeneration -> Rep StartPolicyGeneration x
Prelude.Generic)
newStartPolicyGeneration ::
PolicyGenerationDetails ->
StartPolicyGeneration
newStartPolicyGeneration :: PolicyGenerationDetails -> StartPolicyGeneration
newStartPolicyGeneration PolicyGenerationDetails
pPolicyGenerationDetails_ =
StartPolicyGeneration' :: Maybe Text
-> Maybe CloudTrailDetails
-> PolicyGenerationDetails
-> StartPolicyGeneration
StartPolicyGeneration'
{ $sel:clientToken:StartPolicyGeneration' :: Maybe Text
clientToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:cloudTrailDetails:StartPolicyGeneration' :: Maybe CloudTrailDetails
cloudTrailDetails = Maybe CloudTrailDetails
forall a. Maybe a
Prelude.Nothing,
$sel:policyGenerationDetails:StartPolicyGeneration' :: PolicyGenerationDetails
policyGenerationDetails = PolicyGenerationDetails
pPolicyGenerationDetails_
}
startPolicyGeneration_clientToken :: Lens.Lens' StartPolicyGeneration (Prelude.Maybe Prelude.Text)
startPolicyGeneration_clientToken :: (Maybe Text -> f (Maybe Text))
-> StartPolicyGeneration -> f StartPolicyGeneration
startPolicyGeneration_clientToken = (StartPolicyGeneration -> Maybe Text)
-> (StartPolicyGeneration -> Maybe Text -> StartPolicyGeneration)
-> Lens
StartPolicyGeneration
StartPolicyGeneration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartPolicyGeneration' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:StartPolicyGeneration' :: StartPolicyGeneration -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: StartPolicyGeneration
s@StartPolicyGeneration' {} Maybe Text
a -> StartPolicyGeneration
s {$sel:clientToken:StartPolicyGeneration' :: Maybe Text
clientToken = Maybe Text
a} :: StartPolicyGeneration)
startPolicyGeneration_cloudTrailDetails :: Lens.Lens' StartPolicyGeneration (Prelude.Maybe CloudTrailDetails)
startPolicyGeneration_cloudTrailDetails :: (Maybe CloudTrailDetails -> f (Maybe CloudTrailDetails))
-> StartPolicyGeneration -> f StartPolicyGeneration
startPolicyGeneration_cloudTrailDetails = (StartPolicyGeneration -> Maybe CloudTrailDetails)
-> (StartPolicyGeneration
-> Maybe CloudTrailDetails -> StartPolicyGeneration)
-> Lens
StartPolicyGeneration
StartPolicyGeneration
(Maybe CloudTrailDetails)
(Maybe CloudTrailDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartPolicyGeneration' {Maybe CloudTrailDetails
cloudTrailDetails :: Maybe CloudTrailDetails
$sel:cloudTrailDetails:StartPolicyGeneration' :: StartPolicyGeneration -> Maybe CloudTrailDetails
cloudTrailDetails} -> Maybe CloudTrailDetails
cloudTrailDetails) (\s :: StartPolicyGeneration
s@StartPolicyGeneration' {} Maybe CloudTrailDetails
a -> StartPolicyGeneration
s {$sel:cloudTrailDetails:StartPolicyGeneration' :: Maybe CloudTrailDetails
cloudTrailDetails = Maybe CloudTrailDetails
a} :: StartPolicyGeneration)
startPolicyGeneration_policyGenerationDetails :: Lens.Lens' StartPolicyGeneration PolicyGenerationDetails
startPolicyGeneration_policyGenerationDetails :: (PolicyGenerationDetails -> f PolicyGenerationDetails)
-> StartPolicyGeneration -> f StartPolicyGeneration
startPolicyGeneration_policyGenerationDetails = (StartPolicyGeneration -> PolicyGenerationDetails)
-> (StartPolicyGeneration
-> PolicyGenerationDetails -> StartPolicyGeneration)
-> Lens
StartPolicyGeneration
StartPolicyGeneration
PolicyGenerationDetails
PolicyGenerationDetails
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartPolicyGeneration' {PolicyGenerationDetails
policyGenerationDetails :: PolicyGenerationDetails
$sel:policyGenerationDetails:StartPolicyGeneration' :: StartPolicyGeneration -> PolicyGenerationDetails
policyGenerationDetails} -> PolicyGenerationDetails
policyGenerationDetails) (\s :: StartPolicyGeneration
s@StartPolicyGeneration' {} PolicyGenerationDetails
a -> StartPolicyGeneration
s {$sel:policyGenerationDetails:StartPolicyGeneration' :: PolicyGenerationDetails
policyGenerationDetails = PolicyGenerationDetails
a} :: StartPolicyGeneration)
instance Core.AWSRequest StartPolicyGeneration where
type
AWSResponse StartPolicyGeneration =
StartPolicyGenerationResponse
request :: StartPolicyGeneration -> Request StartPolicyGeneration
request = Service -> StartPolicyGeneration -> Request StartPolicyGeneration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartPolicyGeneration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartPolicyGeneration)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartPolicyGeneration))
-> Logger
-> Service
-> Proxy StartPolicyGeneration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartPolicyGeneration)))
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 -> StartPolicyGenerationResponse
StartPolicyGenerationResponse'
(Int -> Text -> StartPolicyGenerationResponse)
-> Either String Int
-> Either String (Text -> StartPolicyGenerationResponse)
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 -> StartPolicyGenerationResponse)
-> Either String Text
-> Either String StartPolicyGenerationResponse
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
"jobId")
)
instance Prelude.Hashable StartPolicyGeneration
instance Prelude.NFData StartPolicyGeneration
instance Core.ToHeaders StartPolicyGeneration where
toHeaders :: StartPolicyGeneration -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartPolicyGeneration -> 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 StartPolicyGeneration where
toJSON :: StartPolicyGeneration -> Value
toJSON StartPolicyGeneration' {Maybe Text
Maybe CloudTrailDetails
PolicyGenerationDetails
policyGenerationDetails :: PolicyGenerationDetails
cloudTrailDetails :: Maybe CloudTrailDetails
clientToken :: Maybe Text
$sel:policyGenerationDetails:StartPolicyGeneration' :: StartPolicyGeneration -> PolicyGenerationDetails
$sel:cloudTrailDetails:StartPolicyGeneration' :: StartPolicyGeneration -> Maybe CloudTrailDetails
$sel:clientToken:StartPolicyGeneration' :: StartPolicyGeneration -> 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,
(Text
"cloudTrailDetails" Text -> CloudTrailDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(CloudTrailDetails -> Pair)
-> Maybe CloudTrailDetails -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CloudTrailDetails
cloudTrailDetails,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"policyGenerationDetails"
Text -> PolicyGenerationDetails -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PolicyGenerationDetails
policyGenerationDetails
)
]
)
instance Core.ToPath StartPolicyGeneration where
toPath :: StartPolicyGeneration -> ByteString
toPath = ByteString -> StartPolicyGeneration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/policy/generation"
instance Core.ToQuery StartPolicyGeneration where
toQuery :: StartPolicyGeneration -> QueryString
toQuery = QueryString -> StartPolicyGeneration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartPolicyGenerationResponse = StartPolicyGenerationResponse'
{
StartPolicyGenerationResponse -> Int
httpStatus :: Prelude.Int,
StartPolicyGenerationResponse -> Text
jobId :: Prelude.Text
}
deriving (StartPolicyGenerationResponse
-> StartPolicyGenerationResponse -> Bool
(StartPolicyGenerationResponse
-> StartPolicyGenerationResponse -> Bool)
-> (StartPolicyGenerationResponse
-> StartPolicyGenerationResponse -> Bool)
-> Eq StartPolicyGenerationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartPolicyGenerationResponse
-> StartPolicyGenerationResponse -> Bool
$c/= :: StartPolicyGenerationResponse
-> StartPolicyGenerationResponse -> Bool
== :: StartPolicyGenerationResponse
-> StartPolicyGenerationResponse -> Bool
$c== :: StartPolicyGenerationResponse
-> StartPolicyGenerationResponse -> Bool
Prelude.Eq, ReadPrec [StartPolicyGenerationResponse]
ReadPrec StartPolicyGenerationResponse
Int -> ReadS StartPolicyGenerationResponse
ReadS [StartPolicyGenerationResponse]
(Int -> ReadS StartPolicyGenerationResponse)
-> ReadS [StartPolicyGenerationResponse]
-> ReadPrec StartPolicyGenerationResponse
-> ReadPrec [StartPolicyGenerationResponse]
-> Read StartPolicyGenerationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartPolicyGenerationResponse]
$creadListPrec :: ReadPrec [StartPolicyGenerationResponse]
readPrec :: ReadPrec StartPolicyGenerationResponse
$creadPrec :: ReadPrec StartPolicyGenerationResponse
readList :: ReadS [StartPolicyGenerationResponse]
$creadList :: ReadS [StartPolicyGenerationResponse]
readsPrec :: Int -> ReadS StartPolicyGenerationResponse
$creadsPrec :: Int -> ReadS StartPolicyGenerationResponse
Prelude.Read, Int -> StartPolicyGenerationResponse -> ShowS
[StartPolicyGenerationResponse] -> ShowS
StartPolicyGenerationResponse -> String
(Int -> StartPolicyGenerationResponse -> ShowS)
-> (StartPolicyGenerationResponse -> String)
-> ([StartPolicyGenerationResponse] -> ShowS)
-> Show StartPolicyGenerationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartPolicyGenerationResponse] -> ShowS
$cshowList :: [StartPolicyGenerationResponse] -> ShowS
show :: StartPolicyGenerationResponse -> String
$cshow :: StartPolicyGenerationResponse -> String
showsPrec :: Int -> StartPolicyGenerationResponse -> ShowS
$cshowsPrec :: Int -> StartPolicyGenerationResponse -> ShowS
Prelude.Show, (forall x.
StartPolicyGenerationResponse
-> Rep StartPolicyGenerationResponse x)
-> (forall x.
Rep StartPolicyGenerationResponse x
-> StartPolicyGenerationResponse)
-> Generic StartPolicyGenerationResponse
forall x.
Rep StartPolicyGenerationResponse x
-> StartPolicyGenerationResponse
forall x.
StartPolicyGenerationResponse
-> Rep StartPolicyGenerationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartPolicyGenerationResponse x
-> StartPolicyGenerationResponse
$cfrom :: forall x.
StartPolicyGenerationResponse
-> Rep StartPolicyGenerationResponse x
Prelude.Generic)
newStartPolicyGenerationResponse ::
Prelude.Int ->
Prelude.Text ->
StartPolicyGenerationResponse
newStartPolicyGenerationResponse :: Int -> Text -> StartPolicyGenerationResponse
newStartPolicyGenerationResponse Int
pHttpStatus_ Text
pJobId_ =
StartPolicyGenerationResponse' :: Int -> Text -> StartPolicyGenerationResponse
StartPolicyGenerationResponse'
{ $sel:httpStatus:StartPolicyGenerationResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:jobId:StartPolicyGenerationResponse' :: Text
jobId = Text
pJobId_
}
startPolicyGenerationResponse_httpStatus :: Lens.Lens' StartPolicyGenerationResponse Prelude.Int
startPolicyGenerationResponse_httpStatus :: (Int -> f Int)
-> StartPolicyGenerationResponse -> f StartPolicyGenerationResponse
startPolicyGenerationResponse_httpStatus = (StartPolicyGenerationResponse -> Int)
-> (StartPolicyGenerationResponse
-> Int -> StartPolicyGenerationResponse)
-> Lens
StartPolicyGenerationResponse StartPolicyGenerationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartPolicyGenerationResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartPolicyGenerationResponse' :: StartPolicyGenerationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartPolicyGenerationResponse
s@StartPolicyGenerationResponse' {} Int
a -> StartPolicyGenerationResponse
s {$sel:httpStatus:StartPolicyGenerationResponse' :: Int
httpStatus = Int
a} :: StartPolicyGenerationResponse)
startPolicyGenerationResponse_jobId :: Lens.Lens' StartPolicyGenerationResponse Prelude.Text
startPolicyGenerationResponse_jobId :: (Text -> f Text)
-> StartPolicyGenerationResponse -> f StartPolicyGenerationResponse
startPolicyGenerationResponse_jobId = (StartPolicyGenerationResponse -> Text)
-> (StartPolicyGenerationResponse
-> Text -> StartPolicyGenerationResponse)
-> Lens
StartPolicyGenerationResponse
StartPolicyGenerationResponse
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartPolicyGenerationResponse' {Text
jobId :: Text
$sel:jobId:StartPolicyGenerationResponse' :: StartPolicyGenerationResponse -> Text
jobId} -> Text
jobId) (\s :: StartPolicyGenerationResponse
s@StartPolicyGenerationResponse' {} Text
a -> StartPolicyGenerationResponse
s {$sel:jobId:StartPolicyGenerationResponse' :: Text
jobId = Text
a} :: StartPolicyGenerationResponse)
instance Prelude.NFData StartPolicyGenerationResponse