{-# 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.BatchUpdatePhoneNumber
(
BatchUpdatePhoneNumber (..),
newBatchUpdatePhoneNumber,
batchUpdatePhoneNumber_updatePhoneNumberRequestItems,
BatchUpdatePhoneNumberResponse (..),
newBatchUpdatePhoneNumberResponse,
batchUpdatePhoneNumberResponse_phoneNumberErrors,
batchUpdatePhoneNumberResponse_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 BatchUpdatePhoneNumber = BatchUpdatePhoneNumber'
{
BatchUpdatePhoneNumber -> [UpdatePhoneNumberRequestItem]
updatePhoneNumberRequestItems :: [UpdatePhoneNumberRequestItem]
}
deriving (BatchUpdatePhoneNumber -> BatchUpdatePhoneNumber -> Bool
(BatchUpdatePhoneNumber -> BatchUpdatePhoneNumber -> Bool)
-> (BatchUpdatePhoneNumber -> BatchUpdatePhoneNumber -> Bool)
-> Eq BatchUpdatePhoneNumber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdatePhoneNumber -> BatchUpdatePhoneNumber -> Bool
$c/= :: BatchUpdatePhoneNumber -> BatchUpdatePhoneNumber -> Bool
== :: BatchUpdatePhoneNumber -> BatchUpdatePhoneNumber -> Bool
$c== :: BatchUpdatePhoneNumber -> BatchUpdatePhoneNumber -> Bool
Prelude.Eq, Int -> BatchUpdatePhoneNumber -> ShowS
[BatchUpdatePhoneNumber] -> ShowS
BatchUpdatePhoneNumber -> String
(Int -> BatchUpdatePhoneNumber -> ShowS)
-> (BatchUpdatePhoneNumber -> String)
-> ([BatchUpdatePhoneNumber] -> ShowS)
-> Show BatchUpdatePhoneNumber
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdatePhoneNumber] -> ShowS
$cshowList :: [BatchUpdatePhoneNumber] -> ShowS
show :: BatchUpdatePhoneNumber -> String
$cshow :: BatchUpdatePhoneNumber -> String
showsPrec :: Int -> BatchUpdatePhoneNumber -> ShowS
$cshowsPrec :: Int -> BatchUpdatePhoneNumber -> ShowS
Prelude.Show, (forall x. BatchUpdatePhoneNumber -> Rep BatchUpdatePhoneNumber x)
-> (forall x.
Rep BatchUpdatePhoneNumber x -> BatchUpdatePhoneNumber)
-> Generic BatchUpdatePhoneNumber
forall x. Rep BatchUpdatePhoneNumber x -> BatchUpdatePhoneNumber
forall x. BatchUpdatePhoneNumber -> Rep BatchUpdatePhoneNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchUpdatePhoneNumber x -> BatchUpdatePhoneNumber
$cfrom :: forall x. BatchUpdatePhoneNumber -> Rep BatchUpdatePhoneNumber x
Prelude.Generic)
newBatchUpdatePhoneNumber ::
BatchUpdatePhoneNumber
newBatchUpdatePhoneNumber :: BatchUpdatePhoneNumber
newBatchUpdatePhoneNumber =
BatchUpdatePhoneNumber' :: [UpdatePhoneNumberRequestItem] -> BatchUpdatePhoneNumber
BatchUpdatePhoneNumber'
{ $sel:updatePhoneNumberRequestItems:BatchUpdatePhoneNumber' :: [UpdatePhoneNumberRequestItem]
updatePhoneNumberRequestItems =
[UpdatePhoneNumberRequestItem]
forall a. Monoid a => a
Prelude.mempty
}
batchUpdatePhoneNumber_updatePhoneNumberRequestItems :: Lens.Lens' BatchUpdatePhoneNumber [UpdatePhoneNumberRequestItem]
batchUpdatePhoneNumber_updatePhoneNumberRequestItems :: ([UpdatePhoneNumberRequestItem]
-> f [UpdatePhoneNumberRequestItem])
-> BatchUpdatePhoneNumber -> f BatchUpdatePhoneNumber
batchUpdatePhoneNumber_updatePhoneNumberRequestItems = (BatchUpdatePhoneNumber -> [UpdatePhoneNumberRequestItem])
-> (BatchUpdatePhoneNumber
-> [UpdatePhoneNumberRequestItem] -> BatchUpdatePhoneNumber)
-> Lens
BatchUpdatePhoneNumber
BatchUpdatePhoneNumber
[UpdatePhoneNumberRequestItem]
[UpdatePhoneNumberRequestItem]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdatePhoneNumber' {[UpdatePhoneNumberRequestItem]
updatePhoneNumberRequestItems :: [UpdatePhoneNumberRequestItem]
$sel:updatePhoneNumberRequestItems:BatchUpdatePhoneNumber' :: BatchUpdatePhoneNumber -> [UpdatePhoneNumberRequestItem]
updatePhoneNumberRequestItems} -> [UpdatePhoneNumberRequestItem]
updatePhoneNumberRequestItems) (\s :: BatchUpdatePhoneNumber
s@BatchUpdatePhoneNumber' {} [UpdatePhoneNumberRequestItem]
a -> BatchUpdatePhoneNumber
s {$sel:updatePhoneNumberRequestItems:BatchUpdatePhoneNumber' :: [UpdatePhoneNumberRequestItem]
updatePhoneNumberRequestItems = [UpdatePhoneNumberRequestItem]
a} :: BatchUpdatePhoneNumber) (([UpdatePhoneNumberRequestItem]
-> f [UpdatePhoneNumberRequestItem])
-> BatchUpdatePhoneNumber -> f BatchUpdatePhoneNumber)
-> (([UpdatePhoneNumberRequestItem]
-> f [UpdatePhoneNumberRequestItem])
-> [UpdatePhoneNumberRequestItem]
-> f [UpdatePhoneNumberRequestItem])
-> ([UpdatePhoneNumberRequestItem]
-> f [UpdatePhoneNumberRequestItem])
-> BatchUpdatePhoneNumber
-> f BatchUpdatePhoneNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([UpdatePhoneNumberRequestItem]
-> f [UpdatePhoneNumberRequestItem])
-> [UpdatePhoneNumberRequestItem]
-> f [UpdatePhoneNumberRequestItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchUpdatePhoneNumber where
type
AWSResponse BatchUpdatePhoneNumber =
BatchUpdatePhoneNumberResponse
request :: BatchUpdatePhoneNumber -> Request BatchUpdatePhoneNumber
request = Service -> BatchUpdatePhoneNumber -> Request BatchUpdatePhoneNumber
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchUpdatePhoneNumber
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchUpdatePhoneNumber)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchUpdatePhoneNumber))
-> Logger
-> Service
-> Proxy BatchUpdatePhoneNumber
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchUpdatePhoneNumber)))
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 [PhoneNumberError] -> Int -> BatchUpdatePhoneNumberResponse
BatchUpdatePhoneNumberResponse'
(Maybe [PhoneNumberError] -> Int -> BatchUpdatePhoneNumberResponse)
-> Either String (Maybe [PhoneNumberError])
-> Either String (Int -> BatchUpdatePhoneNumberResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Key -> Either String (Maybe (Maybe [PhoneNumberError]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"PhoneNumberErrors"
Either String (Maybe (Maybe [PhoneNumberError]))
-> Maybe [PhoneNumberError]
-> Either String (Maybe [PhoneNumberError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [PhoneNumberError]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> BatchUpdatePhoneNumberResponse)
-> Either String Int
-> Either String BatchUpdatePhoneNumberResponse
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 BatchUpdatePhoneNumber
instance Prelude.NFData BatchUpdatePhoneNumber
instance Core.ToHeaders BatchUpdatePhoneNumber where
toHeaders :: BatchUpdatePhoneNumber -> ResponseHeaders
toHeaders = ResponseHeaders -> BatchUpdatePhoneNumber -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON BatchUpdatePhoneNumber where
toJSON :: BatchUpdatePhoneNumber -> Value
toJSON BatchUpdatePhoneNumber' {[UpdatePhoneNumberRequestItem]
updatePhoneNumberRequestItems :: [UpdatePhoneNumberRequestItem]
$sel:updatePhoneNumberRequestItems:BatchUpdatePhoneNumber' :: BatchUpdatePhoneNumber -> [UpdatePhoneNumberRequestItem]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Key
"UpdatePhoneNumberRequestItems"
Key -> [UpdatePhoneNumberRequestItem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= [UpdatePhoneNumberRequestItem]
updatePhoneNumberRequestItems
)
]
)
instance Core.ToPath BatchUpdatePhoneNumber where
toPath :: BatchUpdatePhoneNumber -> ByteString
toPath = ByteString -> BatchUpdatePhoneNumber -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/phone-numbers"
instance Core.ToQuery BatchUpdatePhoneNumber where
toQuery :: BatchUpdatePhoneNumber -> QueryString
toQuery =
QueryString -> BatchUpdatePhoneNumber -> QueryString
forall a b. a -> b -> a
Prelude.const
([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=batch-update"])
data BatchUpdatePhoneNumberResponse = BatchUpdatePhoneNumberResponse'
{
BatchUpdatePhoneNumberResponse -> Maybe [PhoneNumberError]
phoneNumberErrors :: Prelude.Maybe [PhoneNumberError],
BatchUpdatePhoneNumberResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchUpdatePhoneNumberResponse
-> BatchUpdatePhoneNumberResponse -> Bool
(BatchUpdatePhoneNumberResponse
-> BatchUpdatePhoneNumberResponse -> Bool)
-> (BatchUpdatePhoneNumberResponse
-> BatchUpdatePhoneNumberResponse -> Bool)
-> Eq BatchUpdatePhoneNumberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdatePhoneNumberResponse
-> BatchUpdatePhoneNumberResponse -> Bool
$c/= :: BatchUpdatePhoneNumberResponse
-> BatchUpdatePhoneNumberResponse -> Bool
== :: BatchUpdatePhoneNumberResponse
-> BatchUpdatePhoneNumberResponse -> Bool
$c== :: BatchUpdatePhoneNumberResponse
-> BatchUpdatePhoneNumberResponse -> Bool
Prelude.Eq, ReadPrec [BatchUpdatePhoneNumberResponse]
ReadPrec BatchUpdatePhoneNumberResponse
Int -> ReadS BatchUpdatePhoneNumberResponse
ReadS [BatchUpdatePhoneNumberResponse]
(Int -> ReadS BatchUpdatePhoneNumberResponse)
-> ReadS [BatchUpdatePhoneNumberResponse]
-> ReadPrec BatchUpdatePhoneNumberResponse
-> ReadPrec [BatchUpdatePhoneNumberResponse]
-> Read BatchUpdatePhoneNumberResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdatePhoneNumberResponse]
$creadListPrec :: ReadPrec [BatchUpdatePhoneNumberResponse]
readPrec :: ReadPrec BatchUpdatePhoneNumberResponse
$creadPrec :: ReadPrec BatchUpdatePhoneNumberResponse
readList :: ReadS [BatchUpdatePhoneNumberResponse]
$creadList :: ReadS [BatchUpdatePhoneNumberResponse]
readsPrec :: Int -> ReadS BatchUpdatePhoneNumberResponse
$creadsPrec :: Int -> ReadS BatchUpdatePhoneNumberResponse
Prelude.Read, Int -> BatchUpdatePhoneNumberResponse -> ShowS
[BatchUpdatePhoneNumberResponse] -> ShowS
BatchUpdatePhoneNumberResponse -> String
(Int -> BatchUpdatePhoneNumberResponse -> ShowS)
-> (BatchUpdatePhoneNumberResponse -> String)
-> ([BatchUpdatePhoneNumberResponse] -> ShowS)
-> Show BatchUpdatePhoneNumberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdatePhoneNumberResponse] -> ShowS
$cshowList :: [BatchUpdatePhoneNumberResponse] -> ShowS
show :: BatchUpdatePhoneNumberResponse -> String
$cshow :: BatchUpdatePhoneNumberResponse -> String
showsPrec :: Int -> BatchUpdatePhoneNumberResponse -> ShowS
$cshowsPrec :: Int -> BatchUpdatePhoneNumberResponse -> ShowS
Prelude.Show, (forall x.
BatchUpdatePhoneNumberResponse
-> Rep BatchUpdatePhoneNumberResponse x)
-> (forall x.
Rep BatchUpdatePhoneNumberResponse x
-> BatchUpdatePhoneNumberResponse)
-> Generic BatchUpdatePhoneNumberResponse
forall x.
Rep BatchUpdatePhoneNumberResponse x
-> BatchUpdatePhoneNumberResponse
forall x.
BatchUpdatePhoneNumberResponse
-> Rep BatchUpdatePhoneNumberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUpdatePhoneNumberResponse x
-> BatchUpdatePhoneNumberResponse
$cfrom :: forall x.
BatchUpdatePhoneNumberResponse
-> Rep BatchUpdatePhoneNumberResponse x
Prelude.Generic)
newBatchUpdatePhoneNumberResponse ::
Prelude.Int ->
BatchUpdatePhoneNumberResponse
newBatchUpdatePhoneNumberResponse :: Int -> BatchUpdatePhoneNumberResponse
newBatchUpdatePhoneNumberResponse Int
pHttpStatus_ =
BatchUpdatePhoneNumberResponse' :: Maybe [PhoneNumberError] -> Int -> BatchUpdatePhoneNumberResponse
BatchUpdatePhoneNumberResponse'
{ $sel:phoneNumberErrors:BatchUpdatePhoneNumberResponse' :: Maybe [PhoneNumberError]
phoneNumberErrors =
Maybe [PhoneNumberError]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchUpdatePhoneNumberResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchUpdatePhoneNumberResponse_phoneNumberErrors :: Lens.Lens' BatchUpdatePhoneNumberResponse (Prelude.Maybe [PhoneNumberError])
batchUpdatePhoneNumberResponse_phoneNumberErrors :: (Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> BatchUpdatePhoneNumberResponse
-> f BatchUpdatePhoneNumberResponse
batchUpdatePhoneNumberResponse_phoneNumberErrors = (BatchUpdatePhoneNumberResponse -> Maybe [PhoneNumberError])
-> (BatchUpdatePhoneNumberResponse
-> Maybe [PhoneNumberError] -> BatchUpdatePhoneNumberResponse)
-> Lens
BatchUpdatePhoneNumberResponse
BatchUpdatePhoneNumberResponse
(Maybe [PhoneNumberError])
(Maybe [PhoneNumberError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdatePhoneNumberResponse' {Maybe [PhoneNumberError]
phoneNumberErrors :: Maybe [PhoneNumberError]
$sel:phoneNumberErrors:BatchUpdatePhoneNumberResponse' :: BatchUpdatePhoneNumberResponse -> Maybe [PhoneNumberError]
phoneNumberErrors} -> Maybe [PhoneNumberError]
phoneNumberErrors) (\s :: BatchUpdatePhoneNumberResponse
s@BatchUpdatePhoneNumberResponse' {} Maybe [PhoneNumberError]
a -> BatchUpdatePhoneNumberResponse
s {$sel:phoneNumberErrors:BatchUpdatePhoneNumberResponse' :: Maybe [PhoneNumberError]
phoneNumberErrors = Maybe [PhoneNumberError]
a} :: BatchUpdatePhoneNumberResponse) ((Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> BatchUpdatePhoneNumberResponse
-> f BatchUpdatePhoneNumberResponse)
-> ((Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> (Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> BatchUpdatePhoneNumberResponse
-> f BatchUpdatePhoneNumberResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PhoneNumberError]
[PhoneNumberError]
[PhoneNumberError]
[PhoneNumberError]
-> Iso
(Maybe [PhoneNumberError])
(Maybe [PhoneNumberError])
(Maybe [PhoneNumberError])
(Maybe [PhoneNumberError])
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
[PhoneNumberError]
[PhoneNumberError]
[PhoneNumberError]
[PhoneNumberError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchUpdatePhoneNumberResponse_httpStatus :: Lens.Lens' BatchUpdatePhoneNumberResponse Prelude.Int
batchUpdatePhoneNumberResponse_httpStatus :: (Int -> f Int)
-> BatchUpdatePhoneNumberResponse
-> f BatchUpdatePhoneNumberResponse
batchUpdatePhoneNumberResponse_httpStatus = (BatchUpdatePhoneNumberResponse -> Int)
-> (BatchUpdatePhoneNumberResponse
-> Int -> BatchUpdatePhoneNumberResponse)
-> Lens
BatchUpdatePhoneNumberResponse
BatchUpdatePhoneNumberResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdatePhoneNumberResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchUpdatePhoneNumberResponse' :: BatchUpdatePhoneNumberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchUpdatePhoneNumberResponse
s@BatchUpdatePhoneNumberResponse' {} Int
a -> BatchUpdatePhoneNumberResponse
s {$sel:httpStatus:BatchUpdatePhoneNumberResponse' :: Int
httpStatus = Int
a} :: BatchUpdatePhoneNumberResponse)
instance
Prelude.NFData
BatchUpdatePhoneNumberResponse