{-# 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.IdentityStore.CreateGroup
(
CreateGroup (..),
newCreateGroup,
createGroup_description,
createGroup_displayName,
createGroup_identityStoreId,
CreateGroupResponse (..),
newCreateGroupResponse,
createGroupResponse_httpStatus,
createGroupResponse_groupId,
createGroupResponse_identityStoreId,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IdentityStore.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateGroup = CreateGroup'
{
CreateGroup -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Data.Sensitive Prelude.Text),
CreateGroup -> Maybe (Sensitive Text)
displayName :: Prelude.Maybe (Data.Sensitive Prelude.Text),
CreateGroup -> Text
identityStoreId :: Prelude.Text
}
deriving (CreateGroup -> CreateGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGroup -> CreateGroup -> Bool
$c/= :: CreateGroup -> CreateGroup -> Bool
== :: CreateGroup -> CreateGroup -> Bool
$c== :: CreateGroup -> CreateGroup -> Bool
Prelude.Eq, Int -> CreateGroup -> ShowS
[CreateGroup] -> ShowS
CreateGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGroup] -> ShowS
$cshowList :: [CreateGroup] -> ShowS
show :: CreateGroup -> String
$cshow :: CreateGroup -> String
showsPrec :: Int -> CreateGroup -> ShowS
$cshowsPrec :: Int -> CreateGroup -> ShowS
Prelude.Show, forall x. Rep CreateGroup x -> CreateGroup
forall x. CreateGroup -> Rep CreateGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGroup x -> CreateGroup
$cfrom :: forall x. CreateGroup -> Rep CreateGroup x
Prelude.Generic)
newCreateGroup ::
Prelude.Text ->
CreateGroup
newCreateGroup :: Text -> CreateGroup
newCreateGroup Text
pIdentityStoreId_ =
CreateGroup'
{ $sel:description:CreateGroup' :: Maybe (Sensitive Text)
description = forall a. Maybe a
Prelude.Nothing,
$sel:displayName:CreateGroup' :: Maybe (Sensitive Text)
displayName = forall a. Maybe a
Prelude.Nothing,
$sel:identityStoreId:CreateGroup' :: Text
identityStoreId = Text
pIdentityStoreId_
}
createGroup_description :: Lens.Lens' CreateGroup (Prelude.Maybe Prelude.Text)
createGroup_description :: Lens' CreateGroup (Maybe Text)
createGroup_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroup' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:CreateGroup' :: CreateGroup -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: CreateGroup
s@CreateGroup' {} Maybe (Sensitive Text)
a -> CreateGroup
s {$sel:description:CreateGroup' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: CreateGroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive
createGroup_displayName :: Lens.Lens' CreateGroup (Prelude.Maybe Prelude.Text)
createGroup_displayName :: Lens' CreateGroup (Maybe Text)
createGroup_displayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroup' {Maybe (Sensitive Text)
displayName :: Maybe (Sensitive Text)
$sel:displayName:CreateGroup' :: CreateGroup -> Maybe (Sensitive Text)
displayName} -> Maybe (Sensitive Text)
displayName) (\s :: CreateGroup
s@CreateGroup' {} Maybe (Sensitive Text)
a -> CreateGroup
s {$sel:displayName:CreateGroup' :: Maybe (Sensitive Text)
displayName = Maybe (Sensitive Text)
a} :: CreateGroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive
createGroup_identityStoreId :: Lens.Lens' CreateGroup Prelude.Text
createGroup_identityStoreId :: Lens' CreateGroup Text
createGroup_identityStoreId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroup' {Text
identityStoreId :: Text
$sel:identityStoreId:CreateGroup' :: CreateGroup -> Text
identityStoreId} -> Text
identityStoreId) (\s :: CreateGroup
s@CreateGroup' {} Text
a -> CreateGroup
s {$sel:identityStoreId:CreateGroup' :: Text
identityStoreId = Text
a} :: CreateGroup)
instance Core.AWSRequest CreateGroup where
type AWSResponse CreateGroup = CreateGroupResponse
request :: (Service -> Service) -> CreateGroup -> Request CreateGroup
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateGroup)))
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 -> CreateGroupResponse
CreateGroupResponse'
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
"GroupId")
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
"IdentityStoreId")
)
instance Prelude.Hashable CreateGroup where
hashWithSalt :: Int -> CreateGroup -> Int
hashWithSalt Int
_salt CreateGroup' {Maybe (Sensitive Text)
Text
identityStoreId :: Text
displayName :: Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:identityStoreId:CreateGroup' :: CreateGroup -> Text
$sel:displayName:CreateGroup' :: CreateGroup -> Maybe (Sensitive Text)
$sel:description:CreateGroup' :: CreateGroup -> Maybe (Sensitive Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
displayName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identityStoreId
instance Prelude.NFData CreateGroup where
rnf :: CreateGroup -> ()
rnf CreateGroup' {Maybe (Sensitive Text)
Text
identityStoreId :: Text
displayName :: Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:identityStoreId:CreateGroup' :: CreateGroup -> Text
$sel:displayName:CreateGroup' :: CreateGroup -> Maybe (Sensitive Text)
$sel:description:CreateGroup' :: CreateGroup -> Maybe (Sensitive Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
displayName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
identityStoreId
instance Data.ToHeaders CreateGroup where
toHeaders :: CreateGroup -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSIdentityStore.CreateGroup" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateGroup where
toJSON :: CreateGroup -> Value
toJSON CreateGroup' {Maybe (Sensitive Text)
Text
identityStoreId :: Text
displayName :: Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:identityStoreId:CreateGroup' :: CreateGroup -> Text
$sel:displayName:CreateGroup' :: CreateGroup -> Maybe (Sensitive Text)
$sel:description:CreateGroup' :: CreateGroup -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Description" 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 (Sensitive Text)
description,
(Key
"DisplayName" 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 (Sensitive Text)
displayName,
forall a. a -> Maybe a
Prelude.Just
(Key
"IdentityStoreId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
identityStoreId)
]
)
instance Data.ToPath CreateGroup where
toPath :: CreateGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateGroup where
toQuery :: CreateGroup -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateGroupResponse = CreateGroupResponse'
{
CreateGroupResponse -> Int
httpStatus :: Prelude.Int,
CreateGroupResponse -> Text
groupId :: Prelude.Text,
CreateGroupResponse -> Text
identityStoreId :: Prelude.Text
}
deriving (CreateGroupResponse -> CreateGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGroupResponse -> CreateGroupResponse -> Bool
$c/= :: CreateGroupResponse -> CreateGroupResponse -> Bool
== :: CreateGroupResponse -> CreateGroupResponse -> Bool
$c== :: CreateGroupResponse -> CreateGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateGroupResponse]
ReadPrec CreateGroupResponse
Int -> ReadS CreateGroupResponse
ReadS [CreateGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGroupResponse]
$creadListPrec :: ReadPrec [CreateGroupResponse]
readPrec :: ReadPrec CreateGroupResponse
$creadPrec :: ReadPrec CreateGroupResponse
readList :: ReadS [CreateGroupResponse]
$creadList :: ReadS [CreateGroupResponse]
readsPrec :: Int -> ReadS CreateGroupResponse
$creadsPrec :: Int -> ReadS CreateGroupResponse
Prelude.Read, Int -> CreateGroupResponse -> ShowS
[CreateGroupResponse] -> ShowS
CreateGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGroupResponse] -> ShowS
$cshowList :: [CreateGroupResponse] -> ShowS
show :: CreateGroupResponse -> String
$cshow :: CreateGroupResponse -> String
showsPrec :: Int -> CreateGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateGroupResponse -> ShowS
Prelude.Show, forall x. Rep CreateGroupResponse x -> CreateGroupResponse
forall x. CreateGroupResponse -> Rep CreateGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGroupResponse x -> CreateGroupResponse
$cfrom :: forall x. CreateGroupResponse -> Rep CreateGroupResponse x
Prelude.Generic)
newCreateGroupResponse ::
Prelude.Int ->
Prelude.Text ->
Prelude.Text ->
CreateGroupResponse
newCreateGroupResponse :: Int -> Text -> Text -> CreateGroupResponse
newCreateGroupResponse
Int
pHttpStatus_
Text
pGroupId_
Text
pIdentityStoreId_ =
CreateGroupResponse'
{ $sel:httpStatus:CreateGroupResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:groupId:CreateGroupResponse' :: Text
groupId = Text
pGroupId_,
$sel:identityStoreId:CreateGroupResponse' :: Text
identityStoreId = Text
pIdentityStoreId_
}
createGroupResponse_httpStatus :: Lens.Lens' CreateGroupResponse Prelude.Int
createGroupResponse_httpStatus :: Lens' CreateGroupResponse Int
createGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateGroupResponse' :: CreateGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateGroupResponse
s@CreateGroupResponse' {} Int
a -> CreateGroupResponse
s {$sel:httpStatus:CreateGroupResponse' :: Int
httpStatus = Int
a} :: CreateGroupResponse)
createGroupResponse_groupId :: Lens.Lens' CreateGroupResponse Prelude.Text
createGroupResponse_groupId :: Lens' CreateGroupResponse Text
createGroupResponse_groupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupResponse' {Text
groupId :: Text
$sel:groupId:CreateGroupResponse' :: CreateGroupResponse -> Text
groupId} -> Text
groupId) (\s :: CreateGroupResponse
s@CreateGroupResponse' {} Text
a -> CreateGroupResponse
s {$sel:groupId:CreateGroupResponse' :: Text
groupId = Text
a} :: CreateGroupResponse)
createGroupResponse_identityStoreId :: Lens.Lens' CreateGroupResponse Prelude.Text
createGroupResponse_identityStoreId :: Lens' CreateGroupResponse Text
createGroupResponse_identityStoreId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGroupResponse' {Text
identityStoreId :: Text
$sel:identityStoreId:CreateGroupResponse' :: CreateGroupResponse -> Text
identityStoreId} -> Text
identityStoreId) (\s :: CreateGroupResponse
s@CreateGroupResponse' {} Text
a -> CreateGroupResponse
s {$sel:identityStoreId:CreateGroupResponse' :: Text
identityStoreId = Text
a} :: CreateGroupResponse)
instance Prelude.NFData CreateGroupResponse where
rnf :: CreateGroupResponse -> ()
rnf CreateGroupResponse' {Int
Text
identityStoreId :: Text
groupId :: Text
httpStatus :: Int
$sel:identityStoreId:CreateGroupResponse' :: CreateGroupResponse -> Text
$sel:groupId:CreateGroupResponse' :: CreateGroupResponse -> Text
$sel:httpStatus:CreateGroupResponse' :: CreateGroupResponse -> 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
groupId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
identityStoreId