{-# 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.ELBV2.Types.TargetDescription where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data TargetDescription = TargetDescription'
{
TargetDescription -> Maybe Text
availabilityZone :: Prelude.Maybe Prelude.Text,
TargetDescription -> Maybe Natural
port :: Prelude.Maybe Prelude.Natural,
TargetDescription -> Text
id :: Prelude.Text
}
deriving (TargetDescription -> TargetDescription -> Bool
(TargetDescription -> TargetDescription -> Bool)
-> (TargetDescription -> TargetDescription -> Bool)
-> Eq TargetDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TargetDescription -> TargetDescription -> Bool
$c/= :: TargetDescription -> TargetDescription -> Bool
== :: TargetDescription -> TargetDescription -> Bool
$c== :: TargetDescription -> TargetDescription -> Bool
Prelude.Eq, ReadPrec [TargetDescription]
ReadPrec TargetDescription
Int -> ReadS TargetDescription
ReadS [TargetDescription]
(Int -> ReadS TargetDescription)
-> ReadS [TargetDescription]
-> ReadPrec TargetDescription
-> ReadPrec [TargetDescription]
-> Read TargetDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TargetDescription]
$creadListPrec :: ReadPrec [TargetDescription]
readPrec :: ReadPrec TargetDescription
$creadPrec :: ReadPrec TargetDescription
readList :: ReadS [TargetDescription]
$creadList :: ReadS [TargetDescription]
readsPrec :: Int -> ReadS TargetDescription
$creadsPrec :: Int -> ReadS TargetDescription
Prelude.Read, Int -> TargetDescription -> ShowS
[TargetDescription] -> ShowS
TargetDescription -> String
(Int -> TargetDescription -> ShowS)
-> (TargetDescription -> String)
-> ([TargetDescription] -> ShowS)
-> Show TargetDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TargetDescription] -> ShowS
$cshowList :: [TargetDescription] -> ShowS
show :: TargetDescription -> String
$cshow :: TargetDescription -> String
showsPrec :: Int -> TargetDescription -> ShowS
$cshowsPrec :: Int -> TargetDescription -> ShowS
Prelude.Show, (forall x. TargetDescription -> Rep TargetDescription x)
-> (forall x. Rep TargetDescription x -> TargetDescription)
-> Generic TargetDescription
forall x. Rep TargetDescription x -> TargetDescription
forall x. TargetDescription -> Rep TargetDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TargetDescription x -> TargetDescription
$cfrom :: forall x. TargetDescription -> Rep TargetDescription x
Prelude.Generic)
newTargetDescription ::
Prelude.Text ->
TargetDescription
newTargetDescription :: Text -> TargetDescription
newTargetDescription Text
pId_ =
TargetDescription' :: Maybe Text -> Maybe Natural -> Text -> TargetDescription
TargetDescription'
{ $sel:availabilityZone:TargetDescription' :: Maybe Text
availabilityZone =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:port:TargetDescription' :: Maybe Natural
port = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:id:TargetDescription' :: Text
id = Text
pId_
}
targetDescription_availabilityZone :: Lens.Lens' TargetDescription (Prelude.Maybe Prelude.Text)
targetDescription_availabilityZone :: (Maybe Text -> f (Maybe Text))
-> TargetDescription -> f TargetDescription
targetDescription_availabilityZone = (TargetDescription -> Maybe Text)
-> (TargetDescription -> Maybe Text -> TargetDescription)
-> Lens
TargetDescription TargetDescription (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetDescription' {Maybe Text
availabilityZone :: Maybe Text
$sel:availabilityZone:TargetDescription' :: TargetDescription -> Maybe Text
availabilityZone} -> Maybe Text
availabilityZone) (\s :: TargetDescription
s@TargetDescription' {} Maybe Text
a -> TargetDescription
s {$sel:availabilityZone:TargetDescription' :: Maybe Text
availabilityZone = Maybe Text
a} :: TargetDescription)
targetDescription_port :: Lens.Lens' TargetDescription (Prelude.Maybe Prelude.Natural)
targetDescription_port :: (Maybe Natural -> f (Maybe Natural))
-> TargetDescription -> f TargetDescription
targetDescription_port = (TargetDescription -> Maybe Natural)
-> (TargetDescription -> Maybe Natural -> TargetDescription)
-> Lens
TargetDescription TargetDescription (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetDescription' {Maybe Natural
port :: Maybe Natural
$sel:port:TargetDescription' :: TargetDescription -> Maybe Natural
port} -> Maybe Natural
port) (\s :: TargetDescription
s@TargetDescription' {} Maybe Natural
a -> TargetDescription
s {$sel:port:TargetDescription' :: Maybe Natural
port = Maybe Natural
a} :: TargetDescription)
targetDescription_id :: Lens.Lens' TargetDescription Prelude.Text
targetDescription_id :: (Text -> f Text) -> TargetDescription -> f TargetDescription
targetDescription_id = (TargetDescription -> Text)
-> (TargetDescription -> Text -> TargetDescription)
-> Lens TargetDescription TargetDescription Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TargetDescription' {Text
id :: Text
$sel:id:TargetDescription' :: TargetDescription -> Text
id} -> Text
id) (\s :: TargetDescription
s@TargetDescription' {} Text
a -> TargetDescription
s {$sel:id:TargetDescription' :: Text
id = Text
a} :: TargetDescription)
instance Core.FromXML TargetDescription where
parseXML :: [Node] -> Either String TargetDescription
parseXML [Node]
x =
Maybe Text -> Maybe Natural -> Text -> TargetDescription
TargetDescription'
(Maybe Text -> Maybe Natural -> Text -> TargetDescription)
-> Either String (Maybe Text)
-> Either String (Maybe Natural -> Text -> TargetDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AvailabilityZone")
Either String (Maybe Natural -> Text -> TargetDescription)
-> Either String (Maybe Natural)
-> Either String (Text -> TargetDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Natural)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Port")
Either String (Text -> TargetDescription)
-> Either String Text -> Either String TargetDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
instance Prelude.Hashable TargetDescription
instance Prelude.NFData TargetDescription
instance Core.ToQuery TargetDescription where
toQuery :: TargetDescription -> QueryString
toQuery TargetDescription' {Maybe Natural
Maybe Text
Text
id :: Text
port :: Maybe Natural
availabilityZone :: Maybe Text
$sel:id:TargetDescription' :: TargetDescription -> Text
$sel:port:TargetDescription' :: TargetDescription -> Maybe Natural
$sel:availabilityZone:TargetDescription' :: TargetDescription -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"AvailabilityZone" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
availabilityZone,
ByteString
"Port" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
port,
ByteString
"Id" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
id
]