{-# 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.CodeGuruProfiler.PutPermission
(
PutPermission (..),
newPutPermission,
putPermission_revisionId,
putPermission_actionGroup,
putPermission_principals,
putPermission_profilingGroupName,
PutPermissionResponse (..),
newPutPermissionResponse,
putPermissionResponse_httpStatus,
putPermissionResponse_policy,
putPermissionResponse_revisionId,
)
where
import Amazonka.CodeGuruProfiler.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 PutPermission = PutPermission'
{
PutPermission -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
PutPermission -> ActionGroup
actionGroup :: ActionGroup,
PutPermission -> NonEmpty Text
principals :: Prelude.NonEmpty Prelude.Text,
PutPermission -> Text
profilingGroupName :: Prelude.Text
}
deriving (PutPermission -> PutPermission -> Bool
(PutPermission -> PutPermission -> Bool)
-> (PutPermission -> PutPermission -> Bool) -> Eq PutPermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPermission -> PutPermission -> Bool
$c/= :: PutPermission -> PutPermission -> Bool
== :: PutPermission -> PutPermission -> Bool
$c== :: PutPermission -> PutPermission -> Bool
Prelude.Eq, ReadPrec [PutPermission]
ReadPrec PutPermission
Int -> ReadS PutPermission
ReadS [PutPermission]
(Int -> ReadS PutPermission)
-> ReadS [PutPermission]
-> ReadPrec PutPermission
-> ReadPrec [PutPermission]
-> Read PutPermission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPermission]
$creadListPrec :: ReadPrec [PutPermission]
readPrec :: ReadPrec PutPermission
$creadPrec :: ReadPrec PutPermission
readList :: ReadS [PutPermission]
$creadList :: ReadS [PutPermission]
readsPrec :: Int -> ReadS PutPermission
$creadsPrec :: Int -> ReadS PutPermission
Prelude.Read, Int -> PutPermission -> ShowS
[PutPermission] -> ShowS
PutPermission -> String
(Int -> PutPermission -> ShowS)
-> (PutPermission -> String)
-> ([PutPermission] -> ShowS)
-> Show PutPermission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPermission] -> ShowS
$cshowList :: [PutPermission] -> ShowS
show :: PutPermission -> String
$cshow :: PutPermission -> String
showsPrec :: Int -> PutPermission -> ShowS
$cshowsPrec :: Int -> PutPermission -> ShowS
Prelude.Show, (forall x. PutPermission -> Rep PutPermission x)
-> (forall x. Rep PutPermission x -> PutPermission)
-> Generic PutPermission
forall x. Rep PutPermission x -> PutPermission
forall x. PutPermission -> Rep PutPermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutPermission x -> PutPermission
$cfrom :: forall x. PutPermission -> Rep PutPermission x
Prelude.Generic)
newPutPermission ::
ActionGroup ->
Prelude.NonEmpty Prelude.Text ->
Prelude.Text ->
PutPermission
newPutPermission :: ActionGroup -> NonEmpty Text -> Text -> PutPermission
newPutPermission
ActionGroup
pActionGroup_
NonEmpty Text
pPrincipals_
Text
pProfilingGroupName_ =
PutPermission' :: Maybe Text -> ActionGroup -> NonEmpty Text -> Text -> PutPermission
PutPermission'
{ $sel:revisionId:PutPermission' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:actionGroup:PutPermission' :: ActionGroup
actionGroup = ActionGroup
pActionGroup_,
$sel:principals:PutPermission' :: NonEmpty Text
principals = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pPrincipals_,
$sel:profilingGroupName:PutPermission' :: Text
profilingGroupName = Text
pProfilingGroupName_
}
putPermission_revisionId :: Lens.Lens' PutPermission (Prelude.Maybe Prelude.Text)
putPermission_revisionId :: (Maybe Text -> f (Maybe Text)) -> PutPermission -> f PutPermission
putPermission_revisionId = (PutPermission -> Maybe Text)
-> (PutPermission -> Maybe Text -> PutPermission)
-> Lens PutPermission PutPermission (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:PutPermission' :: PutPermission -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: PutPermission
s@PutPermission' {} Maybe Text
a -> PutPermission
s {$sel:revisionId:PutPermission' :: Maybe Text
revisionId = Maybe Text
a} :: PutPermission)
putPermission_actionGroup :: Lens.Lens' PutPermission ActionGroup
putPermission_actionGroup :: (ActionGroup -> f ActionGroup) -> PutPermission -> f PutPermission
putPermission_actionGroup = (PutPermission -> ActionGroup)
-> (PutPermission -> ActionGroup -> PutPermission)
-> Lens PutPermission PutPermission ActionGroup ActionGroup
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {ActionGroup
actionGroup :: ActionGroup
$sel:actionGroup:PutPermission' :: PutPermission -> ActionGroup
actionGroup} -> ActionGroup
actionGroup) (\s :: PutPermission
s@PutPermission' {} ActionGroup
a -> PutPermission
s {$sel:actionGroup:PutPermission' :: ActionGroup
actionGroup = ActionGroup
a} :: PutPermission)
putPermission_principals :: Lens.Lens' PutPermission (Prelude.NonEmpty Prelude.Text)
putPermission_principals :: (NonEmpty Text -> f (NonEmpty Text))
-> PutPermission -> f PutPermission
putPermission_principals = (PutPermission -> NonEmpty Text)
-> (PutPermission -> NonEmpty Text -> PutPermission)
-> Lens PutPermission PutPermission (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {NonEmpty Text
principals :: NonEmpty Text
$sel:principals:PutPermission' :: PutPermission -> NonEmpty Text
principals} -> NonEmpty Text
principals) (\s :: PutPermission
s@PutPermission' {} NonEmpty Text
a -> PutPermission
s {$sel:principals:PutPermission' :: NonEmpty Text
principals = NonEmpty Text
a} :: PutPermission) ((NonEmpty Text -> f (NonEmpty Text))
-> PutPermission -> f PutPermission)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> PutPermission
-> f PutPermission
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putPermission_profilingGroupName :: Lens.Lens' PutPermission Prelude.Text
putPermission_profilingGroupName :: (Text -> f Text) -> PutPermission -> f PutPermission
putPermission_profilingGroupName = (PutPermission -> Text)
-> (PutPermission -> Text -> PutPermission)
-> Lens PutPermission PutPermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermission' {Text
profilingGroupName :: Text
$sel:profilingGroupName:PutPermission' :: PutPermission -> Text
profilingGroupName} -> Text
profilingGroupName) (\s :: PutPermission
s@PutPermission' {} Text
a -> PutPermission
s {$sel:profilingGroupName:PutPermission' :: Text
profilingGroupName = Text
a} :: PutPermission)
instance Core.AWSRequest PutPermission where
type
AWSResponse PutPermission =
PutPermissionResponse
request :: PutPermission -> Request PutPermission
request = Service -> PutPermission -> Request PutPermission
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutPermission
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutPermission)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PutPermission))
-> Logger
-> Service
-> Proxy PutPermission
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutPermission)))
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 -> Text -> PutPermissionResponse
PutPermissionResponse'
(Int -> Text -> Text -> PutPermissionResponse)
-> Either String Int
-> Either String (Text -> Text -> PutPermissionResponse)
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 -> Text -> PutPermissionResponse)
-> Either String Text
-> Either String (Text -> PutPermissionResponse)
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
"policy")
Either String (Text -> PutPermissionResponse)
-> Either String Text -> Either String PutPermissionResponse
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
"revisionId")
)
instance Prelude.Hashable PutPermission
instance Prelude.NFData PutPermission
instance Core.ToHeaders PutPermission where
toHeaders :: PutPermission -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutPermission -> 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 PutPermission where
toJSON :: PutPermission -> Value
toJSON PutPermission' {Maybe Text
NonEmpty Text
Text
ActionGroup
profilingGroupName :: Text
principals :: NonEmpty Text
actionGroup :: ActionGroup
revisionId :: Maybe Text
$sel:profilingGroupName:PutPermission' :: PutPermission -> Text
$sel:principals:PutPermission' :: PutPermission -> NonEmpty Text
$sel:actionGroup:PutPermission' :: PutPermission -> ActionGroup
$sel:revisionId:PutPermission' :: PutPermission -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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
"principals" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
principals)
]
)
instance Core.ToPath PutPermission where
toPath :: PutPermission -> ByteString
toPath PutPermission' {Maybe Text
NonEmpty Text
Text
ActionGroup
profilingGroupName :: Text
principals :: NonEmpty Text
actionGroup :: ActionGroup
revisionId :: Maybe Text
$sel:profilingGroupName:PutPermission' :: PutPermission -> Text
$sel:principals:PutPermission' :: PutPermission -> NonEmpty Text
$sel:actionGroup:PutPermission' :: PutPermission -> ActionGroup
$sel:revisionId:PutPermission' :: PutPermission -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/profilingGroups/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
profilingGroupName,
ByteString
"/policy/",
ActionGroup -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ActionGroup
actionGroup
]
instance Core.ToQuery PutPermission where
toQuery :: PutPermission -> QueryString
toQuery = QueryString -> PutPermission -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutPermissionResponse = PutPermissionResponse'
{
PutPermissionResponse -> Int
httpStatus :: Prelude.Int,
PutPermissionResponse -> Text
policy :: Prelude.Text,
PutPermissionResponse -> Text
revisionId :: Prelude.Text
}
deriving (PutPermissionResponse -> PutPermissionResponse -> Bool
(PutPermissionResponse -> PutPermissionResponse -> Bool)
-> (PutPermissionResponse -> PutPermissionResponse -> Bool)
-> Eq PutPermissionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutPermissionResponse -> PutPermissionResponse -> Bool
$c/= :: PutPermissionResponse -> PutPermissionResponse -> Bool
== :: PutPermissionResponse -> PutPermissionResponse -> Bool
$c== :: PutPermissionResponse -> PutPermissionResponse -> Bool
Prelude.Eq, ReadPrec [PutPermissionResponse]
ReadPrec PutPermissionResponse
Int -> ReadS PutPermissionResponse
ReadS [PutPermissionResponse]
(Int -> ReadS PutPermissionResponse)
-> ReadS [PutPermissionResponse]
-> ReadPrec PutPermissionResponse
-> ReadPrec [PutPermissionResponse]
-> Read PutPermissionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutPermissionResponse]
$creadListPrec :: ReadPrec [PutPermissionResponse]
readPrec :: ReadPrec PutPermissionResponse
$creadPrec :: ReadPrec PutPermissionResponse
readList :: ReadS [PutPermissionResponse]
$creadList :: ReadS [PutPermissionResponse]
readsPrec :: Int -> ReadS PutPermissionResponse
$creadsPrec :: Int -> ReadS PutPermissionResponse
Prelude.Read, Int -> PutPermissionResponse -> ShowS
[PutPermissionResponse] -> ShowS
PutPermissionResponse -> String
(Int -> PutPermissionResponse -> ShowS)
-> (PutPermissionResponse -> String)
-> ([PutPermissionResponse] -> ShowS)
-> Show PutPermissionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutPermissionResponse] -> ShowS
$cshowList :: [PutPermissionResponse] -> ShowS
show :: PutPermissionResponse -> String
$cshow :: PutPermissionResponse -> String
showsPrec :: Int -> PutPermissionResponse -> ShowS
$cshowsPrec :: Int -> PutPermissionResponse -> ShowS
Prelude.Show, (forall x. PutPermissionResponse -> Rep PutPermissionResponse x)
-> (forall x. Rep PutPermissionResponse x -> PutPermissionResponse)
-> Generic PutPermissionResponse
forall x. Rep PutPermissionResponse x -> PutPermissionResponse
forall x. PutPermissionResponse -> Rep PutPermissionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutPermissionResponse x -> PutPermissionResponse
$cfrom :: forall x. PutPermissionResponse -> Rep PutPermissionResponse x
Prelude.Generic)
newPutPermissionResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.Text ->
PutPermissionResponse
newPutPermissionResponse :: Int -> Text -> Text -> PutPermissionResponse
newPutPermissionResponse
Int
pHttpStatus_
Text
pPolicy_
Text
pRevisionId_ =
PutPermissionResponse' :: Int -> Text -> Text -> PutPermissionResponse
PutPermissionResponse'
{ $sel:httpStatus:PutPermissionResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:policy:PutPermissionResponse' :: Text
policy = Text
pPolicy_,
$sel:revisionId:PutPermissionResponse' :: Text
revisionId = Text
pRevisionId_
}
putPermissionResponse_httpStatus :: Lens.Lens' PutPermissionResponse Prelude.Int
putPermissionResponse_httpStatus :: (Int -> f Int) -> PutPermissionResponse -> f PutPermissionResponse
putPermissionResponse_httpStatus = (PutPermissionResponse -> Int)
-> (PutPermissionResponse -> Int -> PutPermissionResponse)
-> Lens PutPermissionResponse PutPermissionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermissionResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutPermissionResponse' :: PutPermissionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutPermissionResponse
s@PutPermissionResponse' {} Int
a -> PutPermissionResponse
s {$sel:httpStatus:PutPermissionResponse' :: Int
httpStatus = Int
a} :: PutPermissionResponse)
putPermissionResponse_policy :: Lens.Lens' PutPermissionResponse Prelude.Text
putPermissionResponse_policy :: (Text -> f Text)
-> PutPermissionResponse -> f PutPermissionResponse
putPermissionResponse_policy = (PutPermissionResponse -> Text)
-> (PutPermissionResponse -> Text -> PutPermissionResponse)
-> Lens PutPermissionResponse PutPermissionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermissionResponse' {Text
policy :: Text
$sel:policy:PutPermissionResponse' :: PutPermissionResponse -> Text
policy} -> Text
policy) (\s :: PutPermissionResponse
s@PutPermissionResponse' {} Text
a -> PutPermissionResponse
s {$sel:policy:PutPermissionResponse' :: Text
policy = Text
a} :: PutPermissionResponse)
putPermissionResponse_revisionId :: Lens.Lens' PutPermissionResponse Prelude.Text
putPermissionResponse_revisionId :: (Text -> f Text)
-> PutPermissionResponse -> f PutPermissionResponse
putPermissionResponse_revisionId = (PutPermissionResponse -> Text)
-> (PutPermissionResponse -> Text -> PutPermissionResponse)
-> Lens PutPermissionResponse PutPermissionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutPermissionResponse' {Text
revisionId :: Text
$sel:revisionId:PutPermissionResponse' :: PutPermissionResponse -> Text
revisionId} -> Text
revisionId) (\s :: PutPermissionResponse
s@PutPermissionResponse' {} Text
a -> PutPermissionResponse
s {$sel:revisionId:PutPermissionResponse' :: Text
revisionId = Text
a} :: PutPermissionResponse)
instance Prelude.NFData PutPermissionResponse