{-# 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.BatchUpdateUser
(
BatchUpdateUser (..),
newBatchUpdateUser,
batchUpdateUser_accountId,
batchUpdateUser_updateUserRequestItems,
BatchUpdateUserResponse (..),
newBatchUpdateUserResponse,
batchUpdateUserResponse_userErrors,
batchUpdateUserResponse_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 BatchUpdateUser = BatchUpdateUser'
{
BatchUpdateUser -> Text
accountId :: Prelude.Text,
BatchUpdateUser -> [UpdateUserRequestItem]
updateUserRequestItems :: [UpdateUserRequestItem]
}
deriving (BatchUpdateUser -> BatchUpdateUser -> Bool
(BatchUpdateUser -> BatchUpdateUser -> Bool)
-> (BatchUpdateUser -> BatchUpdateUser -> Bool)
-> Eq BatchUpdateUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateUser -> BatchUpdateUser -> Bool
$c/= :: BatchUpdateUser -> BatchUpdateUser -> Bool
== :: BatchUpdateUser -> BatchUpdateUser -> Bool
$c== :: BatchUpdateUser -> BatchUpdateUser -> Bool
Prelude.Eq, Int -> BatchUpdateUser -> ShowS
[BatchUpdateUser] -> ShowS
BatchUpdateUser -> String
(Int -> BatchUpdateUser -> ShowS)
-> (BatchUpdateUser -> String)
-> ([BatchUpdateUser] -> ShowS)
-> Show BatchUpdateUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateUser] -> ShowS
$cshowList :: [BatchUpdateUser] -> ShowS
show :: BatchUpdateUser -> String
$cshow :: BatchUpdateUser -> String
showsPrec :: Int -> BatchUpdateUser -> ShowS
$cshowsPrec :: Int -> BatchUpdateUser -> ShowS
Prelude.Show, (forall x. BatchUpdateUser -> Rep BatchUpdateUser x)
-> (forall x. Rep BatchUpdateUser x -> BatchUpdateUser)
-> Generic BatchUpdateUser
forall x. Rep BatchUpdateUser x -> BatchUpdateUser
forall x. BatchUpdateUser -> Rep BatchUpdateUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchUpdateUser x -> BatchUpdateUser
$cfrom :: forall x. BatchUpdateUser -> Rep BatchUpdateUser x
Prelude.Generic)
newBatchUpdateUser ::
Prelude.Text ->
BatchUpdateUser
newBatchUpdateUser :: Text -> BatchUpdateUser
newBatchUpdateUser Text
pAccountId_ =
BatchUpdateUser' :: Text -> [UpdateUserRequestItem] -> BatchUpdateUser
BatchUpdateUser'
{ $sel:accountId:BatchUpdateUser' :: Text
accountId = Text
pAccountId_,
$sel:updateUserRequestItems:BatchUpdateUser' :: [UpdateUserRequestItem]
updateUserRequestItems = [UpdateUserRequestItem]
forall a. Monoid a => a
Prelude.mempty
}
batchUpdateUser_accountId :: Lens.Lens' BatchUpdateUser Prelude.Text
batchUpdateUser_accountId :: (Text -> f Text) -> BatchUpdateUser -> f BatchUpdateUser
batchUpdateUser_accountId = (BatchUpdateUser -> Text)
-> (BatchUpdateUser -> Text -> BatchUpdateUser)
-> Lens BatchUpdateUser BatchUpdateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateUser' {Text
accountId :: Text
$sel:accountId:BatchUpdateUser' :: BatchUpdateUser -> Text
accountId} -> Text
accountId) (\s :: BatchUpdateUser
s@BatchUpdateUser' {} Text
a -> BatchUpdateUser
s {$sel:accountId:BatchUpdateUser' :: Text
accountId = Text
a} :: BatchUpdateUser)
batchUpdateUser_updateUserRequestItems :: Lens.Lens' BatchUpdateUser [UpdateUserRequestItem]
batchUpdateUser_updateUserRequestItems :: ([UpdateUserRequestItem] -> f [UpdateUserRequestItem])
-> BatchUpdateUser -> f BatchUpdateUser
batchUpdateUser_updateUserRequestItems = (BatchUpdateUser -> [UpdateUserRequestItem])
-> (BatchUpdateUser -> [UpdateUserRequestItem] -> BatchUpdateUser)
-> Lens
BatchUpdateUser
BatchUpdateUser
[UpdateUserRequestItem]
[UpdateUserRequestItem]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateUser' {[UpdateUserRequestItem]
updateUserRequestItems :: [UpdateUserRequestItem]
$sel:updateUserRequestItems:BatchUpdateUser' :: BatchUpdateUser -> [UpdateUserRequestItem]
updateUserRequestItems} -> [UpdateUserRequestItem]
updateUserRequestItems) (\s :: BatchUpdateUser
s@BatchUpdateUser' {} [UpdateUserRequestItem]
a -> BatchUpdateUser
s {$sel:updateUserRequestItems:BatchUpdateUser' :: [UpdateUserRequestItem]
updateUserRequestItems = [UpdateUserRequestItem]
a} :: BatchUpdateUser) (([UpdateUserRequestItem] -> f [UpdateUserRequestItem])
-> BatchUpdateUser -> f BatchUpdateUser)
-> (([UpdateUserRequestItem] -> f [UpdateUserRequestItem])
-> [UpdateUserRequestItem] -> f [UpdateUserRequestItem])
-> ([UpdateUserRequestItem] -> f [UpdateUserRequestItem])
-> BatchUpdateUser
-> f BatchUpdateUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([UpdateUserRequestItem] -> f [UpdateUserRequestItem])
-> [UpdateUserRequestItem] -> f [UpdateUserRequestItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchUpdateUser where
type
AWSResponse BatchUpdateUser =
BatchUpdateUserResponse
request :: BatchUpdateUser -> Request BatchUpdateUser
request = Service -> BatchUpdateUser -> Request BatchUpdateUser
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchUpdateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchUpdateUser)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchUpdateUser))
-> Logger
-> Service
-> Proxy BatchUpdateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchUpdateUser)))
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 -> BatchUpdateUserResponse
BatchUpdateUserResponse'
(Maybe [UserError] -> Int -> BatchUpdateUserResponse)
-> Either String (Maybe [UserError])
-> Either String (Int -> BatchUpdateUserResponse)
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 -> BatchUpdateUserResponse)
-> Either String Int -> Either String BatchUpdateUserResponse
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 BatchUpdateUser
instance Prelude.NFData BatchUpdateUser
instance Core.ToHeaders BatchUpdateUser where
toHeaders :: BatchUpdateUser -> ResponseHeaders
toHeaders = ResponseHeaders -> BatchUpdateUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON BatchUpdateUser where
toJSON :: BatchUpdateUser -> Value
toJSON BatchUpdateUser' {[UpdateUserRequestItem]
Text
updateUserRequestItems :: [UpdateUserRequestItem]
accountId :: Text
$sel:updateUserRequestItems:BatchUpdateUser' :: BatchUpdateUser -> [UpdateUserRequestItem]
$sel:accountId:BatchUpdateUser' :: BatchUpdateUser -> 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
"UpdateUserRequestItems"
Text -> [UpdateUserRequestItem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [UpdateUserRequestItem]
updateUserRequestItems
)
]
)
instance Core.ToPath BatchUpdateUser where
toPath :: BatchUpdateUser -> ByteString
toPath BatchUpdateUser' {[UpdateUserRequestItem]
Text
updateUserRequestItems :: [UpdateUserRequestItem]
accountId :: Text
$sel:updateUserRequestItems:BatchUpdateUser' :: BatchUpdateUser -> [UpdateUserRequestItem]
$sel:accountId:BatchUpdateUser' :: BatchUpdateUser -> 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 BatchUpdateUser where
toQuery :: BatchUpdateUser -> QueryString
toQuery = QueryString -> BatchUpdateUser -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchUpdateUserResponse = BatchUpdateUserResponse'
{
BatchUpdateUserResponse -> Maybe [UserError]
userErrors :: Prelude.Maybe [UserError],
BatchUpdateUserResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchUpdateUserResponse -> BatchUpdateUserResponse -> Bool
(BatchUpdateUserResponse -> BatchUpdateUserResponse -> Bool)
-> (BatchUpdateUserResponse -> BatchUpdateUserResponse -> Bool)
-> Eq BatchUpdateUserResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdateUserResponse -> BatchUpdateUserResponse -> Bool
$c/= :: BatchUpdateUserResponse -> BatchUpdateUserResponse -> Bool
== :: BatchUpdateUserResponse -> BatchUpdateUserResponse -> Bool
$c== :: BatchUpdateUserResponse -> BatchUpdateUserResponse -> Bool
Prelude.Eq, ReadPrec [BatchUpdateUserResponse]
ReadPrec BatchUpdateUserResponse
Int -> ReadS BatchUpdateUserResponse
ReadS [BatchUpdateUserResponse]
(Int -> ReadS BatchUpdateUserResponse)
-> ReadS [BatchUpdateUserResponse]
-> ReadPrec BatchUpdateUserResponse
-> ReadPrec [BatchUpdateUserResponse]
-> Read BatchUpdateUserResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdateUserResponse]
$creadListPrec :: ReadPrec [BatchUpdateUserResponse]
readPrec :: ReadPrec BatchUpdateUserResponse
$creadPrec :: ReadPrec BatchUpdateUserResponse
readList :: ReadS [BatchUpdateUserResponse]
$creadList :: ReadS [BatchUpdateUserResponse]
readsPrec :: Int -> ReadS BatchUpdateUserResponse
$creadsPrec :: Int -> ReadS BatchUpdateUserResponse
Prelude.Read, Int -> BatchUpdateUserResponse -> ShowS
[BatchUpdateUserResponse] -> ShowS
BatchUpdateUserResponse -> String
(Int -> BatchUpdateUserResponse -> ShowS)
-> (BatchUpdateUserResponse -> String)
-> ([BatchUpdateUserResponse] -> ShowS)
-> Show BatchUpdateUserResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdateUserResponse] -> ShowS
$cshowList :: [BatchUpdateUserResponse] -> ShowS
show :: BatchUpdateUserResponse -> String
$cshow :: BatchUpdateUserResponse -> String
showsPrec :: Int -> BatchUpdateUserResponse -> ShowS
$cshowsPrec :: Int -> BatchUpdateUserResponse -> ShowS
Prelude.Show, (forall x.
BatchUpdateUserResponse -> Rep BatchUpdateUserResponse x)
-> (forall x.
Rep BatchUpdateUserResponse x -> BatchUpdateUserResponse)
-> Generic BatchUpdateUserResponse
forall x. Rep BatchUpdateUserResponse x -> BatchUpdateUserResponse
forall x. BatchUpdateUserResponse -> Rep BatchUpdateUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchUpdateUserResponse x -> BatchUpdateUserResponse
$cfrom :: forall x. BatchUpdateUserResponse -> Rep BatchUpdateUserResponse x
Prelude.Generic)
newBatchUpdateUserResponse ::
Prelude.Int ->
BatchUpdateUserResponse
newBatchUpdateUserResponse :: Int -> BatchUpdateUserResponse
newBatchUpdateUserResponse Int
pHttpStatus_ =
BatchUpdateUserResponse' :: Maybe [UserError] -> Int -> BatchUpdateUserResponse
BatchUpdateUserResponse'
{ $sel:userErrors:BatchUpdateUserResponse' :: Maybe [UserError]
userErrors =
Maybe [UserError]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchUpdateUserResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchUpdateUserResponse_userErrors :: Lens.Lens' BatchUpdateUserResponse (Prelude.Maybe [UserError])
batchUpdateUserResponse_userErrors :: (Maybe [UserError] -> f (Maybe [UserError]))
-> BatchUpdateUserResponse -> f BatchUpdateUserResponse
batchUpdateUserResponse_userErrors = (BatchUpdateUserResponse -> Maybe [UserError])
-> (BatchUpdateUserResponse
-> Maybe [UserError] -> BatchUpdateUserResponse)
-> Lens
BatchUpdateUserResponse
BatchUpdateUserResponse
(Maybe [UserError])
(Maybe [UserError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateUserResponse' {Maybe [UserError]
userErrors :: Maybe [UserError]
$sel:userErrors:BatchUpdateUserResponse' :: BatchUpdateUserResponse -> Maybe [UserError]
userErrors} -> Maybe [UserError]
userErrors) (\s :: BatchUpdateUserResponse
s@BatchUpdateUserResponse' {} Maybe [UserError]
a -> BatchUpdateUserResponse
s {$sel:userErrors:BatchUpdateUserResponse' :: Maybe [UserError]
userErrors = Maybe [UserError]
a} :: BatchUpdateUserResponse) ((Maybe [UserError] -> f (Maybe [UserError]))
-> BatchUpdateUserResponse -> f BatchUpdateUserResponse)
-> ((Maybe [UserError] -> f (Maybe [UserError]))
-> Maybe [UserError] -> f (Maybe [UserError]))
-> (Maybe [UserError] -> f (Maybe [UserError]))
-> BatchUpdateUserResponse
-> f BatchUpdateUserResponse
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
batchUpdateUserResponse_httpStatus :: Lens.Lens' BatchUpdateUserResponse Prelude.Int
batchUpdateUserResponse_httpStatus :: (Int -> f Int)
-> BatchUpdateUserResponse -> f BatchUpdateUserResponse
batchUpdateUserResponse_httpStatus = (BatchUpdateUserResponse -> Int)
-> (BatchUpdateUserResponse -> Int -> BatchUpdateUserResponse)
-> Lens BatchUpdateUserResponse BatchUpdateUserResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdateUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchUpdateUserResponse' :: BatchUpdateUserResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchUpdateUserResponse
s@BatchUpdateUserResponse' {} Int
a -> BatchUpdateUserResponse
s {$sel:httpStatus:BatchUpdateUserResponse' :: Int
httpStatus = Int
a} :: BatchUpdateUserResponse)
instance Prelude.NFData BatchUpdateUserResponse