{-# 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.Lens as Lens
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
(BatchUnsuspendUser -> BatchUnsuspendUser -> Bool)
-> (BatchUnsuspendUser -> BatchUnsuspendUser -> Bool)
-> Eq BatchUnsuspendUser
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]
(Int -> ReadS BatchUnsuspendUser)
-> ReadS [BatchUnsuspendUser]
-> ReadPrec BatchUnsuspendUser
-> ReadPrec [BatchUnsuspendUser]
-> Read 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
(Int -> BatchUnsuspendUser -> ShowS)
-> (BatchUnsuspendUser -> String)
-> ([BatchUnsuspendUser] -> ShowS)
-> Show BatchUnsuspendUser
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. BatchUnsuspendUser -> Rep BatchUnsuspendUser x)
-> (forall x. Rep BatchUnsuspendUser x -> BatchUnsuspendUser)
-> Generic BatchUnsuspendUser
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' :: Text -> [Text] -> BatchUnsuspendUser
BatchUnsuspendUser'
{ $sel:accountId:BatchUnsuspendUser' :: Text
accountId = Text
pAccountId_,
$sel:userIdList:BatchUnsuspendUser' :: [Text]
userIdList = [Text]
forall a. Monoid a => a
Prelude.mempty
}
batchUnsuspendUser_accountId :: Lens.Lens' BatchUnsuspendUser Prelude.Text
batchUnsuspendUser_accountId :: (Text -> f Text) -> BatchUnsuspendUser -> f BatchUnsuspendUser
batchUnsuspendUser_accountId = (BatchUnsuspendUser -> Text)
-> (BatchUnsuspendUser -> Text -> BatchUnsuspendUser)
-> Lens BatchUnsuspendUser BatchUnsuspendUser Text Text
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 :: ([Text] -> f [Text]) -> BatchUnsuspendUser -> f BatchUnsuspendUser
batchUnsuspendUser_userIdList = (BatchUnsuspendUser -> [Text])
-> (BatchUnsuspendUser -> [Text] -> BatchUnsuspendUser)
-> Lens BatchUnsuspendUser BatchUnsuspendUser [Text] [Text]
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) (([Text] -> f [Text])
-> BatchUnsuspendUser -> f BatchUnsuspendUser)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> BatchUnsuspendUser
-> f BatchUnsuspendUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
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 :: BatchUnsuspendUser -> Request BatchUnsuspendUser
request = Service -> BatchUnsuspendUser -> Request BatchUnsuspendUser
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchUnsuspendUser
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchUnsuspendUser)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchUnsuspendUser))
-> Logger
-> Service
-> Proxy BatchUnsuspendUser
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchUnsuspendUser)))
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 [UserError] -> Int -> BatchUnsuspendUserResponse
BatchUnsuspendUserResponse'
(Maybe [UserError] -> Int -> BatchUnsuspendUserResponse)
-> Either String (Maybe [UserError])
-> Either String (Int -> BatchUnsuspendUserResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [UserError]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UserErrors" Either String (Maybe (Maybe [UserError]))
-> Maybe [UserError] -> Either String (Maybe [UserError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [UserError]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> BatchUnsuspendUserResponse)
-> Either String Int -> Either String BatchUnsuspendUserResponse
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 BatchUnsuspendUser
instance Prelude.NFData BatchUnsuspendUser
instance Core.ToHeaders BatchUnsuspendUser where
toHeaders :: BatchUnsuspendUser -> ResponseHeaders
toHeaders = ResponseHeaders -> BatchUnsuspendUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserIdList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
userIdList)]
)
instance Core.ToPath BatchUnsuspendUser where
toPath :: BatchUnsuspendUser -> ByteString
toPath BatchUnsuspendUser' {[Text]
Text
userIdList :: [Text]
accountId :: Text
$sel:userIdList:BatchUnsuspendUser' :: BatchUnsuspendUser -> [Text]
$sel:accountId:BatchUnsuspendUser' :: BatchUnsuspendUser -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/accounts/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId, ByteString
"/users"]
instance Core.ToQuery BatchUnsuspendUser where
toQuery :: BatchUnsuspendUser -> QueryString
toQuery =
QueryString -> BatchUnsuspendUser -> QueryString
forall a b. a -> b -> a
Prelude.const
([QueryString] -> QueryString
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
(BatchUnsuspendUserResponse -> BatchUnsuspendUserResponse -> Bool)
-> (BatchUnsuspendUserResponse
-> BatchUnsuspendUserResponse -> Bool)
-> Eq BatchUnsuspendUserResponse
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]
(Int -> ReadS BatchUnsuspendUserResponse)
-> ReadS [BatchUnsuspendUserResponse]
-> ReadPrec BatchUnsuspendUserResponse
-> ReadPrec [BatchUnsuspendUserResponse]
-> Read 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
(Int -> BatchUnsuspendUserResponse -> ShowS)
-> (BatchUnsuspendUserResponse -> String)
-> ([BatchUnsuspendUserResponse] -> ShowS)
-> Show BatchUnsuspendUserResponse
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.
BatchUnsuspendUserResponse -> Rep BatchUnsuspendUserResponse x)
-> (forall x.
Rep BatchUnsuspendUserResponse x -> BatchUnsuspendUserResponse)
-> Generic BatchUnsuspendUserResponse
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' :: Maybe [UserError] -> Int -> BatchUnsuspendUserResponse
BatchUnsuspendUserResponse'
{ $sel:userErrors:BatchUnsuspendUserResponse' :: Maybe [UserError]
userErrors =
Maybe [UserError]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchUnsuspendUserResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchUnsuspendUserResponse_userErrors :: Lens.Lens' BatchUnsuspendUserResponse (Prelude.Maybe [UserError])
batchUnsuspendUserResponse_userErrors :: (Maybe [UserError] -> f (Maybe [UserError]))
-> BatchUnsuspendUserResponse -> f BatchUnsuspendUserResponse
batchUnsuspendUserResponse_userErrors = (BatchUnsuspendUserResponse -> Maybe [UserError])
-> (BatchUnsuspendUserResponse
-> Maybe [UserError] -> BatchUnsuspendUserResponse)
-> Lens
BatchUnsuspendUserResponse
BatchUnsuspendUserResponse
(Maybe [UserError])
(Maybe [UserError])
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) ((Maybe [UserError] -> f (Maybe [UserError]))
-> BatchUnsuspendUserResponse -> f BatchUnsuspendUserResponse)
-> ((Maybe [UserError] -> f (Maybe [UserError]))
-> Maybe [UserError] -> f (Maybe [UserError]))
-> (Maybe [UserError] -> f (Maybe [UserError]))
-> BatchUnsuspendUserResponse
-> f BatchUnsuspendUserResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [UserError] [UserError] [UserError] [UserError]
-> Iso
(Maybe [UserError])
(Maybe [UserError])
(Maybe [UserError])
(Maybe [UserError])
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 [UserError] [UserError] [UserError] [UserError]
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 :: (Int -> f Int)
-> BatchUnsuspendUserResponse -> f BatchUnsuspendUserResponse
batchUnsuspendUserResponse_httpStatus = (BatchUnsuspendUserResponse -> Int)
-> (BatchUnsuspendUserResponse
-> Int -> BatchUnsuspendUserResponse)
-> Lens
BatchUnsuspendUserResponse BatchUnsuspendUserResponse Int Int
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