{-# 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.Signer.AddProfilePermission
(
AddProfilePermission (..),
newAddProfilePermission,
addProfilePermission_profileVersion,
addProfilePermission_revisionId,
addProfilePermission_action,
addProfilePermission_principal,
addProfilePermission_statementId,
addProfilePermission_profileName,
AddProfilePermissionResponse (..),
newAddProfilePermissionResponse,
addProfilePermissionResponse_revisionId,
addProfilePermissionResponse_httpStatus,
)
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.Signer.Types
data AddProfilePermission = AddProfilePermission'
{
AddProfilePermission -> Maybe Text
profileVersion :: Prelude.Maybe Prelude.Text,
AddProfilePermission -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
AddProfilePermission -> Text
action :: Prelude.Text,
AddProfilePermission -> Text
principal :: Prelude.Text,
AddProfilePermission -> Text
statementId :: Prelude.Text,
AddProfilePermission -> Text
profileName :: Prelude.Text
}
deriving (AddProfilePermission -> AddProfilePermission -> Bool
(AddProfilePermission -> AddProfilePermission -> Bool)
-> (AddProfilePermission -> AddProfilePermission -> Bool)
-> Eq AddProfilePermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddProfilePermission -> AddProfilePermission -> Bool
$c/= :: AddProfilePermission -> AddProfilePermission -> Bool
== :: AddProfilePermission -> AddProfilePermission -> Bool
$c== :: AddProfilePermission -> AddProfilePermission -> Bool
Prelude.Eq, ReadPrec [AddProfilePermission]
ReadPrec AddProfilePermission
Int -> ReadS AddProfilePermission
ReadS [AddProfilePermission]
(Int -> ReadS AddProfilePermission)
-> ReadS [AddProfilePermission]
-> ReadPrec AddProfilePermission
-> ReadPrec [AddProfilePermission]
-> Read AddProfilePermission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddProfilePermission]
$creadListPrec :: ReadPrec [AddProfilePermission]
readPrec :: ReadPrec AddProfilePermission
$creadPrec :: ReadPrec AddProfilePermission
readList :: ReadS [AddProfilePermission]
$creadList :: ReadS [AddProfilePermission]
readsPrec :: Int -> ReadS AddProfilePermission
$creadsPrec :: Int -> ReadS AddProfilePermission
Prelude.Read, Int -> AddProfilePermission -> ShowS
[AddProfilePermission] -> ShowS
AddProfilePermission -> String
(Int -> AddProfilePermission -> ShowS)
-> (AddProfilePermission -> String)
-> ([AddProfilePermission] -> ShowS)
-> Show AddProfilePermission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddProfilePermission] -> ShowS
$cshowList :: [AddProfilePermission] -> ShowS
show :: AddProfilePermission -> String
$cshow :: AddProfilePermission -> String
showsPrec :: Int -> AddProfilePermission -> ShowS
$cshowsPrec :: Int -> AddProfilePermission -> ShowS
Prelude.Show, (forall x. AddProfilePermission -> Rep AddProfilePermission x)
-> (forall x. Rep AddProfilePermission x -> AddProfilePermission)
-> Generic AddProfilePermission
forall x. Rep AddProfilePermission x -> AddProfilePermission
forall x. AddProfilePermission -> Rep AddProfilePermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddProfilePermission x -> AddProfilePermission
$cfrom :: forall x. AddProfilePermission -> Rep AddProfilePermission x
Prelude.Generic)
newAddProfilePermission ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
AddProfilePermission
newAddProfilePermission :: Text -> Text -> Text -> Text -> AddProfilePermission
newAddProfilePermission
Text
pAction_
Text
pPrincipal_
Text
pStatementId_
Text
pProfileName_ =
AddProfilePermission' :: Maybe Text
-> Maybe Text
-> Text
-> Text
-> Text
-> Text
-> AddProfilePermission
AddProfilePermission'
{ $sel:profileVersion:AddProfilePermission' :: Maybe Text
profileVersion =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:revisionId:AddProfilePermission' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:action:AddProfilePermission' :: Text
action = Text
pAction_,
$sel:principal:AddProfilePermission' :: Text
principal = Text
pPrincipal_,
$sel:statementId:AddProfilePermission' :: Text
statementId = Text
pStatementId_,
$sel:profileName:AddProfilePermission' :: Text
profileName = Text
pProfileName_
}
addProfilePermission_profileVersion :: Lens.Lens' AddProfilePermission (Prelude.Maybe Prelude.Text)
addProfilePermission_profileVersion :: (Maybe Text -> f (Maybe Text))
-> AddProfilePermission -> f AddProfilePermission
addProfilePermission_profileVersion = (AddProfilePermission -> Maybe Text)
-> (AddProfilePermission -> Maybe Text -> AddProfilePermission)
-> Lens
AddProfilePermission AddProfilePermission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfilePermission' {Maybe Text
profileVersion :: Maybe Text
$sel:profileVersion:AddProfilePermission' :: AddProfilePermission -> Maybe Text
profileVersion} -> Maybe Text
profileVersion) (\s :: AddProfilePermission
s@AddProfilePermission' {} Maybe Text
a -> AddProfilePermission
s {$sel:profileVersion:AddProfilePermission' :: Maybe Text
profileVersion = Maybe Text
a} :: AddProfilePermission)
addProfilePermission_revisionId :: Lens.Lens' AddProfilePermission (Prelude.Maybe Prelude.Text)
addProfilePermission_revisionId :: (Maybe Text -> f (Maybe Text))
-> AddProfilePermission -> f AddProfilePermission
addProfilePermission_revisionId = (AddProfilePermission -> Maybe Text)
-> (AddProfilePermission -> Maybe Text -> AddProfilePermission)
-> Lens
AddProfilePermission AddProfilePermission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfilePermission' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:AddProfilePermission' :: AddProfilePermission -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: AddProfilePermission
s@AddProfilePermission' {} Maybe Text
a -> AddProfilePermission
s {$sel:revisionId:AddProfilePermission' :: Maybe Text
revisionId = Maybe Text
a} :: AddProfilePermission)
addProfilePermission_action :: Lens.Lens' AddProfilePermission Prelude.Text
addProfilePermission_action :: (Text -> f Text) -> AddProfilePermission -> f AddProfilePermission
addProfilePermission_action = (AddProfilePermission -> Text)
-> (AddProfilePermission -> Text -> AddProfilePermission)
-> Lens AddProfilePermission AddProfilePermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfilePermission' {Text
action :: Text
$sel:action:AddProfilePermission' :: AddProfilePermission -> Text
action} -> Text
action) (\s :: AddProfilePermission
s@AddProfilePermission' {} Text
a -> AddProfilePermission
s {$sel:action:AddProfilePermission' :: Text
action = Text
a} :: AddProfilePermission)
addProfilePermission_principal :: Lens.Lens' AddProfilePermission Prelude.Text
addProfilePermission_principal :: (Text -> f Text) -> AddProfilePermission -> f AddProfilePermission
addProfilePermission_principal = (AddProfilePermission -> Text)
-> (AddProfilePermission -> Text -> AddProfilePermission)
-> Lens AddProfilePermission AddProfilePermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfilePermission' {Text
principal :: Text
$sel:principal:AddProfilePermission' :: AddProfilePermission -> Text
principal} -> Text
principal) (\s :: AddProfilePermission
s@AddProfilePermission' {} Text
a -> AddProfilePermission
s {$sel:principal:AddProfilePermission' :: Text
principal = Text
a} :: AddProfilePermission)
addProfilePermission_statementId :: Lens.Lens' AddProfilePermission Prelude.Text
addProfilePermission_statementId :: (Text -> f Text) -> AddProfilePermission -> f AddProfilePermission
addProfilePermission_statementId = (AddProfilePermission -> Text)
-> (AddProfilePermission -> Text -> AddProfilePermission)
-> Lens AddProfilePermission AddProfilePermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfilePermission' {Text
statementId :: Text
$sel:statementId:AddProfilePermission' :: AddProfilePermission -> Text
statementId} -> Text
statementId) (\s :: AddProfilePermission
s@AddProfilePermission' {} Text
a -> AddProfilePermission
s {$sel:statementId:AddProfilePermission' :: Text
statementId = Text
a} :: AddProfilePermission)
addProfilePermission_profileName :: Lens.Lens' AddProfilePermission Prelude.Text
addProfilePermission_profileName :: (Text -> f Text) -> AddProfilePermission -> f AddProfilePermission
addProfilePermission_profileName = (AddProfilePermission -> Text)
-> (AddProfilePermission -> Text -> AddProfilePermission)
-> Lens AddProfilePermission AddProfilePermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfilePermission' {Text
profileName :: Text
$sel:profileName:AddProfilePermission' :: AddProfilePermission -> Text
profileName} -> Text
profileName) (\s :: AddProfilePermission
s@AddProfilePermission' {} Text
a -> AddProfilePermission
s {$sel:profileName:AddProfilePermission' :: Text
profileName = Text
a} :: AddProfilePermission)
instance Core.AWSRequest AddProfilePermission where
type
AWSResponse AddProfilePermission =
AddProfilePermissionResponse
request :: AddProfilePermission -> Request AddProfilePermission
request = Service -> AddProfilePermission -> Request AddProfilePermission
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddProfilePermission
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddProfilePermission)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddProfilePermission))
-> Logger
-> Service
-> Proxy AddProfilePermission
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddProfilePermission)))
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 Text -> Int -> AddProfilePermissionResponse
AddProfilePermissionResponse'
(Maybe Text -> Int -> AddProfilePermissionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AddProfilePermissionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"revisionId")
Either String (Int -> AddProfilePermissionResponse)
-> Either String Int -> Either String AddProfilePermissionResponse
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 AddProfilePermission
instance Prelude.NFData AddProfilePermission
instance Core.ToHeaders AddProfilePermission where
toHeaders :: AddProfilePermission -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddProfilePermission -> 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 AddProfilePermission where
toJSON :: AddProfilePermission -> Value
toJSON AddProfilePermission' {Maybe Text
Text
profileName :: Text
statementId :: Text
principal :: Text
action :: Text
revisionId :: Maybe Text
profileVersion :: Maybe Text
$sel:profileName:AddProfilePermission' :: AddProfilePermission -> Text
$sel:statementId:AddProfilePermission' :: AddProfilePermission -> Text
$sel:principal:AddProfilePermission' :: AddProfilePermission -> Text
$sel:action:AddProfilePermission' :: AddProfilePermission -> Text
$sel:revisionId:AddProfilePermission' :: AddProfilePermission -> Maybe Text
$sel:profileVersion:AddProfilePermission' :: AddProfilePermission -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"profileVersion" 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
profileVersion,
(Text
"revisionId" 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
revisionId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"action" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
action),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"principal" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
principal),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"statementId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
statementId)
]
)
instance Core.ToPath AddProfilePermission where
toPath :: AddProfilePermission -> ByteString
toPath AddProfilePermission' {Maybe Text
Text
profileName :: Text
statementId :: Text
principal :: Text
action :: Text
revisionId :: Maybe Text
profileVersion :: Maybe Text
$sel:profileName:AddProfilePermission' :: AddProfilePermission -> Text
$sel:statementId:AddProfilePermission' :: AddProfilePermission -> Text
$sel:principal:AddProfilePermission' :: AddProfilePermission -> Text
$sel:action:AddProfilePermission' :: AddProfilePermission -> Text
$sel:revisionId:AddProfilePermission' :: AddProfilePermission -> Maybe Text
$sel:profileVersion:AddProfilePermission' :: AddProfilePermission -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/signing-profiles/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
profileName,
ByteString
"/permissions"
]
instance Core.ToQuery AddProfilePermission where
toQuery :: AddProfilePermission -> QueryString
toQuery = QueryString -> AddProfilePermission -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddProfilePermissionResponse = AddProfilePermissionResponse'
{
AddProfilePermissionResponse -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
AddProfilePermissionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddProfilePermissionResponse
-> AddProfilePermissionResponse -> Bool
(AddProfilePermissionResponse
-> AddProfilePermissionResponse -> Bool)
-> (AddProfilePermissionResponse
-> AddProfilePermissionResponse -> Bool)
-> Eq AddProfilePermissionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddProfilePermissionResponse
-> AddProfilePermissionResponse -> Bool
$c/= :: AddProfilePermissionResponse
-> AddProfilePermissionResponse -> Bool
== :: AddProfilePermissionResponse
-> AddProfilePermissionResponse -> Bool
$c== :: AddProfilePermissionResponse
-> AddProfilePermissionResponse -> Bool
Prelude.Eq, ReadPrec [AddProfilePermissionResponse]
ReadPrec AddProfilePermissionResponse
Int -> ReadS AddProfilePermissionResponse
ReadS [AddProfilePermissionResponse]
(Int -> ReadS AddProfilePermissionResponse)
-> ReadS [AddProfilePermissionResponse]
-> ReadPrec AddProfilePermissionResponse
-> ReadPrec [AddProfilePermissionResponse]
-> Read AddProfilePermissionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddProfilePermissionResponse]
$creadListPrec :: ReadPrec [AddProfilePermissionResponse]
readPrec :: ReadPrec AddProfilePermissionResponse
$creadPrec :: ReadPrec AddProfilePermissionResponse
readList :: ReadS [AddProfilePermissionResponse]
$creadList :: ReadS [AddProfilePermissionResponse]
readsPrec :: Int -> ReadS AddProfilePermissionResponse
$creadsPrec :: Int -> ReadS AddProfilePermissionResponse
Prelude.Read, Int -> AddProfilePermissionResponse -> ShowS
[AddProfilePermissionResponse] -> ShowS
AddProfilePermissionResponse -> String
(Int -> AddProfilePermissionResponse -> ShowS)
-> (AddProfilePermissionResponse -> String)
-> ([AddProfilePermissionResponse] -> ShowS)
-> Show AddProfilePermissionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddProfilePermissionResponse] -> ShowS
$cshowList :: [AddProfilePermissionResponse] -> ShowS
show :: AddProfilePermissionResponse -> String
$cshow :: AddProfilePermissionResponse -> String
showsPrec :: Int -> AddProfilePermissionResponse -> ShowS
$cshowsPrec :: Int -> AddProfilePermissionResponse -> ShowS
Prelude.Show, (forall x.
AddProfilePermissionResponse -> Rep AddProfilePermissionResponse x)
-> (forall x.
Rep AddProfilePermissionResponse x -> AddProfilePermissionResponse)
-> Generic AddProfilePermissionResponse
forall x.
Rep AddProfilePermissionResponse x -> AddProfilePermissionResponse
forall x.
AddProfilePermissionResponse -> Rep AddProfilePermissionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddProfilePermissionResponse x -> AddProfilePermissionResponse
$cfrom :: forall x.
AddProfilePermissionResponse -> Rep AddProfilePermissionResponse x
Prelude.Generic)
newAddProfilePermissionResponse ::
Prelude.Int ->
AddProfilePermissionResponse
newAddProfilePermissionResponse :: Int -> AddProfilePermissionResponse
newAddProfilePermissionResponse Int
pHttpStatus_ =
AddProfilePermissionResponse' :: Maybe Text -> Int -> AddProfilePermissionResponse
AddProfilePermissionResponse'
{ $sel:revisionId:AddProfilePermissionResponse' :: Maybe Text
revisionId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddProfilePermissionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addProfilePermissionResponse_revisionId :: Lens.Lens' AddProfilePermissionResponse (Prelude.Maybe Prelude.Text)
addProfilePermissionResponse_revisionId :: (Maybe Text -> f (Maybe Text))
-> AddProfilePermissionResponse -> f AddProfilePermissionResponse
addProfilePermissionResponse_revisionId = (AddProfilePermissionResponse -> Maybe Text)
-> (AddProfilePermissionResponse
-> Maybe Text -> AddProfilePermissionResponse)
-> Lens
AddProfilePermissionResponse
AddProfilePermissionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfilePermissionResponse' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:AddProfilePermissionResponse' :: AddProfilePermissionResponse -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: AddProfilePermissionResponse
s@AddProfilePermissionResponse' {} Maybe Text
a -> AddProfilePermissionResponse
s {$sel:revisionId:AddProfilePermissionResponse' :: Maybe Text
revisionId = Maybe Text
a} :: AddProfilePermissionResponse)
addProfilePermissionResponse_httpStatus :: Lens.Lens' AddProfilePermissionResponse Prelude.Int
addProfilePermissionResponse_httpStatus :: (Int -> f Int)
-> AddProfilePermissionResponse -> f AddProfilePermissionResponse
addProfilePermissionResponse_httpStatus = (AddProfilePermissionResponse -> Int)
-> (AddProfilePermissionResponse
-> Int -> AddProfilePermissionResponse)
-> Lens
AddProfilePermissionResponse AddProfilePermissionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddProfilePermissionResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddProfilePermissionResponse' :: AddProfilePermissionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddProfilePermissionResponse
s@AddProfilePermissionResponse' {} Int
a -> AddProfilePermissionResponse
s {$sel:httpStatus:AddProfilePermissionResponse' :: Int
httpStatus = Int
a} :: AddProfilePermissionResponse)
instance Prelude.NFData AddProfilePermissionResponse