{-# 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.GlobalAccelerator.Types.SocketAddress where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SocketAddress = SocketAddress'
{
SocketAddress -> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text,
SocketAddress -> Maybe Natural
port :: Prelude.Maybe Prelude.Natural
}
deriving (SocketAddress -> SocketAddress -> Bool
(SocketAddress -> SocketAddress -> Bool)
-> (SocketAddress -> SocketAddress -> Bool) -> Eq SocketAddress
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SocketAddress -> SocketAddress -> Bool
$c/= :: SocketAddress -> SocketAddress -> Bool
== :: SocketAddress -> SocketAddress -> Bool
$c== :: SocketAddress -> SocketAddress -> Bool
Prelude.Eq, ReadPrec [SocketAddress]
ReadPrec SocketAddress
Int -> ReadS SocketAddress
ReadS [SocketAddress]
(Int -> ReadS SocketAddress)
-> ReadS [SocketAddress]
-> ReadPrec SocketAddress
-> ReadPrec [SocketAddress]
-> Read SocketAddress
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SocketAddress]
$creadListPrec :: ReadPrec [SocketAddress]
readPrec :: ReadPrec SocketAddress
$creadPrec :: ReadPrec SocketAddress
readList :: ReadS [SocketAddress]
$creadList :: ReadS [SocketAddress]
readsPrec :: Int -> ReadS SocketAddress
$creadsPrec :: Int -> ReadS SocketAddress
Prelude.Read, Int -> SocketAddress -> ShowS
[SocketAddress] -> ShowS
SocketAddress -> String
(Int -> SocketAddress -> ShowS)
-> (SocketAddress -> String)
-> ([SocketAddress] -> ShowS)
-> Show SocketAddress
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SocketAddress] -> ShowS
$cshowList :: [SocketAddress] -> ShowS
show :: SocketAddress -> String
$cshow :: SocketAddress -> String
showsPrec :: Int -> SocketAddress -> ShowS
$cshowsPrec :: Int -> SocketAddress -> ShowS
Prelude.Show, (forall x. SocketAddress -> Rep SocketAddress x)
-> (forall x. Rep SocketAddress x -> SocketAddress)
-> Generic SocketAddress
forall x. Rep SocketAddress x -> SocketAddress
forall x. SocketAddress -> Rep SocketAddress x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SocketAddress x -> SocketAddress
$cfrom :: forall x. SocketAddress -> Rep SocketAddress x
Prelude.Generic)
newSocketAddress ::
SocketAddress
newSocketAddress :: SocketAddress
newSocketAddress =
SocketAddress' :: Maybe Text -> Maybe Natural -> SocketAddress
SocketAddress'
{ $sel:ipAddress:SocketAddress' :: Maybe Text
ipAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:port:SocketAddress' :: Maybe Natural
port = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
socketAddress_ipAddress :: Lens.Lens' SocketAddress (Prelude.Maybe Prelude.Text)
socketAddress_ipAddress :: (Maybe Text -> f (Maybe Text)) -> SocketAddress -> f SocketAddress
socketAddress_ipAddress = (SocketAddress -> Maybe Text)
-> (SocketAddress -> Maybe Text -> SocketAddress)
-> Lens SocketAddress SocketAddress (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SocketAddress' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:SocketAddress' :: SocketAddress -> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: SocketAddress
s@SocketAddress' {} Maybe Text
a -> SocketAddress
s {$sel:ipAddress:SocketAddress' :: Maybe Text
ipAddress = Maybe Text
a} :: SocketAddress)
socketAddress_port :: Lens.Lens' SocketAddress (Prelude.Maybe Prelude.Natural)
socketAddress_port :: (Maybe Natural -> f (Maybe Natural))
-> SocketAddress -> f SocketAddress
socketAddress_port = (SocketAddress -> Maybe Natural)
-> (SocketAddress -> Maybe Natural -> SocketAddress)
-> Lens SocketAddress SocketAddress (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SocketAddress' {Maybe Natural
port :: Maybe Natural
$sel:port:SocketAddress' :: SocketAddress -> Maybe Natural
port} -> Maybe Natural
port) (\s :: SocketAddress
s@SocketAddress' {} Maybe Natural
a -> SocketAddress
s {$sel:port:SocketAddress' :: Maybe Natural
port = Maybe Natural
a} :: SocketAddress)
instance Core.FromJSON SocketAddress where
parseJSON :: Value -> Parser SocketAddress
parseJSON =
String
-> (Object -> Parser SocketAddress)
-> Value
-> Parser SocketAddress
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SocketAddress"
( \Object
x ->
Maybe Text -> Maybe Natural -> SocketAddress
SocketAddress'
(Maybe Text -> Maybe Natural -> SocketAddress)
-> Parser (Maybe Text) -> Parser (Maybe Natural -> SocketAddress)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IpAddress")
Parser (Maybe Natural -> SocketAddress)
-> Parser (Maybe Natural) -> Parser SocketAddress
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Port")
)
instance Prelude.Hashable SocketAddress
instance Prelude.NFData SocketAddress