{-# 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.MemoryDb.UpdateACL
(
UpdateACL (..),
newUpdateACL,
updateACL_userNamesToAdd,
updateACL_userNamesToRemove,
updateACL_aCLName,
UpdateACLResponse (..),
newUpdateACLResponse,
updateACLResponse_acl,
updateACLResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MemoryDb.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateACL = UpdateACL'
{
UpdateACL -> Maybe (NonEmpty Text)
userNamesToAdd :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
UpdateACL -> Maybe (NonEmpty Text)
userNamesToRemove :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
UpdateACL -> Text
aCLName :: Prelude.Text
}
deriving (UpdateACL -> UpdateACL -> Bool
(UpdateACL -> UpdateACL -> Bool)
-> (UpdateACL -> UpdateACL -> Bool) -> Eq UpdateACL
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateACL -> UpdateACL -> Bool
$c/= :: UpdateACL -> UpdateACL -> Bool
== :: UpdateACL -> UpdateACL -> Bool
$c== :: UpdateACL -> UpdateACL -> Bool
Prelude.Eq, ReadPrec [UpdateACL]
ReadPrec UpdateACL
Int -> ReadS UpdateACL
ReadS [UpdateACL]
(Int -> ReadS UpdateACL)
-> ReadS [UpdateACL]
-> ReadPrec UpdateACL
-> ReadPrec [UpdateACL]
-> Read UpdateACL
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateACL]
$creadListPrec :: ReadPrec [UpdateACL]
readPrec :: ReadPrec UpdateACL
$creadPrec :: ReadPrec UpdateACL
readList :: ReadS [UpdateACL]
$creadList :: ReadS [UpdateACL]
readsPrec :: Int -> ReadS UpdateACL
$creadsPrec :: Int -> ReadS UpdateACL
Prelude.Read, Int -> UpdateACL -> ShowS
[UpdateACL] -> ShowS
UpdateACL -> String
(Int -> UpdateACL -> ShowS)
-> (UpdateACL -> String)
-> ([UpdateACL] -> ShowS)
-> Show UpdateACL
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateACL] -> ShowS
$cshowList :: [UpdateACL] -> ShowS
show :: UpdateACL -> String
$cshow :: UpdateACL -> String
showsPrec :: Int -> UpdateACL -> ShowS
$cshowsPrec :: Int -> UpdateACL -> ShowS
Prelude.Show, (forall x. UpdateACL -> Rep UpdateACL x)
-> (forall x. Rep UpdateACL x -> UpdateACL) -> Generic UpdateACL
forall x. Rep UpdateACL x -> UpdateACL
forall x. UpdateACL -> Rep UpdateACL x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateACL x -> UpdateACL
$cfrom :: forall x. UpdateACL -> Rep UpdateACL x
Prelude.Generic)
newUpdateACL ::
Prelude.Text ->
UpdateACL
newUpdateACL :: Text -> UpdateACL
newUpdateACL Text
pACLName_ =
UpdateACL' :: Maybe (NonEmpty Text) -> Maybe (NonEmpty Text) -> Text -> UpdateACL
UpdateACL'
{ $sel:userNamesToAdd:UpdateACL' :: Maybe (NonEmpty Text)
userNamesToAdd = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:userNamesToRemove:UpdateACL' :: Maybe (NonEmpty Text)
userNamesToRemove = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:aCLName:UpdateACL' :: Text
aCLName = Text
pACLName_
}
updateACL_userNamesToAdd :: Lens.Lens' UpdateACL (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
updateACL_userNamesToAdd :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> UpdateACL -> f UpdateACL
updateACL_userNamesToAdd = (UpdateACL -> Maybe (NonEmpty Text))
-> (UpdateACL -> Maybe (NonEmpty Text) -> UpdateACL)
-> Lens
UpdateACL UpdateACL (Maybe (NonEmpty Text)) (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateACL' {Maybe (NonEmpty Text)
userNamesToAdd :: Maybe (NonEmpty Text)
$sel:userNamesToAdd:UpdateACL' :: UpdateACL -> Maybe (NonEmpty Text)
userNamesToAdd} -> Maybe (NonEmpty Text)
userNamesToAdd) (\s :: UpdateACL
s@UpdateACL' {} Maybe (NonEmpty Text)
a -> UpdateACL
s {$sel:userNamesToAdd:UpdateACL' :: Maybe (NonEmpty Text)
userNamesToAdd = Maybe (NonEmpty Text)
a} :: UpdateACL) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> UpdateACL -> f UpdateACL)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> UpdateACL
-> f UpdateACL
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
updateACL_userNamesToRemove :: Lens.Lens' UpdateACL (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
updateACL_userNamesToRemove :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> UpdateACL -> f UpdateACL
updateACL_userNamesToRemove = (UpdateACL -> Maybe (NonEmpty Text))
-> (UpdateACL -> Maybe (NonEmpty Text) -> UpdateACL)
-> Lens
UpdateACL UpdateACL (Maybe (NonEmpty Text)) (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateACL' {Maybe (NonEmpty Text)
userNamesToRemove :: Maybe (NonEmpty Text)
$sel:userNamesToRemove:UpdateACL' :: UpdateACL -> Maybe (NonEmpty Text)
userNamesToRemove} -> Maybe (NonEmpty Text)
userNamesToRemove) (\s :: UpdateACL
s@UpdateACL' {} Maybe (NonEmpty Text)
a -> UpdateACL
s {$sel:userNamesToRemove:UpdateACL' :: Maybe (NonEmpty Text)
userNamesToRemove = Maybe (NonEmpty Text)
a} :: UpdateACL) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> UpdateACL -> f UpdateACL)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> UpdateACL
-> f UpdateACL
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
updateACL_aCLName :: Lens.Lens' UpdateACL Prelude.Text
updateACL_aCLName :: (Text -> f Text) -> UpdateACL -> f UpdateACL
updateACL_aCLName = (UpdateACL -> Text)
-> (UpdateACL -> Text -> UpdateACL)
-> Lens UpdateACL UpdateACL Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateACL' {Text
aCLName :: Text
$sel:aCLName:UpdateACL' :: UpdateACL -> Text
aCLName} -> Text
aCLName) (\s :: UpdateACL
s@UpdateACL' {} Text
a -> UpdateACL
s {$sel:aCLName:UpdateACL' :: Text
aCLName = Text
a} :: UpdateACL)
instance Core.AWSRequest UpdateACL where
type AWSResponse UpdateACL = UpdateACLResponse
request :: UpdateACL -> Request UpdateACL
request = Service -> UpdateACL -> Request UpdateACL
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateACL
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateACL)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateACL))
-> Logger
-> Service
-> Proxy UpdateACL
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateACL)))
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 ACL -> Int -> UpdateACLResponse
UpdateACLResponse'
(Maybe ACL -> Int -> UpdateACLResponse)
-> Either String (Maybe ACL)
-> Either String (Int -> UpdateACLResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ACL)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ACL")
Either String (Int -> UpdateACLResponse)
-> Either String Int -> Either String UpdateACLResponse
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 UpdateACL
instance Prelude.NFData UpdateACL
instance Core.ToHeaders UpdateACL where
toHeaders :: UpdateACL -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateACL -> 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
"AmazonMemoryDB.UpdateACL" :: 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 UpdateACL where
toJSON :: UpdateACL -> Value
toJSON UpdateACL' {Maybe (NonEmpty Text)
Text
aCLName :: Text
userNamesToRemove :: Maybe (NonEmpty Text)
userNamesToAdd :: Maybe (NonEmpty Text)
$sel:aCLName:UpdateACL' :: UpdateACL -> Text
$sel:userNamesToRemove:UpdateACL' :: UpdateACL -> Maybe (NonEmpty Text)
$sel:userNamesToAdd:UpdateACL' :: UpdateACL -> Maybe (NonEmpty Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"UserNamesToAdd" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
userNamesToAdd,
(Text
"UserNamesToRemove" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
userNamesToRemove,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ACLName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
aCLName)
]
)
instance Core.ToPath UpdateACL where
toPath :: UpdateACL -> ByteString
toPath = ByteString -> UpdateACL -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateACL where
toQuery :: UpdateACL -> QueryString
toQuery = QueryString -> UpdateACL -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateACLResponse = UpdateACLResponse'
{
UpdateACLResponse -> Maybe ACL
acl :: Prelude.Maybe ACL,
UpdateACLResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateACLResponse -> UpdateACLResponse -> Bool
(UpdateACLResponse -> UpdateACLResponse -> Bool)
-> (UpdateACLResponse -> UpdateACLResponse -> Bool)
-> Eq UpdateACLResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateACLResponse -> UpdateACLResponse -> Bool
$c/= :: UpdateACLResponse -> UpdateACLResponse -> Bool
== :: UpdateACLResponse -> UpdateACLResponse -> Bool
$c== :: UpdateACLResponse -> UpdateACLResponse -> Bool
Prelude.Eq, ReadPrec [UpdateACLResponse]
ReadPrec UpdateACLResponse
Int -> ReadS UpdateACLResponse
ReadS [UpdateACLResponse]
(Int -> ReadS UpdateACLResponse)
-> ReadS [UpdateACLResponse]
-> ReadPrec UpdateACLResponse
-> ReadPrec [UpdateACLResponse]
-> Read UpdateACLResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateACLResponse]
$creadListPrec :: ReadPrec [UpdateACLResponse]
readPrec :: ReadPrec UpdateACLResponse
$creadPrec :: ReadPrec UpdateACLResponse
readList :: ReadS [UpdateACLResponse]
$creadList :: ReadS [UpdateACLResponse]
readsPrec :: Int -> ReadS UpdateACLResponse
$creadsPrec :: Int -> ReadS UpdateACLResponse
Prelude.Read, Int -> UpdateACLResponse -> ShowS
[UpdateACLResponse] -> ShowS
UpdateACLResponse -> String
(Int -> UpdateACLResponse -> ShowS)
-> (UpdateACLResponse -> String)
-> ([UpdateACLResponse] -> ShowS)
-> Show UpdateACLResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateACLResponse] -> ShowS
$cshowList :: [UpdateACLResponse] -> ShowS
show :: UpdateACLResponse -> String
$cshow :: UpdateACLResponse -> String
showsPrec :: Int -> UpdateACLResponse -> ShowS
$cshowsPrec :: Int -> UpdateACLResponse -> ShowS
Prelude.Show, (forall x. UpdateACLResponse -> Rep UpdateACLResponse x)
-> (forall x. Rep UpdateACLResponse x -> UpdateACLResponse)
-> Generic UpdateACLResponse
forall x. Rep UpdateACLResponse x -> UpdateACLResponse
forall x. UpdateACLResponse -> Rep UpdateACLResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateACLResponse x -> UpdateACLResponse
$cfrom :: forall x. UpdateACLResponse -> Rep UpdateACLResponse x
Prelude.Generic)
newUpdateACLResponse ::
Prelude.Int ->
UpdateACLResponse
newUpdateACLResponse :: Int -> UpdateACLResponse
newUpdateACLResponse Int
pHttpStatus_ =
UpdateACLResponse' :: Maybe ACL -> Int -> UpdateACLResponse
UpdateACLResponse'
{ $sel:acl:UpdateACLResponse' :: Maybe ACL
acl = Maybe ACL
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateACLResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateACLResponse_acl :: Lens.Lens' UpdateACLResponse (Prelude.Maybe ACL)
updateACLResponse_acl :: (Maybe ACL -> f (Maybe ACL))
-> UpdateACLResponse -> f UpdateACLResponse
updateACLResponse_acl = (UpdateACLResponse -> Maybe ACL)
-> (UpdateACLResponse -> Maybe ACL -> UpdateACLResponse)
-> Lens UpdateACLResponse UpdateACLResponse (Maybe ACL) (Maybe ACL)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateACLResponse' {Maybe ACL
acl :: Maybe ACL
$sel:acl:UpdateACLResponse' :: UpdateACLResponse -> Maybe ACL
acl} -> Maybe ACL
acl) (\s :: UpdateACLResponse
s@UpdateACLResponse' {} Maybe ACL
a -> UpdateACLResponse
s {$sel:acl:UpdateACLResponse' :: Maybe ACL
acl = Maybe ACL
a} :: UpdateACLResponse)
updateACLResponse_httpStatus :: Lens.Lens' UpdateACLResponse Prelude.Int
updateACLResponse_httpStatus :: (Int -> f Int) -> UpdateACLResponse -> f UpdateACLResponse
updateACLResponse_httpStatus = (UpdateACLResponse -> Int)
-> (UpdateACLResponse -> Int -> UpdateACLResponse)
-> Lens UpdateACLResponse UpdateACLResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateACLResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateACLResponse' :: UpdateACLResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateACLResponse
s@UpdateACLResponse' {} Int
a -> UpdateACLResponse
s {$sel:httpStatus:UpdateACLResponse' :: Int
httpStatus = Int
a} :: UpdateACLResponse)
instance Prelude.NFData UpdateACLResponse