{-# 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.InstanceEntry where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.PortInfoSourceType
import qualified Amazonka.Prelude as Prelude
data InstanceEntry = InstanceEntry'
{
InstanceEntry -> Maybe Text
userData :: Prelude.Maybe Prelude.Text,
InstanceEntry -> Text
sourceName :: Prelude.Text,
InstanceEntry -> Text
instanceType :: Prelude.Text,
InstanceEntry -> PortInfoSourceType
portInfoSource :: PortInfoSourceType,
InstanceEntry -> Text
availabilityZone :: Prelude.Text
}
deriving (InstanceEntry -> InstanceEntry -> Bool
(InstanceEntry -> InstanceEntry -> Bool)
-> (InstanceEntry -> InstanceEntry -> Bool) -> Eq InstanceEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceEntry -> InstanceEntry -> Bool
$c/= :: InstanceEntry -> InstanceEntry -> Bool
== :: InstanceEntry -> InstanceEntry -> Bool
$c== :: InstanceEntry -> InstanceEntry -> Bool
Prelude.Eq, ReadPrec [InstanceEntry]
ReadPrec InstanceEntry
Int -> ReadS InstanceEntry
ReadS [InstanceEntry]
(Int -> ReadS InstanceEntry)
-> ReadS [InstanceEntry]
-> ReadPrec InstanceEntry
-> ReadPrec [InstanceEntry]
-> Read InstanceEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceEntry]
$creadListPrec :: ReadPrec [InstanceEntry]
readPrec :: ReadPrec InstanceEntry
$creadPrec :: ReadPrec InstanceEntry
readList :: ReadS [InstanceEntry]
$creadList :: ReadS [InstanceEntry]
readsPrec :: Int -> ReadS InstanceEntry
$creadsPrec :: Int -> ReadS InstanceEntry
Prelude.Read, Int -> InstanceEntry -> ShowS
[InstanceEntry] -> ShowS
InstanceEntry -> String
(Int -> InstanceEntry -> ShowS)
-> (InstanceEntry -> String)
-> ([InstanceEntry] -> ShowS)
-> Show InstanceEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceEntry] -> ShowS
$cshowList :: [InstanceEntry] -> ShowS
show :: InstanceEntry -> String
$cshow :: InstanceEntry -> String
showsPrec :: Int -> InstanceEntry -> ShowS
$cshowsPrec :: Int -> InstanceEntry -> ShowS
Prelude.Show, (forall x. InstanceEntry -> Rep InstanceEntry x)
-> (forall x. Rep InstanceEntry x -> InstanceEntry)
-> Generic InstanceEntry
forall x. Rep InstanceEntry x -> InstanceEntry
forall x. InstanceEntry -> Rep InstanceEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceEntry x -> InstanceEntry
$cfrom :: forall x. InstanceEntry -> Rep InstanceEntry x
Prelude.Generic)
newInstanceEntry ::
Prelude.Text ->
Prelude.Text ->
PortInfoSourceType ->
Prelude.Text ->
InstanceEntry
newInstanceEntry :: Text -> Text -> PortInfoSourceType -> Text -> InstanceEntry
newInstanceEntry
Text
pSourceName_
Text
pInstanceType_
PortInfoSourceType
pPortInfoSource_
Text
pAvailabilityZone_ =
InstanceEntry' :: Maybe Text
-> Text -> Text -> PortInfoSourceType -> Text -> InstanceEntry
InstanceEntry'
{ $sel:userData:InstanceEntry' :: Maybe Text
userData = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sourceName:InstanceEntry' :: Text
sourceName = Text
pSourceName_,
$sel:instanceType:InstanceEntry' :: Text
instanceType = Text
pInstanceType_,
$sel:portInfoSource:InstanceEntry' :: PortInfoSourceType
portInfoSource = PortInfoSourceType
pPortInfoSource_,
$sel:availabilityZone:InstanceEntry' :: Text
availabilityZone = Text
pAvailabilityZone_
}
instanceEntry_userData :: Lens.Lens' InstanceEntry (Prelude.Maybe Prelude.Text)
instanceEntry_userData :: (Maybe Text -> f (Maybe Text)) -> InstanceEntry -> f InstanceEntry
instanceEntry_userData = (InstanceEntry -> Maybe Text)
-> (InstanceEntry -> Maybe Text -> InstanceEntry)
-> Lens InstanceEntry InstanceEntry (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEntry' {Maybe Text
userData :: Maybe Text
$sel:userData:InstanceEntry' :: InstanceEntry -> Maybe Text
userData} -> Maybe Text
userData) (\s :: InstanceEntry
s@InstanceEntry' {} Maybe Text
a -> InstanceEntry
s {$sel:userData:InstanceEntry' :: Maybe Text
userData = Maybe Text
a} :: InstanceEntry)
instanceEntry_sourceName :: Lens.Lens' InstanceEntry Prelude.Text
instanceEntry_sourceName :: (Text -> f Text) -> InstanceEntry -> f InstanceEntry
instanceEntry_sourceName = (InstanceEntry -> Text)
-> (InstanceEntry -> Text -> InstanceEntry)
-> Lens InstanceEntry InstanceEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEntry' {Text
sourceName :: Text
$sel:sourceName:InstanceEntry' :: InstanceEntry -> Text
sourceName} -> Text
sourceName) (\s :: InstanceEntry
s@InstanceEntry' {} Text
a -> InstanceEntry
s {$sel:sourceName:InstanceEntry' :: Text
sourceName = Text
a} :: InstanceEntry)
instanceEntry_instanceType :: Lens.Lens' InstanceEntry Prelude.Text
instanceEntry_instanceType :: (Text -> f Text) -> InstanceEntry -> f InstanceEntry
instanceEntry_instanceType = (InstanceEntry -> Text)
-> (InstanceEntry -> Text -> InstanceEntry)
-> Lens InstanceEntry InstanceEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEntry' {Text
instanceType :: Text
$sel:instanceType:InstanceEntry' :: InstanceEntry -> Text
instanceType} -> Text
instanceType) (\s :: InstanceEntry
s@InstanceEntry' {} Text
a -> InstanceEntry
s {$sel:instanceType:InstanceEntry' :: Text
instanceType = Text
a} :: InstanceEntry)
instanceEntry_portInfoSource :: Lens.Lens' InstanceEntry PortInfoSourceType
instanceEntry_portInfoSource :: (PortInfoSourceType -> f PortInfoSourceType)
-> InstanceEntry -> f InstanceEntry
instanceEntry_portInfoSource = (InstanceEntry -> PortInfoSourceType)
-> (InstanceEntry -> PortInfoSourceType -> InstanceEntry)
-> Lens
InstanceEntry InstanceEntry PortInfoSourceType PortInfoSourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEntry' {PortInfoSourceType
portInfoSource :: PortInfoSourceType
$sel:portInfoSource:InstanceEntry' :: InstanceEntry -> PortInfoSourceType
portInfoSource} -> PortInfoSourceType
portInfoSource) (\s :: InstanceEntry
s@InstanceEntry' {} PortInfoSourceType
a -> InstanceEntry
s {$sel:portInfoSource:InstanceEntry' :: PortInfoSourceType
portInfoSource = PortInfoSourceType
a} :: InstanceEntry)
instanceEntry_availabilityZone :: Lens.Lens' InstanceEntry Prelude.Text
instanceEntry_availabilityZone :: (Text -> f Text) -> InstanceEntry -> f InstanceEntry
instanceEntry_availabilityZone = (InstanceEntry -> Text)
-> (InstanceEntry -> Text -> InstanceEntry)
-> Lens InstanceEntry InstanceEntry Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceEntry' {Text
availabilityZone :: Text
$sel:availabilityZone:InstanceEntry' :: InstanceEntry -> Text
availabilityZone} -> Text
availabilityZone) (\s :: InstanceEntry
s@InstanceEntry' {} Text
a -> InstanceEntry
s {$sel:availabilityZone:InstanceEntry' :: Text
availabilityZone = Text
a} :: InstanceEntry)
instance Prelude.Hashable InstanceEntry
instance Prelude.NFData InstanceEntry
instance Core.ToJSON InstanceEntry where
toJSON :: InstanceEntry -> Value
toJSON InstanceEntry' {Maybe Text
Text
PortInfoSourceType
availabilityZone :: Text
portInfoSource :: PortInfoSourceType
instanceType :: Text
sourceName :: Text
userData :: Maybe Text
$sel:availabilityZone:InstanceEntry' :: InstanceEntry -> Text
$sel:portInfoSource:InstanceEntry' :: InstanceEntry -> PortInfoSourceType
$sel:instanceType:InstanceEntry' :: InstanceEntry -> Text
$sel:sourceName:InstanceEntry' :: InstanceEntry -> Text
$sel:userData:InstanceEntry' :: InstanceEntry -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"userData" 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
userData,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"sourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"instanceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceType),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"portInfoSource" Text -> PortInfoSourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PortInfoSourceType
portInfoSource),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"availabilityZone" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
availabilityZone)
]
)