{-# 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.ChimeSdkVoice.BatchDeletePhoneNumber
(
BatchDeletePhoneNumber (..),
newBatchDeletePhoneNumber,
batchDeletePhoneNumber_phoneNumberIds,
BatchDeletePhoneNumberResponse (..),
newBatchDeletePhoneNumberResponse,
batchDeletePhoneNumberResponse_phoneNumberErrors,
batchDeletePhoneNumberResponse_httpStatus,
)
where
import Amazonka.ChimeSdkVoice.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 BatchDeletePhoneNumber = BatchDeletePhoneNumber'
{ BatchDeletePhoneNumber -> NonEmpty Text
phoneNumberIds :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchDeletePhoneNumber -> BatchDeletePhoneNumber -> Bool
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]
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
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. 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'
{ $sel:phoneNumberIds:BatchDeletePhoneNumber' :: NonEmpty Text
phoneNumberIds =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pPhoneNumberIds_
}
batchDeletePhoneNumber_phoneNumberIds :: Lens.Lens' BatchDeletePhoneNumber (Prelude.NonEmpty Prelude.Text)
batchDeletePhoneNumber_phoneNumberIds :: Lens' BatchDeletePhoneNumber (NonEmpty Text)
batchDeletePhoneNumber_phoneNumberIds = 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) 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 BatchDeletePhoneNumber where
type
AWSResponse BatchDeletePhoneNumber =
BatchDeletePhoneNumberResponse
request :: (Service -> Service)
-> BatchDeletePhoneNumber -> Request BatchDeletePhoneNumber
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 BatchDeletePhoneNumber
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDeletePhoneNumber)))
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 [PhoneNumberError] -> Int -> BatchDeletePhoneNumberResponse
BatchDeletePhoneNumberResponse'
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
"PhoneNumberErrors"
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 BatchDeletePhoneNumber where
hashWithSalt :: Int -> BatchDeletePhoneNumber -> Int
hashWithSalt Int
_salt BatchDeletePhoneNumber' {NonEmpty Text
phoneNumberIds :: NonEmpty Text
$sel:phoneNumberIds:BatchDeletePhoneNumber' :: BatchDeletePhoneNumber -> NonEmpty Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
phoneNumberIds
instance Prelude.NFData BatchDeletePhoneNumber where
rnf :: BatchDeletePhoneNumber -> ()
rnf BatchDeletePhoneNumber' {NonEmpty Text
phoneNumberIds :: NonEmpty Text
$sel:phoneNumberIds:BatchDeletePhoneNumber' :: BatchDeletePhoneNumber -> NonEmpty Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
phoneNumberIds
instance Data.ToHeaders BatchDeletePhoneNumber where
toHeaders :: BatchDeletePhoneNumber -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON BatchDeletePhoneNumber where
toJSON :: BatchDeletePhoneNumber -> Value
toJSON BatchDeletePhoneNumber' {NonEmpty Text
phoneNumberIds :: NonEmpty Text
$sel:phoneNumberIds:BatchDeletePhoneNumber' :: BatchDeletePhoneNumber -> NonEmpty Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"PhoneNumberIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
phoneNumberIds)
]
)
instance Data.ToPath BatchDeletePhoneNumber where
toPath :: BatchDeletePhoneNumber -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/phone-numbers"
instance Data.ToQuery BatchDeletePhoneNumber where
toQuery :: BatchDeletePhoneNumber -> QueryString
toQuery =
forall a b. a -> b -> a
Prelude.const
(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
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, Int -> BatchDeletePhoneNumberResponse -> ShowS
[BatchDeletePhoneNumberResponse] -> ShowS
BatchDeletePhoneNumberResponse -> String
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.
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'
{ $sel:phoneNumberErrors:BatchDeletePhoneNumberResponse' :: Maybe [PhoneNumberError]
phoneNumberErrors =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchDeletePhoneNumberResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchDeletePhoneNumberResponse_phoneNumberErrors :: Lens.Lens' BatchDeletePhoneNumberResponse (Prelude.Maybe [PhoneNumberError])
batchDeletePhoneNumberResponse_phoneNumberErrors :: Lens' BatchDeletePhoneNumberResponse (Maybe [PhoneNumberError])
batchDeletePhoneNumberResponse_phoneNumberErrors = 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) 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
batchDeletePhoneNumberResponse_httpStatus :: Lens.Lens' BatchDeletePhoneNumberResponse Prelude.Int
batchDeletePhoneNumberResponse_httpStatus :: Lens' BatchDeletePhoneNumberResponse Int
batchDeletePhoneNumberResponse_httpStatus = 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
where
rnf :: BatchDeletePhoneNumberResponse -> ()
rnf BatchDeletePhoneNumberResponse' {Int
Maybe [PhoneNumberError]
httpStatus :: Int
phoneNumberErrors :: Maybe [PhoneNumberError]
$sel:httpStatus:BatchDeletePhoneNumberResponse' :: BatchDeletePhoneNumberResponse -> Int
$sel:phoneNumberErrors:BatchDeletePhoneNumberResponse' :: BatchDeletePhoneNumberResponse -> Maybe [PhoneNumberError]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [PhoneNumberError]
phoneNumberErrors
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus