{-# 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.Chime.BatchUnsuspendUser
(
BatchUnsuspendUser (..),
newBatchUnsuspendUser,
batchUnsuspendUser_accountId,
batchUnsuspendUser_userIdList,
BatchUnsuspendUserResponse (..),
newBatchUnsuspendUserResponse,
batchUnsuspendUserResponse_userErrors,
batchUnsuspendUserResponse_httpStatus,
)
where
import Amazonka.Chime.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchUnsuspendUser = BatchUnsuspendUser'
{
BatchUnsuspendUser -> Text
accountId :: Prelude.Text,
BatchUnsuspendUser -> [Text]
userIdList :: [Prelude.Text]
}
deriving (BatchUnsuspendUser -> BatchUnsuspendUser -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUnsuspendUser -> BatchUnsuspendUser -> Bool
$c/= :: BatchUnsuspendUser -> BatchUnsuspendUser -> Bool
== :: BatchUnsuspendUser -> BatchUnsuspendUser -> Bool
$c== :: BatchUnsuspendUser -> BatchUnsuspendUser -> Bool
Prelude.Eq, ReadPrec [BatchUnsuspendUser]
ReadPrec BatchUnsuspendUser
Int -> ReadS BatchUnsuspendUser
ReadS [BatchUnsuspendUser]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUnsuspendUser]
$creadListPrec :: ReadPrec [BatchUnsuspendUser]
readPrec :: ReadPrec BatchUnsuspendUser
$creadPrec :: ReadPrec BatchUnsuspendUser
readList :: ReadS [BatchUnsuspendUser]
$creadList :: ReadS [BatchUnsuspendUser]
readsPrec :: Int -> ReadS BatchUnsuspendUser
$creadsPrec :: Int -> ReadS BatchUnsuspendUser
Prelude.Read, Int -> BatchUnsuspendUser -> ShowS
[BatchUnsuspendUser] -> ShowS
BatchUnsuspendUser -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUnsuspendUser] -> ShowS
$cshowList :: [BatchUnsuspendUser] -> ShowS
show :: BatchUnsuspendUser -> String
$cshow :: BatchUnsuspendUser -> String
showsPrec :: Int -> BatchUnsuspendUser -> ShowS
$cshowsPrec :: Int -> BatchUnsuspendUser -> ShowS
Prelude.Show, forall x. Rep BatchUnsuspendUser x -> BatchUnsuspendUser
forall x. BatchUnsuspendUser -> Rep BatchUnsuspendUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchUnsuspendUser x -> BatchUnsuspendUser
$cfrom :: forall x. BatchUnsuspendUser -> Rep BatchUnsuspendUser x
Prelude.Generic)
newBatchUnsuspendUser ::
Prelude.Text ->
BatchUnsuspendUser
newBatchUnsuspendUser :: Text -> BatchUnsuspendUser
newBatchUnsuspendUser Text
pAccountId_ =
BatchUnsuspendUser'
{ $sel:accountId:BatchUnsuspendUser' :: Text
accountId = Text
pAccountId_,
$sel:userIdList:BatchUnsuspendUser' :: [Text]
userIdList = forall a. Monoid a => a
Prelude.mempty
}
batchUnsuspendUser_accountId :: Lens.Lens' BatchUnsuspendUser Prelude.Text
batchUnsuspendUser_accountId :: Lens' BatchUnsuspendUser Text
batchUnsuspendUser_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUnsuspendUser' {Text
accountId :: Text
$sel:accountId:BatchUnsuspendUser' :: BatchUnsuspendUser -> Text
accountId} -> Text
accountId) (\s :: BatchUnsuspendUser
s@BatchUnsuspendUser' {} Text
a -> BatchUnsuspendUser
s {$sel:accountId:BatchUnsuspendUser' :: Text
accountId = Text
a} :: BatchUnsuspendUser)
batchUnsuspendUser_userIdList :: Lens.Lens' BatchUnsuspendUser [Prelude.Text]
batchUnsuspendUser_userIdList :: Lens' BatchUnsuspendUser [Text]
batchUnsuspendUser_userIdList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUnsuspendUser' {[Text]
userIdList :: [Text]
$sel:userIdList:BatchUnsuspendUser' :: BatchUnsuspendUser -> [Text]
userIdList} -> [Text]
userIdList) (\s :: BatchUnsuspendUser
s@BatchUnsuspendUser' {} [Text]
a -> BatchUnsuspendUser
s {$sel:userIdList:BatchUnsuspendUser' :: [Text]
userIdList = [Text]
a} :: BatchUnsuspendUser) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchUnsuspendUser where
type
AWSResponse BatchUnsuspendUser =
BatchUnsuspendUserResponse
request :: (Service -> Service)
-> BatchUnsuspendUser -> Request BatchUnsuspendUser
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 BatchUnsuspendUser
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchUnsuspendUser)))
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 ->
Maybe [UserError] -> Int -> BatchUnsuspendUserResponse
BatchUnsuspendUserResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"UserErrors" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable BatchUnsuspendUser where
hashWithSalt :: Int -> BatchUnsuspendUser -> Int
hashWithSalt Int
_salt BatchUnsuspendUser' {[Text]
Text
userIdList :: [Text]
accountId :: Text
$sel:userIdList:BatchUnsuspendUser' :: BatchUnsuspendUser -> [Text]
$sel:accountId:BatchUnsuspendUser' :: BatchUnsuspendUser -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
userIdList
instance Prelude.NFData BatchUnsuspendUser where
rnf :: BatchUnsuspendUser -> ()
rnf BatchUnsuspendUser' {[Text]
Text
userIdList :: [Text]
accountId :: Text
$sel:userIdList:BatchUnsuspendUser' :: BatchUnsuspendUser -> [Text]
$sel:accountId:BatchUnsuspendUser' :: BatchUnsuspendUser -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
userIdList
instance Data.ToHeaders BatchUnsuspendUser where
toHeaders :: BatchUnsuspendUser -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON BatchUnsuspendUser where
toJSON :: BatchUnsuspendUser -> Value
toJSON BatchUnsuspendUser' {[Text]
Text
userIdList :: [Text]
accountId :: Text
$sel:userIdList:BatchUnsuspendUser' :: BatchUnsuspendUser -> [Text]
$sel:accountId:BatchUnsuspendUser' :: BatchUnsuspendUser -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"UserIdList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
userIdList)]
)
instance Data.ToPath BatchUnsuspendUser where
toPath :: BatchUnsuspendUser -> ByteString
toPath BatchUnsuspendUser' {[Text]
Text
userIdList :: [Text]
accountId :: Text
$sel:userIdList:BatchUnsuspendUser' :: BatchUnsuspendUser -> [Text]
$sel:accountId:BatchUnsuspendUser' :: BatchUnsuspendUser -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/accounts/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
accountId, ByteString
"/users"]
instance Data.ToQuery BatchUnsuspendUser where
toQuery :: BatchUnsuspendUser -> QueryString
toQuery =
forall a b. a -> b -> a
Prelude.const
(forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=unsuspend"])
data BatchUnsuspendUserResponse = BatchUnsuspendUserResponse'
{
BatchUnsuspendUserResponse -> Maybe [UserError]
userErrors :: Prelude.Maybe [UserError],
BatchUnsuspendUserResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchUnsuspendUserResponse -> BatchUnsuspendUserResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUnsuspendUserResponse -> BatchUnsuspendUserResponse -> Bool
$c/= :: BatchUnsuspendUserResponse -> BatchUnsuspendUserResponse -> Bool
== :: BatchUnsuspendUserResponse -> BatchUnsuspendUserResponse -> Bool
$c== :: BatchUnsuspendUserResponse -> BatchUnsuspendUserResponse -> Bool
Prelude.Eq, ReadPrec [BatchUnsuspendUserResponse]
ReadPrec BatchUnsuspendUserResponse
Int -> ReadS BatchUnsuspendUserResponse
ReadS [BatchUnsuspendUserResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUnsuspendUserResponse]
$creadListPrec :: ReadPrec [BatchUnsuspendUserResponse]
readPrec :: ReadPrec BatchUnsuspendUserResponse
$creadPrec :: ReadPrec BatchUnsuspendUserResponse
readList :: ReadS [BatchUnsuspendUserResponse]
$creadList :: ReadS [BatchUnsuspendUserResponse]
readsPrec :: Int -> ReadS BatchUnsuspendUserResponse
$creadsPrec :: Int -> ReadS BatchUnsuspendUserResponse
Prelude.Read, Int -> BatchUnsuspendUserResponse -> ShowS
[BatchUnsuspendUserResponse] -> ShowS
BatchUnsuspendUserResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUnsuspendUserResponse] -> ShowS
$cshowList :: [BatchUnsuspendUserResponse] -> ShowS
show :: BatchUnsuspendUserResponse -> String
$cshow :: BatchUnsuspendUserResponse -> String
showsPrec :: Int -> BatchUnsuspendUserResponse -> ShowS
$cshowsPrec :: Int -> BatchUnsuspendUserResponse -> ShowS
Prelude.Show, forall x.
Rep BatchUnsuspendUserResponse x -> BatchUnsuspendUserResponse
forall x.
BatchUnsuspendUserResponse -> Rep BatchUnsuspendUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUnsuspendUserResponse x -> BatchUnsuspendUserResponse
$cfrom :: forall x.
BatchUnsuspendUserResponse -> Rep BatchUnsuspendUserResponse x
Prelude.Generic)
newBatchUnsuspendUserResponse ::
Prelude.Int ->
BatchUnsuspendUserResponse
newBatchUnsuspendUserResponse :: Int -> BatchUnsuspendUserResponse
newBatchUnsuspendUserResponse Int
pHttpStatus_ =
BatchUnsuspendUserResponse'
{ $sel:userErrors:BatchUnsuspendUserResponse' :: Maybe [UserError]
userErrors =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchUnsuspendUserResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchUnsuspendUserResponse_userErrors :: Lens.Lens' BatchUnsuspendUserResponse (Prelude.Maybe [UserError])
batchUnsuspendUserResponse_userErrors :: Lens' BatchUnsuspendUserResponse (Maybe [UserError])
batchUnsuspendUserResponse_userErrors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUnsuspendUserResponse' {Maybe [UserError]
userErrors :: Maybe [UserError]
$sel:userErrors:BatchUnsuspendUserResponse' :: BatchUnsuspendUserResponse -> Maybe [UserError]
userErrors} -> Maybe [UserError]
userErrors) (\s :: BatchUnsuspendUserResponse
s@BatchUnsuspendUserResponse' {} Maybe [UserError]
a -> BatchUnsuspendUserResponse
s {$sel:userErrors:BatchUnsuspendUserResponse' :: Maybe [UserError]
userErrors = Maybe [UserError]
a} :: BatchUnsuspendUserResponse) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchUnsuspendUserResponse_httpStatus :: Lens.Lens' BatchUnsuspendUserResponse Prelude.Int
batchUnsuspendUserResponse_httpStatus :: Lens' BatchUnsuspendUserResponse Int
batchUnsuspendUserResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUnsuspendUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchUnsuspendUserResponse' :: BatchUnsuspendUserResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchUnsuspendUserResponse
s@BatchUnsuspendUserResponse' {} Int
a -> BatchUnsuspendUserResponse
s {$sel:httpStatus:BatchUnsuspendUserResponse' :: Int
httpStatus = Int
a} :: BatchUnsuspendUserResponse)
instance Prelude.NFData BatchUnsuspendUserResponse where
rnf :: BatchUnsuspendUserResponse -> ()
rnf BatchUnsuspendUserResponse' {Int
Maybe [UserError]
httpStatus :: Int
userErrors :: Maybe [UserError]
$sel:httpStatus:BatchUnsuspendUserResponse' :: BatchUnsuspendUserResponse -> Int
$sel:userErrors:BatchUnsuspendUserResponse' :: BatchUnsuspendUserResponse -> Maybe [UserError]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [UserError]
userErrors
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus