{-# 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.BatchDeletePhoneNumber
(
BatchDeletePhoneNumber (..),
newBatchDeletePhoneNumber,
batchDeletePhoneNumber_phoneNumberIds,
BatchDeletePhoneNumberResponse (..),
newBatchDeletePhoneNumberResponse,
batchDeletePhoneNumberResponse_phoneNumberErrors,
batchDeletePhoneNumberResponse_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 BatchDeletePhoneNumber = BatchDeletePhoneNumber'
{
BatchDeletePhoneNumber -> NonEmpty Text
phoneNumberIds :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchDeletePhoneNumber -> BatchDeletePhoneNumber -> Bool
(BatchDeletePhoneNumber -> BatchDeletePhoneNumber -> Bool)
-> (BatchDeletePhoneNumber -> BatchDeletePhoneNumber -> Bool)
-> Eq BatchDeletePhoneNumber
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeletePhoneNumber -> BatchDeletePhoneNumber -> Bool
$c/= :: BatchDeletePhoneNumber -> BatchDeletePhoneNumber -> Bool
== :: BatchDeletePhoneNumber -> BatchDeletePhoneNumber -> Bool
$c== :: BatchDeletePhoneNumber -> BatchDeletePhoneNumber -> Bool
Prelude.Eq, ReadPrec [BatchDeletePhoneNumber]
ReadPrec BatchDeletePhoneNumber
Int -> ReadS BatchDeletePhoneNumber
ReadS [BatchDeletePhoneNumber]
(Int -> ReadS BatchDeletePhoneNumber)
-> ReadS [BatchDeletePhoneNumber]
-> ReadPrec BatchDeletePhoneNumber
-> ReadPrec [BatchDeletePhoneNumber]
-> Read BatchDeletePhoneNumber
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeletePhoneNumber]
$creadListPrec :: ReadPrec [BatchDeletePhoneNumber]
readPrec :: ReadPrec BatchDeletePhoneNumber
$creadPrec :: ReadPrec BatchDeletePhoneNumber
readList :: ReadS [BatchDeletePhoneNumber]
$creadList :: ReadS [BatchDeletePhoneNumber]
readsPrec :: Int -> ReadS BatchDeletePhoneNumber
$creadsPrec :: Int -> ReadS BatchDeletePhoneNumber
Prelude.Read, Int -> BatchDeletePhoneNumber -> ShowS
[BatchDeletePhoneNumber] -> ShowS
BatchDeletePhoneNumber -> String
(Int -> BatchDeletePhoneNumber -> ShowS)
-> (BatchDeletePhoneNumber -> String)
-> ([BatchDeletePhoneNumber] -> ShowS)
-> Show BatchDeletePhoneNumber
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeletePhoneNumber] -> ShowS
$cshowList :: [BatchDeletePhoneNumber] -> ShowS
show :: BatchDeletePhoneNumber -> String
$cshow :: BatchDeletePhoneNumber -> String
showsPrec :: Int -> BatchDeletePhoneNumber -> ShowS
$cshowsPrec :: Int -> BatchDeletePhoneNumber -> ShowS
Prelude.Show, (forall x. BatchDeletePhoneNumber -> Rep BatchDeletePhoneNumber x)
-> (forall x.
Rep BatchDeletePhoneNumber x -> BatchDeletePhoneNumber)
-> Generic BatchDeletePhoneNumber
forall x. Rep BatchDeletePhoneNumber x -> BatchDeletePhoneNumber
forall x. BatchDeletePhoneNumber -> Rep BatchDeletePhoneNumber x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDeletePhoneNumber x -> BatchDeletePhoneNumber
$cfrom :: forall x. BatchDeletePhoneNumber -> Rep BatchDeletePhoneNumber x
Prelude.Generic)
newBatchDeletePhoneNumber ::
Prelude.NonEmpty Prelude.Text ->
BatchDeletePhoneNumber
newBatchDeletePhoneNumber :: NonEmpty Text -> BatchDeletePhoneNumber
newBatchDeletePhoneNumber NonEmpty Text
pPhoneNumberIds_ =
BatchDeletePhoneNumber' :: NonEmpty Text -> BatchDeletePhoneNumber
BatchDeletePhoneNumber'
{ $sel:phoneNumberIds:BatchDeletePhoneNumber' :: NonEmpty Text
phoneNumberIds =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pPhoneNumberIds_
}
batchDeletePhoneNumber_phoneNumberIds :: Lens.Lens' BatchDeletePhoneNumber (Prelude.NonEmpty Prelude.Text)
batchDeletePhoneNumber_phoneNumberIds :: (NonEmpty Text -> f (NonEmpty Text))
-> BatchDeletePhoneNumber -> f BatchDeletePhoneNumber
batchDeletePhoneNumber_phoneNumberIds = (BatchDeletePhoneNumber -> NonEmpty Text)
-> (BatchDeletePhoneNumber
-> NonEmpty Text -> BatchDeletePhoneNumber)
-> Lens
BatchDeletePhoneNumber
BatchDeletePhoneNumber
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeletePhoneNumber' {NonEmpty Text
phoneNumberIds :: NonEmpty Text
$sel:phoneNumberIds:BatchDeletePhoneNumber' :: BatchDeletePhoneNumber -> NonEmpty Text
phoneNumberIds} -> NonEmpty Text
phoneNumberIds) (\s :: BatchDeletePhoneNumber
s@BatchDeletePhoneNumber' {} NonEmpty Text
a -> BatchDeletePhoneNumber
s {$sel:phoneNumberIds:BatchDeletePhoneNumber' :: NonEmpty Text
phoneNumberIds = NonEmpty Text
a} :: BatchDeletePhoneNumber) ((NonEmpty Text -> f (NonEmpty Text))
-> BatchDeletePhoneNumber -> f BatchDeletePhoneNumber)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> BatchDeletePhoneNumber
-> f BatchDeletePhoneNumber
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchDeletePhoneNumber where
type
AWSResponse BatchDeletePhoneNumber =
BatchDeletePhoneNumberResponse
request :: BatchDeletePhoneNumber -> Request BatchDeletePhoneNumber
request = Service -> BatchDeletePhoneNumber -> Request BatchDeletePhoneNumber
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchDeletePhoneNumber
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDeletePhoneNumber)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchDeletePhoneNumber))
-> Logger
-> Service
-> Proxy BatchDeletePhoneNumber
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDeletePhoneNumber)))
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 -> BatchDeletePhoneNumberResponse
BatchDeletePhoneNumberResponse'
(Maybe [PhoneNumberError] -> Int -> BatchDeletePhoneNumberResponse)
-> Either String (Maybe [PhoneNumberError])
-> Either String (Int -> BatchDeletePhoneNumberResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [PhoneNumberError]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"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 -> BatchDeletePhoneNumberResponse)
-> Either String Int
-> Either String BatchDeletePhoneNumberResponse
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 BatchDeletePhoneNumber
instance Prelude.NFData BatchDeletePhoneNumber
instance Core.ToHeaders BatchDeletePhoneNumber where
toHeaders :: BatchDeletePhoneNumber -> ResponseHeaders
toHeaders = ResponseHeaders -> BatchDeletePhoneNumber -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON BatchDeletePhoneNumber where
toJSON :: BatchDeletePhoneNumber -> Value
toJSON BatchDeletePhoneNumber' {NonEmpty Text
phoneNumberIds :: NonEmpty Text
$sel:phoneNumberIds:BatchDeletePhoneNumber' :: BatchDeletePhoneNumber -> NonEmpty 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
"PhoneNumberIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
phoneNumberIds)
]
)
instance Core.ToPath BatchDeletePhoneNumber where
toPath :: BatchDeletePhoneNumber -> ByteString
toPath = ByteString -> BatchDeletePhoneNumber -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/phone-numbers"
instance Core.ToQuery BatchDeletePhoneNumber where
toQuery :: BatchDeletePhoneNumber -> QueryString
toQuery =
QueryString -> BatchDeletePhoneNumber -> QueryString
forall a b. a -> b -> a
Prelude.const
([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=batch-delete"])
data BatchDeletePhoneNumberResponse = BatchDeletePhoneNumberResponse'
{
BatchDeletePhoneNumberResponse -> Maybe [PhoneNumberError]
phoneNumberErrors :: Prelude.Maybe [PhoneNumberError],
BatchDeletePhoneNumberResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchDeletePhoneNumberResponse
-> BatchDeletePhoneNumberResponse -> Bool
(BatchDeletePhoneNumberResponse
-> BatchDeletePhoneNumberResponse -> Bool)
-> (BatchDeletePhoneNumberResponse
-> BatchDeletePhoneNumberResponse -> Bool)
-> Eq BatchDeletePhoneNumberResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeletePhoneNumberResponse
-> BatchDeletePhoneNumberResponse -> Bool
$c/= :: BatchDeletePhoneNumberResponse
-> BatchDeletePhoneNumberResponse -> Bool
== :: BatchDeletePhoneNumberResponse
-> BatchDeletePhoneNumberResponse -> Bool
$c== :: BatchDeletePhoneNumberResponse
-> BatchDeletePhoneNumberResponse -> Bool
Prelude.Eq, ReadPrec [BatchDeletePhoneNumberResponse]
ReadPrec BatchDeletePhoneNumberResponse
Int -> ReadS BatchDeletePhoneNumberResponse
ReadS [BatchDeletePhoneNumberResponse]
(Int -> ReadS BatchDeletePhoneNumberResponse)
-> ReadS [BatchDeletePhoneNumberResponse]
-> ReadPrec BatchDeletePhoneNumberResponse
-> ReadPrec [BatchDeletePhoneNumberResponse]
-> Read BatchDeletePhoneNumberResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeletePhoneNumberResponse]
$creadListPrec :: ReadPrec [BatchDeletePhoneNumberResponse]
readPrec :: ReadPrec BatchDeletePhoneNumberResponse
$creadPrec :: ReadPrec BatchDeletePhoneNumberResponse
readList :: ReadS [BatchDeletePhoneNumberResponse]
$creadList :: ReadS [BatchDeletePhoneNumberResponse]
readsPrec :: Int -> ReadS BatchDeletePhoneNumberResponse
$creadsPrec :: Int -> ReadS BatchDeletePhoneNumberResponse
Prelude.Read, Int -> BatchDeletePhoneNumberResponse -> ShowS
[BatchDeletePhoneNumberResponse] -> ShowS
BatchDeletePhoneNumberResponse -> String
(Int -> BatchDeletePhoneNumberResponse -> ShowS)
-> (BatchDeletePhoneNumberResponse -> String)
-> ([BatchDeletePhoneNumberResponse] -> ShowS)
-> Show BatchDeletePhoneNumberResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeletePhoneNumberResponse] -> ShowS
$cshowList :: [BatchDeletePhoneNumberResponse] -> ShowS
show :: BatchDeletePhoneNumberResponse -> String
$cshow :: BatchDeletePhoneNumberResponse -> String
showsPrec :: Int -> BatchDeletePhoneNumberResponse -> ShowS
$cshowsPrec :: Int -> BatchDeletePhoneNumberResponse -> ShowS
Prelude.Show, (forall x.
BatchDeletePhoneNumberResponse
-> Rep BatchDeletePhoneNumberResponse x)
-> (forall x.
Rep BatchDeletePhoneNumberResponse x
-> BatchDeletePhoneNumberResponse)
-> Generic BatchDeletePhoneNumberResponse
forall x.
Rep BatchDeletePhoneNumberResponse x
-> BatchDeletePhoneNumberResponse
forall x.
BatchDeletePhoneNumberResponse
-> Rep BatchDeletePhoneNumberResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDeletePhoneNumberResponse x
-> BatchDeletePhoneNumberResponse
$cfrom :: forall x.
BatchDeletePhoneNumberResponse
-> Rep BatchDeletePhoneNumberResponse x
Prelude.Generic)
newBatchDeletePhoneNumberResponse ::
Prelude.Int ->
BatchDeletePhoneNumberResponse
newBatchDeletePhoneNumberResponse :: Int -> BatchDeletePhoneNumberResponse
newBatchDeletePhoneNumberResponse Int
pHttpStatus_ =
BatchDeletePhoneNumberResponse' :: Maybe [PhoneNumberError] -> Int -> BatchDeletePhoneNumberResponse
BatchDeletePhoneNumberResponse'
{ $sel:phoneNumberErrors:BatchDeletePhoneNumberResponse' :: Maybe [PhoneNumberError]
phoneNumberErrors =
Maybe [PhoneNumberError]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchDeletePhoneNumberResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchDeletePhoneNumberResponse_phoneNumberErrors :: Lens.Lens' BatchDeletePhoneNumberResponse (Prelude.Maybe [PhoneNumberError])
batchDeletePhoneNumberResponse_phoneNumberErrors :: (Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> BatchDeletePhoneNumberResponse
-> f BatchDeletePhoneNumberResponse
batchDeletePhoneNumberResponse_phoneNumberErrors = (BatchDeletePhoneNumberResponse -> Maybe [PhoneNumberError])
-> (BatchDeletePhoneNumberResponse
-> Maybe [PhoneNumberError] -> BatchDeletePhoneNumberResponse)
-> Lens
BatchDeletePhoneNumberResponse
BatchDeletePhoneNumberResponse
(Maybe [PhoneNumberError])
(Maybe [PhoneNumberError])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeletePhoneNumberResponse' {Maybe [PhoneNumberError]
phoneNumberErrors :: Maybe [PhoneNumberError]
$sel:phoneNumberErrors:BatchDeletePhoneNumberResponse' :: BatchDeletePhoneNumberResponse -> Maybe [PhoneNumberError]
phoneNumberErrors} -> Maybe [PhoneNumberError]
phoneNumberErrors) (\s :: BatchDeletePhoneNumberResponse
s@BatchDeletePhoneNumberResponse' {} Maybe [PhoneNumberError]
a -> BatchDeletePhoneNumberResponse
s {$sel:phoneNumberErrors:BatchDeletePhoneNumberResponse' :: Maybe [PhoneNumberError]
phoneNumberErrors = Maybe [PhoneNumberError]
a} :: BatchDeletePhoneNumberResponse) ((Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> BatchDeletePhoneNumberResponse
-> f BatchDeletePhoneNumberResponse)
-> ((Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> (Maybe [PhoneNumberError] -> f (Maybe [PhoneNumberError]))
-> BatchDeletePhoneNumberResponse
-> f BatchDeletePhoneNumberResponse
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
batchDeletePhoneNumberResponse_httpStatus :: Lens.Lens' BatchDeletePhoneNumberResponse Prelude.Int
batchDeletePhoneNumberResponse_httpStatus :: (Int -> f Int)
-> BatchDeletePhoneNumberResponse
-> f BatchDeletePhoneNumberResponse
batchDeletePhoneNumberResponse_httpStatus = (BatchDeletePhoneNumberResponse -> Int)
-> (BatchDeletePhoneNumberResponse
-> Int -> BatchDeletePhoneNumberResponse)
-> Lens
BatchDeletePhoneNumberResponse
BatchDeletePhoneNumberResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeletePhoneNumberResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDeletePhoneNumberResponse' :: BatchDeletePhoneNumberResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDeletePhoneNumberResponse
s@BatchDeletePhoneNumberResponse' {} Int
a -> BatchDeletePhoneNumberResponse
s {$sel:httpStatus:BatchDeletePhoneNumberResponse' :: Int
httpStatus = Int
a} :: BatchDeletePhoneNumberResponse)
instance
Prelude.NFData
BatchDeletePhoneNumberResponse