{-# 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.ElastiCache.CreateUserGroup
(
CreateUserGroup (..),
newCreateUserGroup,
createUserGroup_userIds,
createUserGroup_tags,
createUserGroup_userGroupId,
createUserGroup_engine,
UserGroup (..),
newUserGroup,
userGroup_status,
userGroup_userIds,
userGroup_arn,
userGroup_userGroupId,
userGroup_engine,
userGroup_pendingChanges,
userGroup_replicationGroups,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.Types
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 CreateUserGroup = CreateUserGroup'
{
CreateUserGroup -> Maybe (NonEmpty Text)
userIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
CreateUserGroup -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateUserGroup -> Text
userGroupId :: Prelude.Text,
CreateUserGroup -> Text
engine :: Prelude.Text
}
deriving (CreateUserGroup -> CreateUserGroup -> Bool
(CreateUserGroup -> CreateUserGroup -> Bool)
-> (CreateUserGroup -> CreateUserGroup -> Bool)
-> Eq CreateUserGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUserGroup -> CreateUserGroup -> Bool
$c/= :: CreateUserGroup -> CreateUserGroup -> Bool
== :: CreateUserGroup -> CreateUserGroup -> Bool
$c== :: CreateUserGroup -> CreateUserGroup -> Bool
Prelude.Eq, ReadPrec [CreateUserGroup]
ReadPrec CreateUserGroup
Int -> ReadS CreateUserGroup
ReadS [CreateUserGroup]
(Int -> ReadS CreateUserGroup)
-> ReadS [CreateUserGroup]
-> ReadPrec CreateUserGroup
-> ReadPrec [CreateUserGroup]
-> Read CreateUserGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUserGroup]
$creadListPrec :: ReadPrec [CreateUserGroup]
readPrec :: ReadPrec CreateUserGroup
$creadPrec :: ReadPrec CreateUserGroup
readList :: ReadS [CreateUserGroup]
$creadList :: ReadS [CreateUserGroup]
readsPrec :: Int -> ReadS CreateUserGroup
$creadsPrec :: Int -> ReadS CreateUserGroup
Prelude.Read, Int -> CreateUserGroup -> ShowS
[CreateUserGroup] -> ShowS
CreateUserGroup -> String
(Int -> CreateUserGroup -> ShowS)
-> (CreateUserGroup -> String)
-> ([CreateUserGroup] -> ShowS)
-> Show CreateUserGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUserGroup] -> ShowS
$cshowList :: [CreateUserGroup] -> ShowS
show :: CreateUserGroup -> String
$cshow :: CreateUserGroup -> String
showsPrec :: Int -> CreateUserGroup -> ShowS
$cshowsPrec :: Int -> CreateUserGroup -> ShowS
Prelude.Show, (forall x. CreateUserGroup -> Rep CreateUserGroup x)
-> (forall x. Rep CreateUserGroup x -> CreateUserGroup)
-> Generic CreateUserGroup
forall x. Rep CreateUserGroup x -> CreateUserGroup
forall x. CreateUserGroup -> Rep CreateUserGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUserGroup x -> CreateUserGroup
$cfrom :: forall x. CreateUserGroup -> Rep CreateUserGroup x
Prelude.Generic)
newCreateUserGroup ::
Prelude.Text ->
Prelude.Text ->
CreateUserGroup
newCreateUserGroup :: Text -> Text -> CreateUserGroup
newCreateUserGroup Text
pUserGroupId_ Text
pEngine_ =
CreateUserGroup' :: Maybe (NonEmpty Text)
-> Maybe [Tag] -> Text -> Text -> CreateUserGroup
CreateUserGroup'
{ $sel:userIds:CreateUserGroup' :: Maybe (NonEmpty Text)
userIds = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateUserGroup' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:userGroupId:CreateUserGroup' :: Text
userGroupId = Text
pUserGroupId_,
$sel:engine:CreateUserGroup' :: Text
engine = Text
pEngine_
}
createUserGroup_userIds :: Lens.Lens' CreateUserGroup (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
createUserGroup_userIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateUserGroup -> f CreateUserGroup
createUserGroup_userIds = (CreateUserGroup -> Maybe (NonEmpty Text))
-> (CreateUserGroup -> Maybe (NonEmpty Text) -> CreateUserGroup)
-> Lens
CreateUserGroup
CreateUserGroup
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserGroup' {Maybe (NonEmpty Text)
userIds :: Maybe (NonEmpty Text)
$sel:userIds:CreateUserGroup' :: CreateUserGroup -> Maybe (NonEmpty Text)
userIds} -> Maybe (NonEmpty Text)
userIds) (\s :: CreateUserGroup
s@CreateUserGroup' {} Maybe (NonEmpty Text)
a -> CreateUserGroup
s {$sel:userIds:CreateUserGroup' :: Maybe (NonEmpty Text)
userIds = Maybe (NonEmpty Text)
a} :: CreateUserGroup) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateUserGroup -> f CreateUserGroup)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CreateUserGroup
-> f CreateUserGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
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 AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createUserGroup_tags :: Lens.Lens' CreateUserGroup (Prelude.Maybe [Tag])
createUserGroup_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateUserGroup -> f CreateUserGroup
createUserGroup_tags = (CreateUserGroup -> Maybe [Tag])
-> (CreateUserGroup -> Maybe [Tag] -> CreateUserGroup)
-> Lens CreateUserGroup CreateUserGroup (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserGroup' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateUserGroup' :: CreateUserGroup -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateUserGroup
s@CreateUserGroup' {} Maybe [Tag]
a -> CreateUserGroup
s {$sel:tags:CreateUserGroup' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateUserGroup) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateUserGroup -> f CreateUserGroup)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateUserGroup
-> f CreateUserGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createUserGroup_userGroupId :: Lens.Lens' CreateUserGroup Prelude.Text
createUserGroup_userGroupId :: (Text -> f Text) -> CreateUserGroup -> f CreateUserGroup
createUserGroup_userGroupId = (CreateUserGroup -> Text)
-> (CreateUserGroup -> Text -> CreateUserGroup)
-> Lens CreateUserGroup CreateUserGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserGroup' {Text
userGroupId :: Text
$sel:userGroupId:CreateUserGroup' :: CreateUserGroup -> Text
userGroupId} -> Text
userGroupId) (\s :: CreateUserGroup
s@CreateUserGroup' {} Text
a -> CreateUserGroup
s {$sel:userGroupId:CreateUserGroup' :: Text
userGroupId = Text
a} :: CreateUserGroup)
createUserGroup_engine :: Lens.Lens' CreateUserGroup Prelude.Text
createUserGroup_engine :: (Text -> f Text) -> CreateUserGroup -> f CreateUserGroup
createUserGroup_engine = (CreateUserGroup -> Text)
-> (CreateUserGroup -> Text -> CreateUserGroup)
-> Lens CreateUserGroup CreateUserGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUserGroup' {Text
engine :: Text
$sel:engine:CreateUserGroup' :: CreateUserGroup -> Text
engine} -> Text
engine) (\s :: CreateUserGroup
s@CreateUserGroup' {} Text
a -> CreateUserGroup
s {$sel:engine:CreateUserGroup' :: Text
engine = Text
a} :: CreateUserGroup)
instance Core.AWSRequest CreateUserGroup where
type AWSResponse CreateUserGroup = UserGroup
request :: CreateUserGroup -> Request CreateUserGroup
request = Service -> CreateUserGroup -> Request CreateUserGroup
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateUserGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateUserGroup)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateUserGroup))
-> Logger
-> Service
-> Proxy CreateUserGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateUserGroup)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"CreateUserGroupResult"
(\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String UserGroup
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
instance Prelude.Hashable CreateUserGroup
instance Prelude.NFData CreateUserGroup
instance Core.ToHeaders CreateUserGroup where
toHeaders :: CreateUserGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateUserGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateUserGroup where
toPath :: CreateUserGroup -> ByteString
toPath = ByteString -> CreateUserGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateUserGroup where
toQuery :: CreateUserGroup -> QueryString
toQuery CreateUserGroup' {Maybe [Tag]
Maybe (NonEmpty Text)
Text
engine :: Text
userGroupId :: Text
tags :: Maybe [Tag]
userIds :: Maybe (NonEmpty Text)
$sel:engine:CreateUserGroup' :: CreateUserGroup -> Text
$sel:userGroupId:CreateUserGroup' :: CreateUserGroup -> Text
$sel:tags:CreateUserGroup' :: CreateUserGroup -> Maybe [Tag]
$sel:userIds:CreateUserGroup' :: CreateUserGroup -> Maybe (NonEmpty Text)
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateUserGroup" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
ByteString
"UserIds"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> NonEmpty Text -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" (NonEmpty Text -> QueryString)
-> Maybe (NonEmpty Text) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
userIds),
ByteString
"Tags"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Tag" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
ByteString
"UserGroupId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userGroupId,
ByteString
"Engine" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
engine
]