{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.SNS.Types.PhoneNumberInformation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SNS.Types.NumberCapability
import Amazonka.SNS.Types.RouteType
data PhoneNumberInformation = PhoneNumberInformation'
{
PhoneNumberInformation -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
PhoneNumberInformation -> Maybe Text
iso2CountryCode :: Prelude.Maybe Prelude.Text,
PhoneNumberInformation -> Maybe ISO8601
createdAt :: Prelude.Maybe Core.ISO8601,
PhoneNumberInformation -> Maybe Text
phoneNumber :: Prelude.Maybe Prelude.Text,
PhoneNumberInformation -> Maybe [NumberCapability]
numberCapabilities :: Prelude.Maybe [NumberCapability],
PhoneNumberInformation -> Maybe RouteType
routeType :: Prelude.Maybe RouteType
}
deriving (PhoneNumberInformation -> PhoneNumberInformation -> Bool
(PhoneNumberInformation -> PhoneNumberInformation -> Bool)
-> (PhoneNumberInformation -> PhoneNumberInformation -> Bool)
-> Eq PhoneNumberInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhoneNumberInformation -> PhoneNumberInformation -> Bool
$c/= :: PhoneNumberInformation -> PhoneNumberInformation -> Bool
== :: PhoneNumberInformation -> PhoneNumberInformation -> Bool
$c== :: PhoneNumberInformation -> PhoneNumberInformation -> Bool
Prelude.Eq, ReadPrec [PhoneNumberInformation]
ReadPrec PhoneNumberInformation
Int -> ReadS PhoneNumberInformation
ReadS [PhoneNumberInformation]
(Int -> ReadS PhoneNumberInformation)
-> ReadS [PhoneNumberInformation]
-> ReadPrec PhoneNumberInformation
-> ReadPrec [PhoneNumberInformation]
-> Read PhoneNumberInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhoneNumberInformation]
$creadListPrec :: ReadPrec [PhoneNumberInformation]
readPrec :: ReadPrec PhoneNumberInformation
$creadPrec :: ReadPrec PhoneNumberInformation
readList :: ReadS [PhoneNumberInformation]
$creadList :: ReadS [PhoneNumberInformation]
readsPrec :: Int -> ReadS PhoneNumberInformation
$creadsPrec :: Int -> ReadS PhoneNumberInformation
Prelude.Read, Int -> PhoneNumberInformation -> ShowS
[PhoneNumberInformation] -> ShowS
PhoneNumberInformation -> String
(Int -> PhoneNumberInformation -> ShowS)
-> (PhoneNumberInformation -> String)
-> ([PhoneNumberInformation] -> ShowS)
-> Show PhoneNumberInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhoneNumberInformation] -> ShowS
$cshowList :: [PhoneNumberInformation] -> ShowS
show :: PhoneNumberInformation -> String
$cshow :: PhoneNumberInformation -> String
showsPrec :: Int -> PhoneNumberInformation -> ShowS
$cshowsPrec :: Int -> PhoneNumberInformation -> ShowS
Prelude.Show, (forall x. PhoneNumberInformation -> Rep PhoneNumberInformation x)
-> (forall x.
Rep PhoneNumberInformation x -> PhoneNumberInformation)
-> Generic PhoneNumberInformation
forall x. Rep PhoneNumberInformation x -> PhoneNumberInformation
forall x. PhoneNumberInformation -> Rep PhoneNumberInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhoneNumberInformation x -> PhoneNumberInformation
$cfrom :: forall x. PhoneNumberInformation -> Rep PhoneNumberInformation x
Prelude.Generic)
newPhoneNumberInformation ::
PhoneNumberInformation
newPhoneNumberInformation :: PhoneNumberInformation
newPhoneNumberInformation =
PhoneNumberInformation' :: Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe [NumberCapability]
-> Maybe RouteType
-> PhoneNumberInformation
PhoneNumberInformation'
{ $sel:status:PhoneNumberInformation' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:iso2CountryCode:PhoneNumberInformation' :: Maybe Text
iso2CountryCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:createdAt:PhoneNumberInformation' :: Maybe ISO8601
createdAt = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
$sel:phoneNumber:PhoneNumberInformation' :: Maybe Text
phoneNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:numberCapabilities:PhoneNumberInformation' :: Maybe [NumberCapability]
numberCapabilities = Maybe [NumberCapability]
forall a. Maybe a
Prelude.Nothing,
$sel:routeType:PhoneNumberInformation' :: Maybe RouteType
routeType = Maybe RouteType
forall a. Maybe a
Prelude.Nothing
}
phoneNumberInformation_status :: Lens.Lens' PhoneNumberInformation (Prelude.Maybe Prelude.Text)
phoneNumberInformation_status :: (Maybe Text -> f (Maybe Text))
-> PhoneNumberInformation -> f PhoneNumberInformation
phoneNumberInformation_status = (PhoneNumberInformation -> Maybe Text)
-> (PhoneNumberInformation -> Maybe Text -> PhoneNumberInformation)
-> Lens
PhoneNumberInformation
PhoneNumberInformation
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberInformation' {Maybe Text
status :: Maybe Text
$sel:status:PhoneNumberInformation' :: PhoneNumberInformation -> Maybe Text
status} -> Maybe Text
status) (\s :: PhoneNumberInformation
s@PhoneNumberInformation' {} Maybe Text
a -> PhoneNumberInformation
s {$sel:status:PhoneNumberInformation' :: Maybe Text
status = Maybe Text
a} :: PhoneNumberInformation)
phoneNumberInformation_iso2CountryCode :: Lens.Lens' PhoneNumberInformation (Prelude.Maybe Prelude.Text)
phoneNumberInformation_iso2CountryCode :: (Maybe Text -> f (Maybe Text))
-> PhoneNumberInformation -> f PhoneNumberInformation
phoneNumberInformation_iso2CountryCode = (PhoneNumberInformation -> Maybe Text)
-> (PhoneNumberInformation -> Maybe Text -> PhoneNumberInformation)
-> Lens
PhoneNumberInformation
PhoneNumberInformation
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberInformation' {Maybe Text
iso2CountryCode :: Maybe Text
$sel:iso2CountryCode:PhoneNumberInformation' :: PhoneNumberInformation -> Maybe Text
iso2CountryCode} -> Maybe Text
iso2CountryCode) (\s :: PhoneNumberInformation
s@PhoneNumberInformation' {} Maybe Text
a -> PhoneNumberInformation
s {$sel:iso2CountryCode:PhoneNumberInformation' :: Maybe Text
iso2CountryCode = Maybe Text
a} :: PhoneNumberInformation)
phoneNumberInformation_createdAt :: Lens.Lens' PhoneNumberInformation (Prelude.Maybe Prelude.UTCTime)
phoneNumberInformation_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumberInformation -> f PhoneNumberInformation
phoneNumberInformation_createdAt = (PhoneNumberInformation -> Maybe ISO8601)
-> (PhoneNumberInformation
-> Maybe ISO8601 -> PhoneNumberInformation)
-> Lens
PhoneNumberInformation
PhoneNumberInformation
(Maybe ISO8601)
(Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberInformation' {Maybe ISO8601
createdAt :: Maybe ISO8601
$sel:createdAt:PhoneNumberInformation' :: PhoneNumberInformation -> Maybe ISO8601
createdAt} -> Maybe ISO8601
createdAt) (\s :: PhoneNumberInformation
s@PhoneNumberInformation' {} Maybe ISO8601
a -> PhoneNumberInformation
s {$sel:createdAt:PhoneNumberInformation' :: Maybe ISO8601
createdAt = Maybe ISO8601
a} :: PhoneNumberInformation) ((Maybe ISO8601 -> f (Maybe ISO8601))
-> PhoneNumberInformation -> f PhoneNumberInformation)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PhoneNumberInformation
-> f PhoneNumberInformation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
(Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
phoneNumberInformation_phoneNumber :: Lens.Lens' PhoneNumberInformation (Prelude.Maybe Prelude.Text)
phoneNumberInformation_phoneNumber :: (Maybe Text -> f (Maybe Text))
-> PhoneNumberInformation -> f PhoneNumberInformation
phoneNumberInformation_phoneNumber = (PhoneNumberInformation -> Maybe Text)
-> (PhoneNumberInformation -> Maybe Text -> PhoneNumberInformation)
-> Lens
PhoneNumberInformation
PhoneNumberInformation
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberInformation' {Maybe Text
phoneNumber :: Maybe Text
$sel:phoneNumber:PhoneNumberInformation' :: PhoneNumberInformation -> Maybe Text
phoneNumber} -> Maybe Text
phoneNumber) (\s :: PhoneNumberInformation
s@PhoneNumberInformation' {} Maybe Text
a -> PhoneNumberInformation
s {$sel:phoneNumber:PhoneNumberInformation' :: Maybe Text
phoneNumber = Maybe Text
a} :: PhoneNumberInformation)
phoneNumberInformation_numberCapabilities :: Lens.Lens' PhoneNumberInformation (Prelude.Maybe [NumberCapability])
phoneNumberInformation_numberCapabilities :: (Maybe [NumberCapability] -> f (Maybe [NumberCapability]))
-> PhoneNumberInformation -> f PhoneNumberInformation
phoneNumberInformation_numberCapabilities = (PhoneNumberInformation -> Maybe [NumberCapability])
-> (PhoneNumberInformation
-> Maybe [NumberCapability] -> PhoneNumberInformation)
-> Lens
PhoneNumberInformation
PhoneNumberInformation
(Maybe [NumberCapability])
(Maybe [NumberCapability])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberInformation' {Maybe [NumberCapability]
numberCapabilities :: Maybe [NumberCapability]
$sel:numberCapabilities:PhoneNumberInformation' :: PhoneNumberInformation -> Maybe [NumberCapability]
numberCapabilities} -> Maybe [NumberCapability]
numberCapabilities) (\s :: PhoneNumberInformation
s@PhoneNumberInformation' {} Maybe [NumberCapability]
a -> PhoneNumberInformation
s {$sel:numberCapabilities:PhoneNumberInformation' :: Maybe [NumberCapability]
numberCapabilities = Maybe [NumberCapability]
a} :: PhoneNumberInformation) ((Maybe [NumberCapability] -> f (Maybe [NumberCapability]))
-> PhoneNumberInformation -> f PhoneNumberInformation)
-> ((Maybe [NumberCapability] -> f (Maybe [NumberCapability]))
-> Maybe [NumberCapability] -> f (Maybe [NumberCapability]))
-> (Maybe [NumberCapability] -> f (Maybe [NumberCapability]))
-> PhoneNumberInformation
-> f PhoneNumberInformation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[NumberCapability]
[NumberCapability]
[NumberCapability]
[NumberCapability]
-> Iso
(Maybe [NumberCapability])
(Maybe [NumberCapability])
(Maybe [NumberCapability])
(Maybe [NumberCapability])
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
[NumberCapability]
[NumberCapability]
[NumberCapability]
[NumberCapability]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
phoneNumberInformation_routeType :: Lens.Lens' PhoneNumberInformation (Prelude.Maybe RouteType)
phoneNumberInformation_routeType :: (Maybe RouteType -> f (Maybe RouteType))
-> PhoneNumberInformation -> f PhoneNumberInformation
phoneNumberInformation_routeType = (PhoneNumberInformation -> Maybe RouteType)
-> (PhoneNumberInformation
-> Maybe RouteType -> PhoneNumberInformation)
-> Lens
PhoneNumberInformation
PhoneNumberInformation
(Maybe RouteType)
(Maybe RouteType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhoneNumberInformation' {Maybe RouteType
routeType :: Maybe RouteType
$sel:routeType:PhoneNumberInformation' :: PhoneNumberInformation -> Maybe RouteType
routeType} -> Maybe RouteType
routeType) (\s :: PhoneNumberInformation
s@PhoneNumberInformation' {} Maybe RouteType
a -> PhoneNumberInformation
s {$sel:routeType:PhoneNumberInformation' :: Maybe RouteType
routeType = Maybe RouteType
a} :: PhoneNumberInformation)
instance Core.FromXML PhoneNumberInformation where
parseXML :: [Node] -> Either String PhoneNumberInformation
parseXML [Node]
x =
Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe [NumberCapability]
-> Maybe RouteType
-> PhoneNumberInformation
PhoneNumberInformation'
(Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe [NumberCapability]
-> Maybe RouteType
-> PhoneNumberInformation)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe [NumberCapability]
-> Maybe RouteType
-> PhoneNumberInformation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
Either
String
(Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe [NumberCapability]
-> Maybe RouteType
-> PhoneNumberInformation)
-> Either String (Maybe Text)
-> Either
String
(Maybe ISO8601
-> Maybe Text
-> Maybe [NumberCapability]
-> Maybe RouteType
-> PhoneNumberInformation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Iso2CountryCode")
Either
String
(Maybe ISO8601
-> Maybe Text
-> Maybe [NumberCapability]
-> Maybe RouteType
-> PhoneNumberInformation)
-> Either String (Maybe ISO8601)
-> Either
String
(Maybe Text
-> Maybe [NumberCapability]
-> Maybe RouteType
-> PhoneNumberInformation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CreatedAt")
Either
String
(Maybe Text
-> Maybe [NumberCapability]
-> Maybe RouteType
-> PhoneNumberInformation)
-> Either String (Maybe Text)
-> Either
String
(Maybe [NumberCapability]
-> Maybe RouteType -> PhoneNumberInformation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PhoneNumber")
Either
String
(Maybe [NumberCapability]
-> Maybe RouteType -> PhoneNumberInformation)
-> Either String (Maybe [NumberCapability])
-> Either String (Maybe RouteType -> PhoneNumberInformation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NumberCapabilities"
Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [NumberCapability]))
-> Either String (Maybe [NumberCapability])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [NumberCapability])
-> [Node] -> Either String (Maybe [NumberCapability])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [NumberCapability]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe RouteType -> PhoneNumberInformation)
-> Either String (Maybe RouteType)
-> Either String PhoneNumberInformation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe RouteType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"RouteType")
instance Prelude.Hashable PhoneNumberInformation
instance Prelude.NFData PhoneNumberInformation