{-# 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.QuickSight.CreateGroupMembership
(
CreateGroupMembership (..),
newCreateGroupMembership,
createGroupMembership_memberName,
createGroupMembership_groupName,
createGroupMembership_awsAccountId,
createGroupMembership_namespace,
CreateGroupMembershipResponse (..),
newCreateGroupMembershipResponse,
createGroupMembershipResponse_requestId,
createGroupMembershipResponse_groupMember,
createGroupMembershipResponse_status,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateGroupMembership = CreateGroupMembership'
{
CreateGroupMembership -> Text
memberName :: Prelude.Text,
CreateGroupMembership -> Text
groupName :: Prelude.Text,
CreateGroupMembership -> Text
awsAccountId :: Prelude.Text,
CreateGroupMembership -> Text
namespace :: Prelude.Text
}
deriving (CreateGroupMembership -> CreateGroupMembership -> Bool
(CreateGroupMembership -> CreateGroupMembership -> Bool)
-> (CreateGroupMembership -> CreateGroupMembership -> Bool)
-> Eq CreateGroupMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGroupMembership -> CreateGroupMembership -> Bool
$c/= :: CreateGroupMembership -> CreateGroupMembership -> Bool
== :: CreateGroupMembership -> CreateGroupMembership -> Bool
$c== :: CreateGroupMembership -> CreateGroupMembership -> Bool
Prelude.Eq, ReadPrec [CreateGroupMembership]
ReadPrec CreateGroupMembership
Int -> ReadS CreateGroupMembership
ReadS [CreateGroupMembership]
(Int -> ReadS CreateGroupMembership)
-> ReadS [CreateGroupMembership]
-> ReadPrec CreateGroupMembership
-> ReadPrec [CreateGroupMembership]
-> Read CreateGroupMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGroupMembership]
$creadListPrec :: ReadPrec [CreateGroupMembership]
readPrec :: ReadPrec CreateGroupMembership
$creadPrec :: ReadPrec CreateGroupMembership
readList :: ReadS [CreateGroupMembership]
$creadList :: ReadS [CreateGroupMembership]
readsPrec :: Int -> ReadS CreateGroupMembership
$creadsPrec :: Int -> ReadS CreateGroupMembership
Prelude.Read, Int -> CreateGroupMembership -> ShowS
[CreateGroupMembership] -> ShowS
CreateGroupMembership -> String
(Int -> CreateGroupMembership -> ShowS)
-> (CreateGroupMembership -> String)
-> ([CreateGroupMembership] -> ShowS)
-> Show CreateGroupMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGroupMembership] -> ShowS
$cshowList :: [CreateGroupMembership] -> ShowS
show :: CreateGroupMembership -> String
$cshow :: CreateGroupMembership -> String
showsPrec :: Int -> CreateGroupMembership -> ShowS
$cshowsPrec :: Int -> CreateGroupMembership -> ShowS
Prelude.Show, (forall x. CreateGroupMembership -> Rep CreateGroupMembership x)
-> (forall x. Rep CreateGroupMembership x -> CreateGroupMembership)
-> Generic CreateGroupMembership
forall x. Rep CreateGroupMembership x -> CreateGroupMembership
forall x. CreateGroupMembership -> Rep CreateGroupMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGroupMembership x -> CreateGroupMembership
$cfrom :: forall x. CreateGroupMembership -> Rep CreateGroupMembership x
Prelude.Generic)
newCreateGroupMembership ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CreateGroupMembership
newCreateGroupMembership :: Text -> Text -> Text -> Text -> CreateGroupMembership
newCreateGroupMembership
Text
pMemberName_
Text
pGroupName_
Text
pAwsAccountId_
Text
pNamespace_ =
CreateGroupMembership' :: Text -> Text -> Text -> Text -> CreateGroupMembership
CreateGroupMembership'
{ $sel:memberName:CreateGroupMembership' :: Text
memberName = Text
pMemberName_,
$sel:groupName:CreateGroupMembership' :: Text
groupName = Text
pGroupName_,
$sel:awsAccountId:CreateGroupMembership' :: Text
awsAccountId = Text
pAwsAccountId_,
$sel:namespace:CreateGroupMembership' :: Text
namespace = Text
pNamespace_
}
createGroupMembership_memberName :: Lens.Lens' CreateGroupMembership Prelude.Text
createGroupMembership_memberName :: (Text -> f Text)
-> CreateGroupMembership -> f CreateGroupMembership
createGroupMembership_memberName = (CreateGroupMembership -> Text)
-> (CreateGroupMembership -> Text -> CreateGroupMembership)
-> Lens CreateGroupMembership CreateGroupMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupMembership' {Text
memberName :: Text
$sel:memberName:CreateGroupMembership' :: CreateGroupMembership -> Text
memberName} -> Text
memberName) (\s :: CreateGroupMembership
s@CreateGroupMembership' {} Text
a -> CreateGroupMembership
s {$sel:memberName:CreateGroupMembership' :: Text
memberName = Text
a} :: CreateGroupMembership)
createGroupMembership_groupName :: Lens.Lens' CreateGroupMembership Prelude.Text
createGroupMembership_groupName :: (Text -> f Text)
-> CreateGroupMembership -> f CreateGroupMembership
createGroupMembership_groupName = (CreateGroupMembership -> Text)
-> (CreateGroupMembership -> Text -> CreateGroupMembership)
-> Lens CreateGroupMembership CreateGroupMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupMembership' {Text
groupName :: Text
$sel:groupName:CreateGroupMembership' :: CreateGroupMembership -> Text
groupName} -> Text
groupName) (\s :: CreateGroupMembership
s@CreateGroupMembership' {} Text
a -> CreateGroupMembership
s {$sel:groupName:CreateGroupMembership' :: Text
groupName = Text
a} :: CreateGroupMembership)
createGroupMembership_awsAccountId :: Lens.Lens' CreateGroupMembership Prelude.Text
createGroupMembership_awsAccountId :: (Text -> f Text)
-> CreateGroupMembership -> f CreateGroupMembership
createGroupMembership_awsAccountId = (CreateGroupMembership -> Text)
-> (CreateGroupMembership -> Text -> CreateGroupMembership)
-> Lens CreateGroupMembership CreateGroupMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupMembership' {Text
awsAccountId :: Text
$sel:awsAccountId:CreateGroupMembership' :: CreateGroupMembership -> Text
awsAccountId} -> Text
awsAccountId) (\s :: CreateGroupMembership
s@CreateGroupMembership' {} Text
a -> CreateGroupMembership
s {$sel:awsAccountId:CreateGroupMembership' :: Text
awsAccountId = Text
a} :: CreateGroupMembership)
createGroupMembership_namespace :: Lens.Lens' CreateGroupMembership Prelude.Text
createGroupMembership_namespace :: (Text -> f Text)
-> CreateGroupMembership -> f CreateGroupMembership
createGroupMembership_namespace = (CreateGroupMembership -> Text)
-> (CreateGroupMembership -> Text -> CreateGroupMembership)
-> Lens CreateGroupMembership CreateGroupMembership Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupMembership' {Text
namespace :: Text
$sel:namespace:CreateGroupMembership' :: CreateGroupMembership -> Text
namespace} -> Text
namespace) (\s :: CreateGroupMembership
s@CreateGroupMembership' {} Text
a -> CreateGroupMembership
s {$sel:namespace:CreateGroupMembership' :: Text
namespace = Text
a} :: CreateGroupMembership)
instance Core.AWSRequest CreateGroupMembership where
type
AWSResponse CreateGroupMembership =
CreateGroupMembershipResponse
request :: CreateGroupMembership -> Request CreateGroupMembership
request = Service -> CreateGroupMembership -> Request CreateGroupMembership
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateGroupMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateGroupMembership)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateGroupMembership))
-> Logger
-> Service
-> Proxy CreateGroupMembership
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateGroupMembership)))
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
-> Maybe GroupMember -> Int -> CreateGroupMembershipResponse
CreateGroupMembershipResponse'
(Maybe Text
-> Maybe GroupMember -> Int -> CreateGroupMembershipResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe GroupMember -> Int -> CreateGroupMembershipResponse)
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
"RequestId")
Either
String (Maybe GroupMember -> Int -> CreateGroupMembershipResponse)
-> Either String (Maybe GroupMember)
-> Either String (Int -> CreateGroupMembershipResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe GroupMember)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GroupMember")
Either String (Int -> CreateGroupMembershipResponse)
-> Either String Int -> Either String CreateGroupMembershipResponse
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 CreateGroupMembership
instance Prelude.NFData CreateGroupMembership
instance Core.ToHeaders CreateGroupMembership where
toHeaders :: CreateGroupMembership -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateGroupMembership -> 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.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateGroupMembership where
toJSON :: CreateGroupMembership -> Value
toJSON = Value -> CreateGroupMembership -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath CreateGroupMembership where
toPath :: CreateGroupMembership -> ByteString
toPath CreateGroupMembership' {Text
namespace :: Text
awsAccountId :: Text
groupName :: Text
memberName :: Text
$sel:namespace:CreateGroupMembership' :: CreateGroupMembership -> Text
$sel:awsAccountId:CreateGroupMembership' :: CreateGroupMembership -> Text
$sel:groupName:CreateGroupMembership' :: CreateGroupMembership -> Text
$sel:memberName:CreateGroupMembership' :: CreateGroupMembership -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/accounts/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId,
ByteString
"/namespaces/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
namespace,
ByteString
"/groups/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
groupName,
ByteString
"/members/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
memberName
]
instance Core.ToQuery CreateGroupMembership where
toQuery :: CreateGroupMembership -> QueryString
toQuery = QueryString -> CreateGroupMembership -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateGroupMembershipResponse = CreateGroupMembershipResponse'
{
CreateGroupMembershipResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
CreateGroupMembershipResponse -> Maybe GroupMember
groupMember :: Prelude.Maybe GroupMember,
CreateGroupMembershipResponse -> Int
status :: Prelude.Int
}
deriving (CreateGroupMembershipResponse
-> CreateGroupMembershipResponse -> Bool
(CreateGroupMembershipResponse
-> CreateGroupMembershipResponse -> Bool)
-> (CreateGroupMembershipResponse
-> CreateGroupMembershipResponse -> Bool)
-> Eq CreateGroupMembershipResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGroupMembershipResponse
-> CreateGroupMembershipResponse -> Bool
$c/= :: CreateGroupMembershipResponse
-> CreateGroupMembershipResponse -> Bool
== :: CreateGroupMembershipResponse
-> CreateGroupMembershipResponse -> Bool
$c== :: CreateGroupMembershipResponse
-> CreateGroupMembershipResponse -> Bool
Prelude.Eq, ReadPrec [CreateGroupMembershipResponse]
ReadPrec CreateGroupMembershipResponse
Int -> ReadS CreateGroupMembershipResponse
ReadS [CreateGroupMembershipResponse]
(Int -> ReadS CreateGroupMembershipResponse)
-> ReadS [CreateGroupMembershipResponse]
-> ReadPrec CreateGroupMembershipResponse
-> ReadPrec [CreateGroupMembershipResponse]
-> Read CreateGroupMembershipResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGroupMembershipResponse]
$creadListPrec :: ReadPrec [CreateGroupMembershipResponse]
readPrec :: ReadPrec CreateGroupMembershipResponse
$creadPrec :: ReadPrec CreateGroupMembershipResponse
readList :: ReadS [CreateGroupMembershipResponse]
$creadList :: ReadS [CreateGroupMembershipResponse]
readsPrec :: Int -> ReadS CreateGroupMembershipResponse
$creadsPrec :: Int -> ReadS CreateGroupMembershipResponse
Prelude.Read, Int -> CreateGroupMembershipResponse -> ShowS
[CreateGroupMembershipResponse] -> ShowS
CreateGroupMembershipResponse -> String
(Int -> CreateGroupMembershipResponse -> ShowS)
-> (CreateGroupMembershipResponse -> String)
-> ([CreateGroupMembershipResponse] -> ShowS)
-> Show CreateGroupMembershipResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGroupMembershipResponse] -> ShowS
$cshowList :: [CreateGroupMembershipResponse] -> ShowS
show :: CreateGroupMembershipResponse -> String
$cshow :: CreateGroupMembershipResponse -> String
showsPrec :: Int -> CreateGroupMembershipResponse -> ShowS
$cshowsPrec :: Int -> CreateGroupMembershipResponse -> ShowS
Prelude.Show, (forall x.
CreateGroupMembershipResponse
-> Rep CreateGroupMembershipResponse x)
-> (forall x.
Rep CreateGroupMembershipResponse x
-> CreateGroupMembershipResponse)
-> Generic CreateGroupMembershipResponse
forall x.
Rep CreateGroupMembershipResponse x
-> CreateGroupMembershipResponse
forall x.
CreateGroupMembershipResponse
-> Rep CreateGroupMembershipResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateGroupMembershipResponse x
-> CreateGroupMembershipResponse
$cfrom :: forall x.
CreateGroupMembershipResponse
-> Rep CreateGroupMembershipResponse x
Prelude.Generic)
newCreateGroupMembershipResponse ::
Prelude.Int ->
CreateGroupMembershipResponse
newCreateGroupMembershipResponse :: Int -> CreateGroupMembershipResponse
newCreateGroupMembershipResponse Int
pStatus_ =
CreateGroupMembershipResponse' :: Maybe Text
-> Maybe GroupMember -> Int -> CreateGroupMembershipResponse
CreateGroupMembershipResponse'
{ $sel:requestId:CreateGroupMembershipResponse' :: Maybe Text
requestId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:groupMember:CreateGroupMembershipResponse' :: Maybe GroupMember
groupMember = Maybe GroupMember
forall a. Maybe a
Prelude.Nothing,
$sel:status:CreateGroupMembershipResponse' :: Int
status = Int
pStatus_
}
createGroupMembershipResponse_requestId :: Lens.Lens' CreateGroupMembershipResponse (Prelude.Maybe Prelude.Text)
createGroupMembershipResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> CreateGroupMembershipResponse -> f CreateGroupMembershipResponse
createGroupMembershipResponse_requestId = (CreateGroupMembershipResponse -> Maybe Text)
-> (CreateGroupMembershipResponse
-> Maybe Text -> CreateGroupMembershipResponse)
-> Lens
CreateGroupMembershipResponse
CreateGroupMembershipResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupMembershipResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:CreateGroupMembershipResponse' :: CreateGroupMembershipResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: CreateGroupMembershipResponse
s@CreateGroupMembershipResponse' {} Maybe Text
a -> CreateGroupMembershipResponse
s {$sel:requestId:CreateGroupMembershipResponse' :: Maybe Text
requestId = Maybe Text
a} :: CreateGroupMembershipResponse)
createGroupMembershipResponse_groupMember :: Lens.Lens' CreateGroupMembershipResponse (Prelude.Maybe GroupMember)
createGroupMembershipResponse_groupMember :: (Maybe GroupMember -> f (Maybe GroupMember))
-> CreateGroupMembershipResponse -> f CreateGroupMembershipResponse
createGroupMembershipResponse_groupMember = (CreateGroupMembershipResponse -> Maybe GroupMember)
-> (CreateGroupMembershipResponse
-> Maybe GroupMember -> CreateGroupMembershipResponse)
-> Lens
CreateGroupMembershipResponse
CreateGroupMembershipResponse
(Maybe GroupMember)
(Maybe GroupMember)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupMembershipResponse' {Maybe GroupMember
groupMember :: Maybe GroupMember
$sel:groupMember:CreateGroupMembershipResponse' :: CreateGroupMembershipResponse -> Maybe GroupMember
groupMember} -> Maybe GroupMember
groupMember) (\s :: CreateGroupMembershipResponse
s@CreateGroupMembershipResponse' {} Maybe GroupMember
a -> CreateGroupMembershipResponse
s {$sel:groupMember:CreateGroupMembershipResponse' :: Maybe GroupMember
groupMember = Maybe GroupMember
a} :: CreateGroupMembershipResponse)
createGroupMembershipResponse_status :: Lens.Lens' CreateGroupMembershipResponse Prelude.Int
createGroupMembershipResponse_status :: (Int -> f Int)
-> CreateGroupMembershipResponse -> f CreateGroupMembershipResponse
createGroupMembershipResponse_status = (CreateGroupMembershipResponse -> Int)
-> (CreateGroupMembershipResponse
-> Int -> CreateGroupMembershipResponse)
-> Lens
CreateGroupMembershipResponse CreateGroupMembershipResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupMembershipResponse' {Int
status :: Int
$sel:status:CreateGroupMembershipResponse' :: CreateGroupMembershipResponse -> Int
status} -> Int
status) (\s :: CreateGroupMembershipResponse
s@CreateGroupMembershipResponse' {} Int
a -> CreateGroupMembershipResponse
s {$sel:status:CreateGroupMembershipResponse' :: Int
status = Int
a} :: CreateGroupMembershipResponse)
instance Prelude.NFData CreateGroupMembershipResponse