{-# 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.Cloud9.CreateEnvironmentMembership
(
CreateEnvironmentMembership (..),
newCreateEnvironmentMembership,
createEnvironmentMembership_environmentId,
createEnvironmentMembership_userArn,
createEnvironmentMembership_permissions,
CreateEnvironmentMembershipResponse (..),
newCreateEnvironmentMembershipResponse,
createEnvironmentMembershipResponse_httpStatus,
createEnvironmentMembershipResponse_membership,
)
where
import Amazonka.Cloud9.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 CreateEnvironmentMembership = CreateEnvironmentMembership'
{
CreateEnvironmentMembership -> Text
environmentId :: Prelude.Text,
CreateEnvironmentMembership -> Text
userArn :: Prelude.Text,
CreateEnvironmentMembership -> MemberPermissions
permissions :: MemberPermissions
}
deriving (CreateEnvironmentMembership -> CreateEnvironmentMembership -> Bool
(CreateEnvironmentMembership
-> CreateEnvironmentMembership -> Bool)
-> (CreateEnvironmentMembership
-> CreateEnvironmentMembership -> Bool)
-> Eq CreateEnvironmentMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEnvironmentMembership -> CreateEnvironmentMembership -> Bool
$c/= :: CreateEnvironmentMembership -> CreateEnvironmentMembership -> Bool
== :: CreateEnvironmentMembership -> CreateEnvironmentMembership -> Bool
$c== :: CreateEnvironmentMembership -> CreateEnvironmentMembership -> Bool
Prelude.Eq, ReadPrec [CreateEnvironmentMembership]
ReadPrec CreateEnvironmentMembership
Int -> ReadS CreateEnvironmentMembership
ReadS [CreateEnvironmentMembership]
(Int -> ReadS CreateEnvironmentMembership)
-> ReadS [CreateEnvironmentMembership]
-> ReadPrec CreateEnvironmentMembership
-> ReadPrec [CreateEnvironmentMembership]
-> Read CreateEnvironmentMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEnvironmentMembership]
$creadListPrec :: ReadPrec [CreateEnvironmentMembership]
readPrec :: ReadPrec CreateEnvironmentMembership
$creadPrec :: ReadPrec CreateEnvironmentMembership
readList :: ReadS [CreateEnvironmentMembership]
$creadList :: ReadS [CreateEnvironmentMembership]
readsPrec :: Int -> ReadS CreateEnvironmentMembership
$creadsPrec :: Int -> ReadS CreateEnvironmentMembership
Prelude.Read, Int -> CreateEnvironmentMembership -> ShowS
[CreateEnvironmentMembership] -> ShowS
CreateEnvironmentMembership -> String
(Int -> CreateEnvironmentMembership -> ShowS)
-> (CreateEnvironmentMembership -> String)
-> ([CreateEnvironmentMembership] -> ShowS)
-> Show CreateEnvironmentMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEnvironmentMembership] -> ShowS
$cshowList :: [CreateEnvironmentMembership] -> ShowS
show :: CreateEnvironmentMembership -> String
$cshow :: CreateEnvironmentMembership -> String
showsPrec :: Int -> CreateEnvironmentMembership -> ShowS
$cshowsPrec :: Int -> CreateEnvironmentMembership -> ShowS
Prelude.Show, (forall x.
CreateEnvironmentMembership -> Rep CreateEnvironmentMembership x)
-> (forall x.
Rep CreateEnvironmentMembership x -> CreateEnvironmentMembership)
-> Generic CreateEnvironmentMembership
forall x.
Rep CreateEnvironmentMembership x -> CreateEnvironmentMembership
forall x.
CreateEnvironmentMembership -> Rep CreateEnvironmentMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEnvironmentMembership x -> CreateEnvironmentMembership
$cfrom :: forall x.
CreateEnvironmentMembership -> Rep CreateEnvironmentMembership x
Prelude.Generic)
newCreateEnvironmentMembership ::
Prelude.Text ->
Prelude.Text ->
MemberPermissions ->
CreateEnvironmentMembership
newCreateEnvironmentMembership :: Text -> Text -> MemberPermissions -> CreateEnvironmentMembership
newCreateEnvironmentMembership
Text
pEnvironmentId_
Text
pUserArn_
MemberPermissions
pPermissions_ =
CreateEnvironmentMembership' :: Text -> Text -> MemberPermissions -> CreateEnvironmentMembership
CreateEnvironmentMembership'
{ $sel:environmentId:CreateEnvironmentMembership' :: Text
environmentId =
Text
pEnvironmentId_,
$sel:userArn:CreateEnvironmentMembership' :: Text
userArn = Text
pUserArn_,
$sel:permissions:CreateEnvironmentMembership' :: MemberPermissions
permissions = MemberPermissions
pPermissions_
}
createEnvironmentMembership_environmentId :: Lens.Lens' CreateEnvironmentMembership Prelude.Text
createEnvironmentMembership_environmentId :: (Text -> f Text)
-> CreateEnvironmentMembership -> f CreateEnvironmentMembership
createEnvironmentMembership_environmentId = (CreateEnvironmentMembership -> Text)
-> (CreateEnvironmentMembership
-> Text -> CreateEnvironmentMembership)
-> Lens
CreateEnvironmentMembership CreateEnvironmentMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentMembership' {Text
environmentId :: Text
$sel:environmentId:CreateEnvironmentMembership' :: CreateEnvironmentMembership -> Text
environmentId} -> Text
environmentId) (\s :: CreateEnvironmentMembership
s@CreateEnvironmentMembership' {} Text
a -> CreateEnvironmentMembership
s {$sel:environmentId:CreateEnvironmentMembership' :: Text
environmentId = Text
a} :: CreateEnvironmentMembership)
createEnvironmentMembership_userArn :: Lens.Lens' CreateEnvironmentMembership Prelude.Text
createEnvironmentMembership_userArn :: (Text -> f Text)
-> CreateEnvironmentMembership -> f CreateEnvironmentMembership
createEnvironmentMembership_userArn = (CreateEnvironmentMembership -> Text)
-> (CreateEnvironmentMembership
-> Text -> CreateEnvironmentMembership)
-> Lens
CreateEnvironmentMembership CreateEnvironmentMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentMembership' {Text
userArn :: Text
$sel:userArn:CreateEnvironmentMembership' :: CreateEnvironmentMembership -> Text
userArn} -> Text
userArn) (\s :: CreateEnvironmentMembership
s@CreateEnvironmentMembership' {} Text
a -> CreateEnvironmentMembership
s {$sel:userArn:CreateEnvironmentMembership' :: Text
userArn = Text
a} :: CreateEnvironmentMembership)
createEnvironmentMembership_permissions :: Lens.Lens' CreateEnvironmentMembership MemberPermissions
createEnvironmentMembership_permissions :: (MemberPermissions -> f MemberPermissions)
-> CreateEnvironmentMembership -> f CreateEnvironmentMembership
createEnvironmentMembership_permissions = (CreateEnvironmentMembership -> MemberPermissions)
-> (CreateEnvironmentMembership
-> MemberPermissions -> CreateEnvironmentMembership)
-> Lens
CreateEnvironmentMembership
CreateEnvironmentMembership
MemberPermissions
MemberPermissions
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentMembership' {MemberPermissions
permissions :: MemberPermissions
$sel:permissions:CreateEnvironmentMembership' :: CreateEnvironmentMembership -> MemberPermissions
permissions} -> MemberPermissions
permissions) (\s :: CreateEnvironmentMembership
s@CreateEnvironmentMembership' {} MemberPermissions
a -> CreateEnvironmentMembership
s {$sel:permissions:CreateEnvironmentMembership' :: MemberPermissions
permissions = MemberPermissions
a} :: CreateEnvironmentMembership)
instance Core.AWSRequest CreateEnvironmentMembership where
type
AWSResponse CreateEnvironmentMembership =
CreateEnvironmentMembershipResponse
request :: CreateEnvironmentMembership -> Request CreateEnvironmentMembership
request = Service
-> CreateEnvironmentMembership
-> Request CreateEnvironmentMembership
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateEnvironmentMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateEnvironmentMembership)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateEnvironmentMembership))
-> Logger
-> Service
-> Proxy CreateEnvironmentMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateEnvironmentMembership)))
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 -> EnvironmentMember -> CreateEnvironmentMembershipResponse
CreateEnvironmentMembershipResponse'
(Int -> EnvironmentMember -> CreateEnvironmentMembershipResponse)
-> Either String Int
-> Either
String (EnvironmentMember -> CreateEnvironmentMembershipResponse)
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 (EnvironmentMember -> CreateEnvironmentMembershipResponse)
-> Either String EnvironmentMember
-> Either String CreateEnvironmentMembershipResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String EnvironmentMember
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"membership")
)
instance Prelude.Hashable CreateEnvironmentMembership
instance Prelude.NFData CreateEnvironmentMembership
instance Core.ToHeaders CreateEnvironmentMembership where
toHeaders :: CreateEnvironmentMembership -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateEnvironmentMembership -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSCloud9WorkspaceManagementService.CreateEnvironmentMembership" ::
Prelude.ByteString
),
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 CreateEnvironmentMembership where
toJSON :: CreateEnvironmentMembership -> Value
toJSON CreateEnvironmentMembership' {Text
MemberPermissions
permissions :: MemberPermissions
userArn :: Text
environmentId :: Text
$sel:permissions:CreateEnvironmentMembership' :: CreateEnvironmentMembership -> MemberPermissions
$sel:userArn:CreateEnvironmentMembership' :: CreateEnvironmentMembership -> Text
$sel:environmentId:CreateEnvironmentMembership' :: CreateEnvironmentMembership -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"environmentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
environmentId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"userArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"permissions" Text -> MemberPermissions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= MemberPermissions
permissions)
]
)
instance Core.ToPath CreateEnvironmentMembership where
toPath :: CreateEnvironmentMembership -> ByteString
toPath = ByteString -> CreateEnvironmentMembership -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateEnvironmentMembership where
toQuery :: CreateEnvironmentMembership -> QueryString
toQuery = QueryString -> CreateEnvironmentMembership -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateEnvironmentMembershipResponse = CreateEnvironmentMembershipResponse'
{
CreateEnvironmentMembershipResponse -> Int
httpStatus :: Prelude.Int,
CreateEnvironmentMembershipResponse -> EnvironmentMember
membership :: EnvironmentMember
}
deriving (CreateEnvironmentMembershipResponse
-> CreateEnvironmentMembershipResponse -> Bool
(CreateEnvironmentMembershipResponse
-> CreateEnvironmentMembershipResponse -> Bool)
-> (CreateEnvironmentMembershipResponse
-> CreateEnvironmentMembershipResponse -> Bool)
-> Eq CreateEnvironmentMembershipResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateEnvironmentMembershipResponse
-> CreateEnvironmentMembershipResponse -> Bool
$c/= :: CreateEnvironmentMembershipResponse
-> CreateEnvironmentMembershipResponse -> Bool
== :: CreateEnvironmentMembershipResponse
-> CreateEnvironmentMembershipResponse -> Bool
$c== :: CreateEnvironmentMembershipResponse
-> CreateEnvironmentMembershipResponse -> Bool
Prelude.Eq, ReadPrec [CreateEnvironmentMembershipResponse]
ReadPrec CreateEnvironmentMembershipResponse
Int -> ReadS CreateEnvironmentMembershipResponse
ReadS [CreateEnvironmentMembershipResponse]
(Int -> ReadS CreateEnvironmentMembershipResponse)
-> ReadS [CreateEnvironmentMembershipResponse]
-> ReadPrec CreateEnvironmentMembershipResponse
-> ReadPrec [CreateEnvironmentMembershipResponse]
-> Read CreateEnvironmentMembershipResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateEnvironmentMembershipResponse]
$creadListPrec :: ReadPrec [CreateEnvironmentMembershipResponse]
readPrec :: ReadPrec CreateEnvironmentMembershipResponse
$creadPrec :: ReadPrec CreateEnvironmentMembershipResponse
readList :: ReadS [CreateEnvironmentMembershipResponse]
$creadList :: ReadS [CreateEnvironmentMembershipResponse]
readsPrec :: Int -> ReadS CreateEnvironmentMembershipResponse
$creadsPrec :: Int -> ReadS CreateEnvironmentMembershipResponse
Prelude.Read, Int -> CreateEnvironmentMembershipResponse -> ShowS
[CreateEnvironmentMembershipResponse] -> ShowS
CreateEnvironmentMembershipResponse -> String
(Int -> CreateEnvironmentMembershipResponse -> ShowS)
-> (CreateEnvironmentMembershipResponse -> String)
-> ([CreateEnvironmentMembershipResponse] -> ShowS)
-> Show CreateEnvironmentMembershipResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateEnvironmentMembershipResponse] -> ShowS
$cshowList :: [CreateEnvironmentMembershipResponse] -> ShowS
show :: CreateEnvironmentMembershipResponse -> String
$cshow :: CreateEnvironmentMembershipResponse -> String
showsPrec :: Int -> CreateEnvironmentMembershipResponse -> ShowS
$cshowsPrec :: Int -> CreateEnvironmentMembershipResponse -> ShowS
Prelude.Show, (forall x.
CreateEnvironmentMembershipResponse
-> Rep CreateEnvironmentMembershipResponse x)
-> (forall x.
Rep CreateEnvironmentMembershipResponse x
-> CreateEnvironmentMembershipResponse)
-> Generic CreateEnvironmentMembershipResponse
forall x.
Rep CreateEnvironmentMembershipResponse x
-> CreateEnvironmentMembershipResponse
forall x.
CreateEnvironmentMembershipResponse
-> Rep CreateEnvironmentMembershipResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateEnvironmentMembershipResponse x
-> CreateEnvironmentMembershipResponse
$cfrom :: forall x.
CreateEnvironmentMembershipResponse
-> Rep CreateEnvironmentMembershipResponse x
Prelude.Generic)
newCreateEnvironmentMembershipResponse ::
Prelude.Int ->
EnvironmentMember ->
CreateEnvironmentMembershipResponse
newCreateEnvironmentMembershipResponse :: Int -> EnvironmentMember -> CreateEnvironmentMembershipResponse
newCreateEnvironmentMembershipResponse
Int
pHttpStatus_
EnvironmentMember
pMembership_ =
CreateEnvironmentMembershipResponse' :: Int -> EnvironmentMember -> CreateEnvironmentMembershipResponse
CreateEnvironmentMembershipResponse'
{ $sel:httpStatus:CreateEnvironmentMembershipResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:membership:CreateEnvironmentMembershipResponse' :: EnvironmentMember
membership = EnvironmentMember
pMembership_
}
createEnvironmentMembershipResponse_httpStatus :: Lens.Lens' CreateEnvironmentMembershipResponse Prelude.Int
createEnvironmentMembershipResponse_httpStatus :: (Int -> f Int)
-> CreateEnvironmentMembershipResponse
-> f CreateEnvironmentMembershipResponse
createEnvironmentMembershipResponse_httpStatus = (CreateEnvironmentMembershipResponse -> Int)
-> (CreateEnvironmentMembershipResponse
-> Int -> CreateEnvironmentMembershipResponse)
-> Lens
CreateEnvironmentMembershipResponse
CreateEnvironmentMembershipResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentMembershipResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateEnvironmentMembershipResponse' :: CreateEnvironmentMembershipResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateEnvironmentMembershipResponse
s@CreateEnvironmentMembershipResponse' {} Int
a -> CreateEnvironmentMembershipResponse
s {$sel:httpStatus:CreateEnvironmentMembershipResponse' :: Int
httpStatus = Int
a} :: CreateEnvironmentMembershipResponse)
createEnvironmentMembershipResponse_membership :: Lens.Lens' CreateEnvironmentMembershipResponse EnvironmentMember
createEnvironmentMembershipResponse_membership :: (EnvironmentMember -> f EnvironmentMember)
-> CreateEnvironmentMembershipResponse
-> f CreateEnvironmentMembershipResponse
createEnvironmentMembershipResponse_membership = (CreateEnvironmentMembershipResponse -> EnvironmentMember)
-> (CreateEnvironmentMembershipResponse
-> EnvironmentMember -> CreateEnvironmentMembershipResponse)
-> Lens
CreateEnvironmentMembershipResponse
CreateEnvironmentMembershipResponse
EnvironmentMember
EnvironmentMember
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentMembershipResponse' {EnvironmentMember
membership :: EnvironmentMember
$sel:membership:CreateEnvironmentMembershipResponse' :: CreateEnvironmentMembershipResponse -> EnvironmentMember
membership} -> EnvironmentMember
membership) (\s :: CreateEnvironmentMembershipResponse
s@CreateEnvironmentMembershipResponse' {} EnvironmentMember
a -> CreateEnvironmentMembershipResponse
s {$sel:membership:CreateEnvironmentMembershipResponse' :: EnvironmentMember
membership = EnvironmentMember
a} :: CreateEnvironmentMembershipResponse)
instance
Prelude.NFData
CreateEnvironmentMembershipResponse