{-# 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.Lightsail.Types.InstancePortState where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.NetworkProtocol
import Amazonka.Lightsail.Types.PortState
import qualified Amazonka.Prelude as Prelude
data InstancePortState = InstancePortState'
{
InstancePortState -> Maybe Int
fromPort :: Prelude.Maybe Prelude.Int,
InstancePortState -> Maybe [Text]
cidrs :: Prelude.Maybe [Prelude.Text],
InstancePortState -> Maybe PortState
state :: Prelude.Maybe PortState,
InstancePortState -> Maybe NetworkProtocol
protocol :: Prelude.Maybe NetworkProtocol,
InstancePortState -> Maybe [Text]
cidrListAliases :: Prelude.Maybe [Prelude.Text],
InstancePortState -> Maybe [Text]
ipv6Cidrs :: Prelude.Maybe [Prelude.Text],
InstancePortState -> Maybe Int
toPort :: Prelude.Maybe Prelude.Int
}
deriving (InstancePortState -> InstancePortState -> Bool
(InstancePortState -> InstancePortState -> Bool)
-> (InstancePortState -> InstancePortState -> Bool)
-> Eq InstancePortState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstancePortState -> InstancePortState -> Bool
$c/= :: InstancePortState -> InstancePortState -> Bool
== :: InstancePortState -> InstancePortState -> Bool
$c== :: InstancePortState -> InstancePortState -> Bool
Prelude.Eq, ReadPrec [InstancePortState]
ReadPrec InstancePortState
Int -> ReadS InstancePortState
ReadS [InstancePortState]
(Int -> ReadS InstancePortState)
-> ReadS [InstancePortState]
-> ReadPrec InstancePortState
-> ReadPrec [InstancePortState]
-> Read InstancePortState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstancePortState]
$creadListPrec :: ReadPrec [InstancePortState]
readPrec :: ReadPrec InstancePortState
$creadPrec :: ReadPrec InstancePortState
readList :: ReadS [InstancePortState]
$creadList :: ReadS [InstancePortState]
readsPrec :: Int -> ReadS InstancePortState
$creadsPrec :: Int -> ReadS InstancePortState
Prelude.Read, Int -> InstancePortState -> ShowS
[InstancePortState] -> ShowS
InstancePortState -> String
(Int -> InstancePortState -> ShowS)
-> (InstancePortState -> String)
-> ([InstancePortState] -> ShowS)
-> Show InstancePortState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstancePortState] -> ShowS
$cshowList :: [InstancePortState] -> ShowS
show :: InstancePortState -> String
$cshow :: InstancePortState -> String
showsPrec :: Int -> InstancePortState -> ShowS
$cshowsPrec :: Int -> InstancePortState -> ShowS
Prelude.Show, (forall x. InstancePortState -> Rep InstancePortState x)
-> (forall x. Rep InstancePortState x -> InstancePortState)
-> Generic InstancePortState
forall x. Rep InstancePortState x -> InstancePortState
forall x. InstancePortState -> Rep InstancePortState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstancePortState x -> InstancePortState
$cfrom :: forall x. InstancePortState -> Rep InstancePortState x
Prelude.Generic)
newInstancePortState ::
InstancePortState
newInstancePortState :: InstancePortState
newInstancePortState =
InstancePortState' :: Maybe Int
-> Maybe [Text]
-> Maybe PortState
-> Maybe NetworkProtocol
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> InstancePortState
InstancePortState'
{ $sel:fromPort:InstancePortState' :: Maybe Int
fromPort = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:cidrs:InstancePortState' :: Maybe [Text]
cidrs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:state:InstancePortState' :: Maybe PortState
state = Maybe PortState
forall a. Maybe a
Prelude.Nothing,
$sel:protocol:InstancePortState' :: Maybe NetworkProtocol
protocol = Maybe NetworkProtocol
forall a. Maybe a
Prelude.Nothing,
$sel:cidrListAliases:InstancePortState' :: Maybe [Text]
cidrListAliases = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:ipv6Cidrs:InstancePortState' :: Maybe [Text]
ipv6Cidrs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:toPort:InstancePortState' :: Maybe Int
toPort = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
instancePortState_fromPort :: Lens.Lens' InstancePortState (Prelude.Maybe Prelude.Int)
instancePortState_fromPort :: (Maybe Int -> f (Maybe Int))
-> InstancePortState -> f InstancePortState
instancePortState_fromPort = (InstancePortState -> Maybe Int)
-> (InstancePortState -> Maybe Int -> InstancePortState)
-> Lens InstancePortState InstancePortState (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe Int
fromPort :: Maybe Int
$sel:fromPort:InstancePortState' :: InstancePortState -> Maybe Int
fromPort} -> Maybe Int
fromPort) (\s :: InstancePortState
s@InstancePortState' {} Maybe Int
a -> InstancePortState
s {$sel:fromPort:InstancePortState' :: Maybe Int
fromPort = Maybe Int
a} :: InstancePortState)
instancePortState_cidrs :: Lens.Lens' InstancePortState (Prelude.Maybe [Prelude.Text])
instancePortState_cidrs :: (Maybe [Text] -> f (Maybe [Text]))
-> InstancePortState -> f InstancePortState
instancePortState_cidrs = (InstancePortState -> Maybe [Text])
-> (InstancePortState -> Maybe [Text] -> InstancePortState)
-> Lens
InstancePortState InstancePortState (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe [Text]
cidrs :: Maybe [Text]
$sel:cidrs:InstancePortState' :: InstancePortState -> Maybe [Text]
cidrs} -> Maybe [Text]
cidrs) (\s :: InstancePortState
s@InstancePortState' {} Maybe [Text]
a -> InstancePortState
s {$sel:cidrs:InstancePortState' :: Maybe [Text]
cidrs = Maybe [Text]
a} :: InstancePortState) ((Maybe [Text] -> f (Maybe [Text]))
-> InstancePortState -> f InstancePortState)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> InstancePortState
-> f InstancePortState
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
instancePortState_state :: Lens.Lens' InstancePortState (Prelude.Maybe PortState)
instancePortState_state :: (Maybe PortState -> f (Maybe PortState))
-> InstancePortState -> f InstancePortState
instancePortState_state = (InstancePortState -> Maybe PortState)
-> (InstancePortState -> Maybe PortState -> InstancePortState)
-> Lens
InstancePortState
InstancePortState
(Maybe PortState)
(Maybe PortState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe PortState
state :: Maybe PortState
$sel:state:InstancePortState' :: InstancePortState -> Maybe PortState
state} -> Maybe PortState
state) (\s :: InstancePortState
s@InstancePortState' {} Maybe PortState
a -> InstancePortState
s {$sel:state:InstancePortState' :: Maybe PortState
state = Maybe PortState
a} :: InstancePortState)
instancePortState_protocol :: Lens.Lens' InstancePortState (Prelude.Maybe NetworkProtocol)
instancePortState_protocol :: (Maybe NetworkProtocol -> f (Maybe NetworkProtocol))
-> InstancePortState -> f InstancePortState
instancePortState_protocol = (InstancePortState -> Maybe NetworkProtocol)
-> (InstancePortState
-> Maybe NetworkProtocol -> InstancePortState)
-> Lens
InstancePortState
InstancePortState
(Maybe NetworkProtocol)
(Maybe NetworkProtocol)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe NetworkProtocol
protocol :: Maybe NetworkProtocol
$sel:protocol:InstancePortState' :: InstancePortState -> Maybe NetworkProtocol
protocol} -> Maybe NetworkProtocol
protocol) (\s :: InstancePortState
s@InstancePortState' {} Maybe NetworkProtocol
a -> InstancePortState
s {$sel:protocol:InstancePortState' :: Maybe NetworkProtocol
protocol = Maybe NetworkProtocol
a} :: InstancePortState)
instancePortState_cidrListAliases :: Lens.Lens' InstancePortState (Prelude.Maybe [Prelude.Text])
instancePortState_cidrListAliases :: (Maybe [Text] -> f (Maybe [Text]))
-> InstancePortState -> f InstancePortState
instancePortState_cidrListAliases = (InstancePortState -> Maybe [Text])
-> (InstancePortState -> Maybe [Text] -> InstancePortState)
-> Lens
InstancePortState InstancePortState (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe [Text]
cidrListAliases :: Maybe [Text]
$sel:cidrListAliases:InstancePortState' :: InstancePortState -> Maybe [Text]
cidrListAliases} -> Maybe [Text]
cidrListAliases) (\s :: InstancePortState
s@InstancePortState' {} Maybe [Text]
a -> InstancePortState
s {$sel:cidrListAliases:InstancePortState' :: Maybe [Text]
cidrListAliases = Maybe [Text]
a} :: InstancePortState) ((Maybe [Text] -> f (Maybe [Text]))
-> InstancePortState -> f InstancePortState)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> InstancePortState
-> f InstancePortState
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
instancePortState_ipv6Cidrs :: Lens.Lens' InstancePortState (Prelude.Maybe [Prelude.Text])
instancePortState_ipv6Cidrs :: (Maybe [Text] -> f (Maybe [Text]))
-> InstancePortState -> f InstancePortState
instancePortState_ipv6Cidrs = (InstancePortState -> Maybe [Text])
-> (InstancePortState -> Maybe [Text] -> InstancePortState)
-> Lens
InstancePortState InstancePortState (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe [Text]
ipv6Cidrs :: Maybe [Text]
$sel:ipv6Cidrs:InstancePortState' :: InstancePortState -> Maybe [Text]
ipv6Cidrs} -> Maybe [Text]
ipv6Cidrs) (\s :: InstancePortState
s@InstancePortState' {} Maybe [Text]
a -> InstancePortState
s {$sel:ipv6Cidrs:InstancePortState' :: Maybe [Text]
ipv6Cidrs = Maybe [Text]
a} :: InstancePortState) ((Maybe [Text] -> f (Maybe [Text]))
-> InstancePortState -> f InstancePortState)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> InstancePortState
-> f InstancePortState
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
instancePortState_toPort :: Lens.Lens' InstancePortState (Prelude.Maybe Prelude.Int)
instancePortState_toPort :: (Maybe Int -> f (Maybe Int))
-> InstancePortState -> f InstancePortState
instancePortState_toPort = (InstancePortState -> Maybe Int)
-> (InstancePortState -> Maybe Int -> InstancePortState)
-> Lens InstancePortState InstancePortState (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe Int
toPort :: Maybe Int
$sel:toPort:InstancePortState' :: InstancePortState -> Maybe Int
toPort} -> Maybe Int
toPort) (\s :: InstancePortState
s@InstancePortState' {} Maybe Int
a -> InstancePortState
s {$sel:toPort:InstancePortState' :: Maybe Int
toPort = Maybe Int
a} :: InstancePortState)
instance Core.FromJSON InstancePortState where
parseJSON :: Value -> Parser InstancePortState
parseJSON =
String
-> (Object -> Parser InstancePortState)
-> Value
-> Parser InstancePortState
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"InstancePortState"
( \Object
x ->
Maybe Int
-> Maybe [Text]
-> Maybe PortState
-> Maybe NetworkProtocol
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> InstancePortState
InstancePortState'
(Maybe Int
-> Maybe [Text]
-> Maybe PortState
-> Maybe NetworkProtocol
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> InstancePortState)
-> Parser (Maybe Int)
-> Parser
(Maybe [Text]
-> Maybe PortState
-> Maybe NetworkProtocol
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> InstancePortState)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fromPort")
Parser
(Maybe [Text]
-> Maybe PortState
-> Maybe NetworkProtocol
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> InstancePortState)
-> Parser (Maybe [Text])
-> Parser
(Maybe PortState
-> Maybe NetworkProtocol
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> InstancePortState)
forall (f :: * -> *) a b. Applicative f => 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
"cidrs" 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 PortState
-> Maybe NetworkProtocol
-> Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> InstancePortState)
-> Parser (Maybe PortState)
-> Parser
(Maybe NetworkProtocol
-> Maybe [Text] -> Maybe [Text] -> Maybe Int -> InstancePortState)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PortState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
Parser
(Maybe NetworkProtocol
-> Maybe [Text] -> Maybe [Text] -> Maybe Int -> InstancePortState)
-> Parser (Maybe NetworkProtocol)
-> Parser
(Maybe [Text] -> Maybe [Text] -> Maybe Int -> InstancePortState)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe NetworkProtocol)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"protocol")
Parser
(Maybe [Text] -> Maybe [Text] -> Maybe Int -> InstancePortState)
-> Parser (Maybe [Text])
-> Parser (Maybe [Text] -> Maybe Int -> InstancePortState)
forall (f :: * -> *) a b. Applicative f => 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
"cidrListAliases"
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 Int -> InstancePortState)
-> Parser (Maybe [Text]) -> Parser (Maybe Int -> InstancePortState)
forall (f :: * -> *) a b. Applicative f => 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
"ipv6Cidrs" 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 Int -> InstancePortState)
-> Parser (Maybe Int) -> Parser InstancePortState
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"toPort")
)
instance Prelude.Hashable InstancePortState
instance Prelude.NFData InstancePortState