{-# 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.GroundStation.Types.DataflowEndpoint where
import qualified Amazonka.Core as Core
import Amazonka.GroundStation.Types.EndpointStatus
import Amazonka.GroundStation.Types.SocketAddress
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DataflowEndpoint = DataflowEndpoint'
{
DataflowEndpoint -> Maybe Natural
mtu :: Prelude.Maybe Prelude.Natural,
DataflowEndpoint -> Maybe EndpointStatus
status :: Prelude.Maybe EndpointStatus,
DataflowEndpoint -> Maybe SocketAddress
address :: Prelude.Maybe SocketAddress,
DataflowEndpoint -> Maybe Text
name :: Prelude.Maybe Prelude.Text
}
deriving (DataflowEndpoint -> DataflowEndpoint -> Bool
(DataflowEndpoint -> DataflowEndpoint -> Bool)
-> (DataflowEndpoint -> DataflowEndpoint -> Bool)
-> Eq DataflowEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataflowEndpoint -> DataflowEndpoint -> Bool
$c/= :: DataflowEndpoint -> DataflowEndpoint -> Bool
== :: DataflowEndpoint -> DataflowEndpoint -> Bool
$c== :: DataflowEndpoint -> DataflowEndpoint -> Bool
Prelude.Eq, ReadPrec [DataflowEndpoint]
ReadPrec DataflowEndpoint
Int -> ReadS DataflowEndpoint
ReadS [DataflowEndpoint]
(Int -> ReadS DataflowEndpoint)
-> ReadS [DataflowEndpoint]
-> ReadPrec DataflowEndpoint
-> ReadPrec [DataflowEndpoint]
-> Read DataflowEndpoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataflowEndpoint]
$creadListPrec :: ReadPrec [DataflowEndpoint]
readPrec :: ReadPrec DataflowEndpoint
$creadPrec :: ReadPrec DataflowEndpoint
readList :: ReadS [DataflowEndpoint]
$creadList :: ReadS [DataflowEndpoint]
readsPrec :: Int -> ReadS DataflowEndpoint
$creadsPrec :: Int -> ReadS DataflowEndpoint
Prelude.Read, Int -> DataflowEndpoint -> ShowS
[DataflowEndpoint] -> ShowS
DataflowEndpoint -> String
(Int -> DataflowEndpoint -> ShowS)
-> (DataflowEndpoint -> String)
-> ([DataflowEndpoint] -> ShowS)
-> Show DataflowEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataflowEndpoint] -> ShowS
$cshowList :: [DataflowEndpoint] -> ShowS
show :: DataflowEndpoint -> String
$cshow :: DataflowEndpoint -> String
showsPrec :: Int -> DataflowEndpoint -> ShowS
$cshowsPrec :: Int -> DataflowEndpoint -> ShowS
Prelude.Show, (forall x. DataflowEndpoint -> Rep DataflowEndpoint x)
-> (forall x. Rep DataflowEndpoint x -> DataflowEndpoint)
-> Generic DataflowEndpoint
forall x. Rep DataflowEndpoint x -> DataflowEndpoint
forall x. DataflowEndpoint -> Rep DataflowEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataflowEndpoint x -> DataflowEndpoint
$cfrom :: forall x. DataflowEndpoint -> Rep DataflowEndpoint x
Prelude.Generic)
newDataflowEndpoint ::
DataflowEndpoint
newDataflowEndpoint :: DataflowEndpoint
newDataflowEndpoint =
DataflowEndpoint' :: Maybe Natural
-> Maybe EndpointStatus
-> Maybe SocketAddress
-> Maybe Text
-> DataflowEndpoint
DataflowEndpoint'
{ $sel:mtu:DataflowEndpoint' :: Maybe Natural
mtu = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:status:DataflowEndpoint' :: Maybe EndpointStatus
status = Maybe EndpointStatus
forall a. Maybe a
Prelude.Nothing,
$sel:address:DataflowEndpoint' :: Maybe SocketAddress
address = Maybe SocketAddress
forall a. Maybe a
Prelude.Nothing,
$sel:name:DataflowEndpoint' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
dataflowEndpoint_mtu :: Lens.Lens' DataflowEndpoint (Prelude.Maybe Prelude.Natural)
dataflowEndpoint_mtu :: (Maybe Natural -> f (Maybe Natural))
-> DataflowEndpoint -> f DataflowEndpoint
dataflowEndpoint_mtu = (DataflowEndpoint -> Maybe Natural)
-> (DataflowEndpoint -> Maybe Natural -> DataflowEndpoint)
-> Lens
DataflowEndpoint DataflowEndpoint (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataflowEndpoint' {Maybe Natural
mtu :: Maybe Natural
$sel:mtu:DataflowEndpoint' :: DataflowEndpoint -> Maybe Natural
mtu} -> Maybe Natural
mtu) (\s :: DataflowEndpoint
s@DataflowEndpoint' {} Maybe Natural
a -> DataflowEndpoint
s {$sel:mtu:DataflowEndpoint' :: Maybe Natural
mtu = Maybe Natural
a} :: DataflowEndpoint)
dataflowEndpoint_status :: Lens.Lens' DataflowEndpoint (Prelude.Maybe EndpointStatus)
dataflowEndpoint_status :: (Maybe EndpointStatus -> f (Maybe EndpointStatus))
-> DataflowEndpoint -> f DataflowEndpoint
dataflowEndpoint_status = (DataflowEndpoint -> Maybe EndpointStatus)
-> (DataflowEndpoint -> Maybe EndpointStatus -> DataflowEndpoint)
-> Lens
DataflowEndpoint
DataflowEndpoint
(Maybe EndpointStatus)
(Maybe EndpointStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataflowEndpoint' {Maybe EndpointStatus
status :: Maybe EndpointStatus
$sel:status:DataflowEndpoint' :: DataflowEndpoint -> Maybe EndpointStatus
status} -> Maybe EndpointStatus
status) (\s :: DataflowEndpoint
s@DataflowEndpoint' {} Maybe EndpointStatus
a -> DataflowEndpoint
s {$sel:status:DataflowEndpoint' :: Maybe EndpointStatus
status = Maybe EndpointStatus
a} :: DataflowEndpoint)
dataflowEndpoint_address :: Lens.Lens' DataflowEndpoint (Prelude.Maybe SocketAddress)
dataflowEndpoint_address :: (Maybe SocketAddress -> f (Maybe SocketAddress))
-> DataflowEndpoint -> f DataflowEndpoint
dataflowEndpoint_address = (DataflowEndpoint -> Maybe SocketAddress)
-> (DataflowEndpoint -> Maybe SocketAddress -> DataflowEndpoint)
-> Lens
DataflowEndpoint
DataflowEndpoint
(Maybe SocketAddress)
(Maybe SocketAddress)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataflowEndpoint' {Maybe SocketAddress
address :: Maybe SocketAddress
$sel:address:DataflowEndpoint' :: DataflowEndpoint -> Maybe SocketAddress
address} -> Maybe SocketAddress
address) (\s :: DataflowEndpoint
s@DataflowEndpoint' {} Maybe SocketAddress
a -> DataflowEndpoint
s {$sel:address:DataflowEndpoint' :: Maybe SocketAddress
address = Maybe SocketAddress
a} :: DataflowEndpoint)
dataflowEndpoint_name :: Lens.Lens' DataflowEndpoint (Prelude.Maybe Prelude.Text)
dataflowEndpoint_name :: (Maybe Text -> f (Maybe Text))
-> DataflowEndpoint -> f DataflowEndpoint
dataflowEndpoint_name = (DataflowEndpoint -> Maybe Text)
-> (DataflowEndpoint -> Maybe Text -> DataflowEndpoint)
-> Lens DataflowEndpoint DataflowEndpoint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataflowEndpoint' {Maybe Text
name :: Maybe Text
$sel:name:DataflowEndpoint' :: DataflowEndpoint -> Maybe Text
name} -> Maybe Text
name) (\s :: DataflowEndpoint
s@DataflowEndpoint' {} Maybe Text
a -> DataflowEndpoint
s {$sel:name:DataflowEndpoint' :: Maybe Text
name = Maybe Text
a} :: DataflowEndpoint)
instance Core.FromJSON DataflowEndpoint where
parseJSON :: Value -> Parser DataflowEndpoint
parseJSON =
String
-> (Object -> Parser DataflowEndpoint)
-> Value
-> Parser DataflowEndpoint
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"DataflowEndpoint"
( \Object
x ->
Maybe Natural
-> Maybe EndpointStatus
-> Maybe SocketAddress
-> Maybe Text
-> DataflowEndpoint
DataflowEndpoint'
(Maybe Natural
-> Maybe EndpointStatus
-> Maybe SocketAddress
-> Maybe Text
-> DataflowEndpoint)
-> Parser (Maybe Natural)
-> Parser
(Maybe EndpointStatus
-> Maybe SocketAddress -> Maybe Text -> DataflowEndpoint)
forall (f :: * -> *) a b. Functor 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
"mtu")
Parser
(Maybe EndpointStatus
-> Maybe SocketAddress -> Maybe Text -> DataflowEndpoint)
-> Parser (Maybe EndpointStatus)
-> Parser (Maybe SocketAddress -> Maybe Text -> DataflowEndpoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EndpointStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
Parser (Maybe SocketAddress -> Maybe Text -> DataflowEndpoint)
-> Parser (Maybe SocketAddress)
-> Parser (Maybe Text -> DataflowEndpoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SocketAddress)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"address")
Parser (Maybe Text -> DataflowEndpoint)
-> Parser (Maybe Text) -> Parser DataflowEndpoint
forall (f :: * -> *) a b. Applicative f => 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
"name")
)
instance Prelude.Hashable DataflowEndpoint
instance Prelude.NFData DataflowEndpoint
instance Core.ToJSON DataflowEndpoint where
toJSON :: DataflowEndpoint -> Value
toJSON DataflowEndpoint' {Maybe Natural
Maybe Text
Maybe EndpointStatus
Maybe SocketAddress
name :: Maybe Text
address :: Maybe SocketAddress
status :: Maybe EndpointStatus
mtu :: Maybe Natural
$sel:name:DataflowEndpoint' :: DataflowEndpoint -> Maybe Text
$sel:address:DataflowEndpoint' :: DataflowEndpoint -> Maybe SocketAddress
$sel:status:DataflowEndpoint' :: DataflowEndpoint -> Maybe EndpointStatus
$sel:mtu:DataflowEndpoint' :: DataflowEndpoint -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"mtu" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
mtu,
(Text
"status" Text -> EndpointStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EndpointStatus -> Pair) -> Maybe EndpointStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndpointStatus
status,
(Text
"address" Text -> SocketAddress -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SocketAddress -> Pair) -> Maybe SocketAddress -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SocketAddress
address,
(Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name
]
)