{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:revisionId:PutPermission' :: Maybe Text
revisionId = forall a. Maybe a
Prelude.Nothing,
$sel:actionGroup:PutPermission' :: ActionGroup
actionGroup = ActionGroup
pActionGroup_,
$sel:principals:PutPermission' :: NonEmpty Text
principals = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced 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 :: Lens' PutPermission (Maybe Text)
putPermission_revisionId = 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 :: Lens' PutPermission ActionGroup
putPermission_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 :: Lens' PutPermission (NonEmpty Text)
putPermission_principals = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 :: Lens' PutPermission Text
putPermission_profilingGroupName = 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 :: (Service -> Service) -> PutPermission -> Request PutPermission
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PutPermission
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutPermission)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Text -> Text -> PutPermissionResponse
PutPermissionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"policy")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"revisionId")
)
instance Prelude.Hashable PutPermission where
hashWithSalt :: Int -> PutPermission -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
revisionId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ActionGroup
actionGroup
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
principals
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
profilingGroupName
instance Prelude.NFData PutPermission where
rnf :: PutPermission -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
revisionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ActionGroup
actionGroup
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
principals
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
profilingGroupName
instance Data.ToHeaders PutPermission where
toHeaders :: PutPermission -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"revisionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
revisionId,
forall a. a -> Maybe a
Prelude.Just (Key
"principals" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
principals)
]
)
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/profilingGroups/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
profilingGroupName,
ByteString
"/policy/",
forall a. ToByteString a => a -> ByteString
Data.toBS ActionGroup
actionGroup
]
instance Data.ToQuery PutPermission where
toQuery :: PutPermission -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $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 :: Lens' PutPermissionResponse Int
putPermissionResponse_httpStatus = 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 :: Lens' PutPermissionResponse Text
putPermissionResponse_policy = 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 :: Lens' PutPermissionResponse Text
putPermissionResponse_revisionId = 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 where
rnf :: PutPermissionResponse -> ()
rnf PutPermissionResponse' {Int
Text
revisionId :: Text
policy :: Text
httpStatus :: Int
$sel:revisionId:PutPermissionResponse' :: PutPermissionResponse -> Text
$sel:policy:PutPermissionResponse' :: PutPermissionResponse -> Text
$sel:httpStatus:PutPermissionResponse' :: PutPermissionResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
revisionId