{-# 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.MGN.Types.NetworkInterface where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data NetworkInterface = NetworkInterface'
{
NetworkInterface -> Maybe [Text]
ips :: Prelude.Maybe [Prelude.Text],
NetworkInterface -> Maybe Text
macAddress :: Prelude.Maybe Prelude.Text,
NetworkInterface -> Maybe Bool
isPrimary :: Prelude.Maybe Prelude.Bool
}
deriving (NetworkInterface -> NetworkInterface -> Bool
(NetworkInterface -> NetworkInterface -> Bool)
-> (NetworkInterface -> NetworkInterface -> Bool)
-> Eq NetworkInterface
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkInterface -> NetworkInterface -> Bool
$c/= :: NetworkInterface -> NetworkInterface -> Bool
== :: NetworkInterface -> NetworkInterface -> Bool
$c== :: NetworkInterface -> NetworkInterface -> Bool
Prelude.Eq, ReadPrec [NetworkInterface]
ReadPrec NetworkInterface
Int -> ReadS NetworkInterface
ReadS [NetworkInterface]
(Int -> ReadS NetworkInterface)
-> ReadS [NetworkInterface]
-> ReadPrec NetworkInterface
-> ReadPrec [NetworkInterface]
-> Read NetworkInterface
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkInterface]
$creadListPrec :: ReadPrec [NetworkInterface]
readPrec :: ReadPrec NetworkInterface
$creadPrec :: ReadPrec NetworkInterface
readList :: ReadS [NetworkInterface]
$creadList :: ReadS [NetworkInterface]
readsPrec :: Int -> ReadS NetworkInterface
$creadsPrec :: Int -> ReadS NetworkInterface
Prelude.Read, Int -> NetworkInterface -> ShowS
[NetworkInterface] -> ShowS
NetworkInterface -> String
(Int -> NetworkInterface -> ShowS)
-> (NetworkInterface -> String)
-> ([NetworkInterface] -> ShowS)
-> Show NetworkInterface
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkInterface] -> ShowS
$cshowList :: [NetworkInterface] -> ShowS
show :: NetworkInterface -> String
$cshow :: NetworkInterface -> String
showsPrec :: Int -> NetworkInterface -> ShowS
$cshowsPrec :: Int -> NetworkInterface -> ShowS
Prelude.Show, (forall x. NetworkInterface -> Rep NetworkInterface x)
-> (forall x. Rep NetworkInterface x -> NetworkInterface)
-> Generic NetworkInterface
forall x. Rep NetworkInterface x -> NetworkInterface
forall x. NetworkInterface -> Rep NetworkInterface x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NetworkInterface x -> NetworkInterface
$cfrom :: forall x. NetworkInterface -> Rep NetworkInterface x
Prelude.Generic)
newNetworkInterface ::
NetworkInterface
newNetworkInterface :: NetworkInterface
newNetworkInterface =
NetworkInterface' :: Maybe [Text] -> Maybe Text -> Maybe Bool -> NetworkInterface
NetworkInterface'
{ $sel:ips:NetworkInterface' :: Maybe [Text]
ips = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:macAddress:NetworkInterface' :: Maybe Text
macAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:isPrimary:NetworkInterface' :: Maybe Bool
isPrimary = Maybe Bool
forall a. Maybe a
Prelude.Nothing
}
networkInterface_ips :: Lens.Lens' NetworkInterface (Prelude.Maybe [Prelude.Text])
networkInterface_ips :: (Maybe [Text] -> f (Maybe [Text]))
-> NetworkInterface -> f NetworkInterface
networkInterface_ips = (NetworkInterface -> Maybe [Text])
-> (NetworkInterface -> Maybe [Text] -> NetworkInterface)
-> Lens
NetworkInterface NetworkInterface (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterface' {Maybe [Text]
ips :: Maybe [Text]
$sel:ips:NetworkInterface' :: NetworkInterface -> Maybe [Text]
ips} -> Maybe [Text]
ips) (\s :: NetworkInterface
s@NetworkInterface' {} Maybe [Text]
a -> NetworkInterface
s {$sel:ips:NetworkInterface' :: Maybe [Text]
ips = Maybe [Text]
a} :: NetworkInterface) ((Maybe [Text] -> f (Maybe [Text]))
-> NetworkInterface -> f NetworkInterface)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> NetworkInterface
-> f NetworkInterface
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
networkInterface_macAddress :: Lens.Lens' NetworkInterface (Prelude.Maybe Prelude.Text)
networkInterface_macAddress :: (Maybe Text -> f (Maybe Text))
-> NetworkInterface -> f NetworkInterface
networkInterface_macAddress = (NetworkInterface -> Maybe Text)
-> (NetworkInterface -> Maybe Text -> NetworkInterface)
-> Lens NetworkInterface NetworkInterface (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterface' {Maybe Text
macAddress :: Maybe Text
$sel:macAddress:NetworkInterface' :: NetworkInterface -> Maybe Text
macAddress} -> Maybe Text
macAddress) (\s :: NetworkInterface
s@NetworkInterface' {} Maybe Text
a -> NetworkInterface
s {$sel:macAddress:NetworkInterface' :: Maybe Text
macAddress = Maybe Text
a} :: NetworkInterface)
networkInterface_isPrimary :: Lens.Lens' NetworkInterface (Prelude.Maybe Prelude.Bool)
networkInterface_isPrimary :: (Maybe Bool -> f (Maybe Bool))
-> NetworkInterface -> f NetworkInterface
networkInterface_isPrimary = (NetworkInterface -> Maybe Bool)
-> (NetworkInterface -> Maybe Bool -> NetworkInterface)
-> Lens NetworkInterface NetworkInterface (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkInterface' {Maybe Bool
isPrimary :: Maybe Bool
$sel:isPrimary:NetworkInterface' :: NetworkInterface -> Maybe Bool
isPrimary} -> Maybe Bool
isPrimary) (\s :: NetworkInterface
s@NetworkInterface' {} Maybe Bool
a -> NetworkInterface
s {$sel:isPrimary:NetworkInterface' :: Maybe Bool
isPrimary = Maybe Bool
a} :: NetworkInterface)
instance Core.FromJSON NetworkInterface where
parseJSON :: Value -> Parser NetworkInterface
parseJSON =
String
-> (Object -> Parser NetworkInterface)
-> Value
-> Parser NetworkInterface
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"NetworkInterface"
( \Object
x ->
Maybe [Text] -> Maybe Text -> Maybe Bool -> NetworkInterface
NetworkInterface'
(Maybe [Text] -> Maybe Text -> Maybe Bool -> NetworkInterface)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Maybe Bool -> NetworkInterface)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ips" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> Maybe Bool -> NetworkInterface)
-> Parser (Maybe Text) -> Parser (Maybe Bool -> NetworkInterface)
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
"macAddress")
Parser (Maybe Bool -> NetworkInterface)
-> Parser (Maybe Bool) -> Parser NetworkInterface
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isPrimary")
)
instance Prelude.Hashable NetworkInterface
instance Prelude.NFData NetworkInterface