{-# 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.ModifyUserGroup
(
ModifyUserGroup (..),
newModifyUserGroup,
modifyUserGroup_userIdsToAdd,
modifyUserGroup_userIdsToRemove,
modifyUserGroup_userGroupId,
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 ModifyUserGroup = ModifyUserGroup'
{
ModifyUserGroup -> Maybe (NonEmpty Text)
userIdsToAdd :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
ModifyUserGroup -> Maybe (NonEmpty Text)
userIdsToRemove :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
ModifyUserGroup -> Text
userGroupId :: Prelude.Text
}
deriving (ModifyUserGroup -> ModifyUserGroup -> Bool
(ModifyUserGroup -> ModifyUserGroup -> Bool)
-> (ModifyUserGroup -> ModifyUserGroup -> Bool)
-> Eq ModifyUserGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyUserGroup -> ModifyUserGroup -> Bool
$c/= :: ModifyUserGroup -> ModifyUserGroup -> Bool
== :: ModifyUserGroup -> ModifyUserGroup -> Bool
$c== :: ModifyUserGroup -> ModifyUserGroup -> Bool
Prelude.Eq, ReadPrec [ModifyUserGroup]
ReadPrec ModifyUserGroup
Int -> ReadS ModifyUserGroup
ReadS [ModifyUserGroup]
(Int -> ReadS ModifyUserGroup)
-> ReadS [ModifyUserGroup]
-> ReadPrec ModifyUserGroup
-> ReadPrec [ModifyUserGroup]
-> Read ModifyUserGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyUserGroup]
$creadListPrec :: ReadPrec [ModifyUserGroup]
readPrec :: ReadPrec ModifyUserGroup
$creadPrec :: ReadPrec ModifyUserGroup
readList :: ReadS [ModifyUserGroup]
$creadList :: ReadS [ModifyUserGroup]
readsPrec :: Int -> ReadS ModifyUserGroup
$creadsPrec :: Int -> ReadS ModifyUserGroup
Prelude.Read, Int -> ModifyUserGroup -> ShowS
[ModifyUserGroup] -> ShowS
ModifyUserGroup -> String
(Int -> ModifyUserGroup -> ShowS)
-> (ModifyUserGroup -> String)
-> ([ModifyUserGroup] -> ShowS)
-> Show ModifyUserGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyUserGroup] -> ShowS
$cshowList :: [ModifyUserGroup] -> ShowS
show :: ModifyUserGroup -> String
$cshow :: ModifyUserGroup -> String
showsPrec :: Int -> ModifyUserGroup -> ShowS
$cshowsPrec :: Int -> ModifyUserGroup -> ShowS
Prelude.Show, (forall x. ModifyUserGroup -> Rep ModifyUserGroup x)
-> (forall x. Rep ModifyUserGroup x -> ModifyUserGroup)
-> Generic ModifyUserGroup
forall x. Rep ModifyUserGroup x -> ModifyUserGroup
forall x. ModifyUserGroup -> Rep ModifyUserGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyUserGroup x -> ModifyUserGroup
$cfrom :: forall x. ModifyUserGroup -> Rep ModifyUserGroup x
Prelude.Generic)
newModifyUserGroup ::
Prelude.Text ->
ModifyUserGroup
newModifyUserGroup :: Text -> ModifyUserGroup
newModifyUserGroup Text
pUserGroupId_ =
ModifyUserGroup' :: Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text) -> Text -> ModifyUserGroup
ModifyUserGroup'
{ $sel:userIdsToAdd:ModifyUserGroup' :: Maybe (NonEmpty Text)
userIdsToAdd = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:userIdsToRemove:ModifyUserGroup' :: Maybe (NonEmpty Text)
userIdsToRemove = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:userGroupId:ModifyUserGroup' :: Text
userGroupId = Text
pUserGroupId_
}
modifyUserGroup_userIdsToAdd :: Lens.Lens' ModifyUserGroup (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
modifyUserGroup_userIdsToAdd :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ModifyUserGroup -> f ModifyUserGroup
modifyUserGroup_userIdsToAdd = (ModifyUserGroup -> Maybe (NonEmpty Text))
-> (ModifyUserGroup -> Maybe (NonEmpty Text) -> ModifyUserGroup)
-> Lens
ModifyUserGroup
ModifyUserGroup
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyUserGroup' {Maybe (NonEmpty Text)
userIdsToAdd :: Maybe (NonEmpty Text)
$sel:userIdsToAdd:ModifyUserGroup' :: ModifyUserGroup -> Maybe (NonEmpty Text)
userIdsToAdd} -> Maybe (NonEmpty Text)
userIdsToAdd) (\s :: ModifyUserGroup
s@ModifyUserGroup' {} Maybe (NonEmpty Text)
a -> ModifyUserGroup
s {$sel:userIdsToAdd:ModifyUserGroup' :: Maybe (NonEmpty Text)
userIdsToAdd = Maybe (NonEmpty Text)
a} :: ModifyUserGroup) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ModifyUserGroup -> f ModifyUserGroup)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ModifyUserGroup
-> f ModifyUserGroup
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
modifyUserGroup_userIdsToRemove :: Lens.Lens' ModifyUserGroup (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
modifyUserGroup_userIdsToRemove :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ModifyUserGroup -> f ModifyUserGroup
modifyUserGroup_userIdsToRemove = (ModifyUserGroup -> Maybe (NonEmpty Text))
-> (ModifyUserGroup -> Maybe (NonEmpty Text) -> ModifyUserGroup)
-> Lens
ModifyUserGroup
ModifyUserGroup
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyUserGroup' {Maybe (NonEmpty Text)
userIdsToRemove :: Maybe (NonEmpty Text)
$sel:userIdsToRemove:ModifyUserGroup' :: ModifyUserGroup -> Maybe (NonEmpty Text)
userIdsToRemove} -> Maybe (NonEmpty Text)
userIdsToRemove) (\s :: ModifyUserGroup
s@ModifyUserGroup' {} Maybe (NonEmpty Text)
a -> ModifyUserGroup
s {$sel:userIdsToRemove:ModifyUserGroup' :: Maybe (NonEmpty Text)
userIdsToRemove = Maybe (NonEmpty Text)
a} :: ModifyUserGroup) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ModifyUserGroup -> f ModifyUserGroup)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ModifyUserGroup
-> f ModifyUserGroup
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
modifyUserGroup_userGroupId :: Lens.Lens' ModifyUserGroup Prelude.Text
modifyUserGroup_userGroupId :: (Text -> f Text) -> ModifyUserGroup -> f ModifyUserGroup
modifyUserGroup_userGroupId = (ModifyUserGroup -> Text)
-> (ModifyUserGroup -> Text -> ModifyUserGroup)
-> Lens ModifyUserGroup ModifyUserGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyUserGroup' {Text
userGroupId :: Text
$sel:userGroupId:ModifyUserGroup' :: ModifyUserGroup -> Text
userGroupId} -> Text
userGroupId) (\s :: ModifyUserGroup
s@ModifyUserGroup' {} Text
a -> ModifyUserGroup
s {$sel:userGroupId:ModifyUserGroup' :: Text
userGroupId = Text
a} :: ModifyUserGroup)
instance Core.AWSRequest ModifyUserGroup where
type AWSResponse ModifyUserGroup = UserGroup
request :: ModifyUserGroup -> Request ModifyUserGroup
request = Service -> ModifyUserGroup -> Request ModifyUserGroup
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy ModifyUserGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyUserGroup)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse ModifyUserGroup))
-> Logger
-> Service
-> Proxy ModifyUserGroup
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyUserGroup)))
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
"ModifyUserGroupResult"
(\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 ModifyUserGroup
instance Prelude.NFData ModifyUserGroup
instance Core.ToHeaders ModifyUserGroup where
toHeaders :: ModifyUserGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> ModifyUserGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ModifyUserGroup where
toPath :: ModifyUserGroup -> ByteString
toPath = ByteString -> ModifyUserGroup -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ModifyUserGroup where
toQuery :: ModifyUserGroup -> QueryString
toQuery ModifyUserGroup' {Maybe (NonEmpty Text)
Text
userGroupId :: Text
userIdsToRemove :: Maybe (NonEmpty Text)
userIdsToAdd :: Maybe (NonEmpty Text)
$sel:userGroupId:ModifyUserGroup' :: ModifyUserGroup -> Text
$sel:userIdsToRemove:ModifyUserGroup' :: ModifyUserGroup -> Maybe (NonEmpty Text)
$sel:userIdsToAdd:ModifyUserGroup' :: ModifyUserGroup -> 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
"ModifyUserGroup" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
ByteString
"UserIdsToAdd"
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)
userIdsToAdd),
ByteString
"UserIdsToRemove"
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)
userIdsToRemove
),
ByteString
"UserGroupId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userGroupId
]