{-# 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.ECS.Types.LoadBalancer where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LoadBalancer = LoadBalancer'
{
LoadBalancer -> Maybe Text
loadBalancerName :: Prelude.Maybe Prelude.Text,
LoadBalancer -> Maybe Text
containerName :: Prelude.Maybe Prelude.Text,
LoadBalancer -> Maybe Text
targetGroupArn :: Prelude.Maybe Prelude.Text,
LoadBalancer -> Maybe Int
containerPort :: Prelude.Maybe Prelude.Int
}
deriving (LoadBalancer -> LoadBalancer -> Bool
(LoadBalancer -> LoadBalancer -> Bool)
-> (LoadBalancer -> LoadBalancer -> Bool) -> Eq LoadBalancer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoadBalancer -> LoadBalancer -> Bool
$c/= :: LoadBalancer -> LoadBalancer -> Bool
== :: LoadBalancer -> LoadBalancer -> Bool
$c== :: LoadBalancer -> LoadBalancer -> Bool
Prelude.Eq, ReadPrec [LoadBalancer]
ReadPrec LoadBalancer
Int -> ReadS LoadBalancer
ReadS [LoadBalancer]
(Int -> ReadS LoadBalancer)
-> ReadS [LoadBalancer]
-> ReadPrec LoadBalancer
-> ReadPrec [LoadBalancer]
-> Read LoadBalancer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoadBalancer]
$creadListPrec :: ReadPrec [LoadBalancer]
readPrec :: ReadPrec LoadBalancer
$creadPrec :: ReadPrec LoadBalancer
readList :: ReadS [LoadBalancer]
$creadList :: ReadS [LoadBalancer]
readsPrec :: Int -> ReadS LoadBalancer
$creadsPrec :: Int -> ReadS LoadBalancer
Prelude.Read, Int -> LoadBalancer -> ShowS
[LoadBalancer] -> ShowS
LoadBalancer -> String
(Int -> LoadBalancer -> ShowS)
-> (LoadBalancer -> String)
-> ([LoadBalancer] -> ShowS)
-> Show LoadBalancer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoadBalancer] -> ShowS
$cshowList :: [LoadBalancer] -> ShowS
show :: LoadBalancer -> String
$cshow :: LoadBalancer -> String
showsPrec :: Int -> LoadBalancer -> ShowS
$cshowsPrec :: Int -> LoadBalancer -> ShowS
Prelude.Show, (forall x. LoadBalancer -> Rep LoadBalancer x)
-> (forall x. Rep LoadBalancer x -> LoadBalancer)
-> Generic LoadBalancer
forall x. Rep LoadBalancer x -> LoadBalancer
forall x. LoadBalancer -> Rep LoadBalancer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoadBalancer x -> LoadBalancer
$cfrom :: forall x. LoadBalancer -> Rep LoadBalancer x
Prelude.Generic)
newLoadBalancer ::
LoadBalancer
newLoadBalancer :: LoadBalancer
newLoadBalancer =
LoadBalancer' :: Maybe Text -> Maybe Text -> Maybe Text -> Maybe Int -> LoadBalancer
LoadBalancer'
{ $sel:loadBalancerName:LoadBalancer' :: Maybe Text
loadBalancerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:containerName:LoadBalancer' :: Maybe Text
containerName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:targetGroupArn:LoadBalancer' :: Maybe Text
targetGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:containerPort:LoadBalancer' :: Maybe Int
containerPort = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
loadBalancer_loadBalancerName :: Lens.Lens' LoadBalancer (Prelude.Maybe Prelude.Text)
loadBalancer_loadBalancerName :: (Maybe Text -> f (Maybe Text)) -> LoadBalancer -> f LoadBalancer
loadBalancer_loadBalancerName = (LoadBalancer -> Maybe Text)
-> (LoadBalancer -> Maybe Text -> LoadBalancer)
-> Lens LoadBalancer LoadBalancer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancer' {Maybe Text
loadBalancerName :: Maybe Text
$sel:loadBalancerName:LoadBalancer' :: LoadBalancer -> Maybe Text
loadBalancerName} -> Maybe Text
loadBalancerName) (\s :: LoadBalancer
s@LoadBalancer' {} Maybe Text
a -> LoadBalancer
s {$sel:loadBalancerName:LoadBalancer' :: Maybe Text
loadBalancerName = Maybe Text
a} :: LoadBalancer)
loadBalancer_containerName :: Lens.Lens' LoadBalancer (Prelude.Maybe Prelude.Text)
loadBalancer_containerName :: (Maybe Text -> f (Maybe Text)) -> LoadBalancer -> f LoadBalancer
loadBalancer_containerName = (LoadBalancer -> Maybe Text)
-> (LoadBalancer -> Maybe Text -> LoadBalancer)
-> Lens LoadBalancer LoadBalancer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancer' {Maybe Text
containerName :: Maybe Text
$sel:containerName:LoadBalancer' :: LoadBalancer -> Maybe Text
containerName} -> Maybe Text
containerName) (\s :: LoadBalancer
s@LoadBalancer' {} Maybe Text
a -> LoadBalancer
s {$sel:containerName:LoadBalancer' :: Maybe Text
containerName = Maybe Text
a} :: LoadBalancer)
loadBalancer_targetGroupArn :: Lens.Lens' LoadBalancer (Prelude.Maybe Prelude.Text)
loadBalancer_targetGroupArn :: (Maybe Text -> f (Maybe Text)) -> LoadBalancer -> f LoadBalancer
loadBalancer_targetGroupArn = (LoadBalancer -> Maybe Text)
-> (LoadBalancer -> Maybe Text -> LoadBalancer)
-> Lens LoadBalancer LoadBalancer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancer' {Maybe Text
targetGroupArn :: Maybe Text
$sel:targetGroupArn:LoadBalancer' :: LoadBalancer -> Maybe Text
targetGroupArn} -> Maybe Text
targetGroupArn) (\s :: LoadBalancer
s@LoadBalancer' {} Maybe Text
a -> LoadBalancer
s {$sel:targetGroupArn:LoadBalancer' :: Maybe Text
targetGroupArn = Maybe Text
a} :: LoadBalancer)
loadBalancer_containerPort :: Lens.Lens' LoadBalancer (Prelude.Maybe Prelude.Int)
loadBalancer_containerPort :: (Maybe Int -> f (Maybe Int)) -> LoadBalancer -> f LoadBalancer
loadBalancer_containerPort = (LoadBalancer -> Maybe Int)
-> (LoadBalancer -> Maybe Int -> LoadBalancer)
-> Lens LoadBalancer LoadBalancer (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoadBalancer' {Maybe Int
containerPort :: Maybe Int
$sel:containerPort:LoadBalancer' :: LoadBalancer -> Maybe Int
containerPort} -> Maybe Int
containerPort) (\s :: LoadBalancer
s@LoadBalancer' {} Maybe Int
a -> LoadBalancer
s {$sel:containerPort:LoadBalancer' :: Maybe Int
containerPort = Maybe Int
a} :: LoadBalancer)
instance Core.FromJSON LoadBalancer where
parseJSON :: Value -> Parser LoadBalancer
parseJSON =
String
-> (Object -> Parser LoadBalancer) -> Value -> Parser LoadBalancer
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LoadBalancer"
( \Object
x ->
Maybe Text -> Maybe Text -> Maybe Text -> Maybe Int -> LoadBalancer
LoadBalancer'
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Int -> LoadBalancer)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Int -> LoadBalancer)
forall (f :: * -> *) a b. Functor 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
"loadBalancerName")
Parser (Maybe Text -> Maybe Text -> Maybe Int -> LoadBalancer)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Int -> LoadBalancer)
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
"containerName")
Parser (Maybe Text -> Maybe Int -> LoadBalancer)
-> Parser (Maybe Text) -> Parser (Maybe Int -> LoadBalancer)
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
"targetGroupArn")
Parser (Maybe Int -> LoadBalancer)
-> Parser (Maybe Int) -> Parser LoadBalancer
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
"containerPort")
)
instance Prelude.Hashable LoadBalancer
instance Prelude.NFData LoadBalancer
instance Core.ToJSON LoadBalancer where
toJSON :: LoadBalancer -> Value
toJSON LoadBalancer' {Maybe Int
Maybe Text
containerPort :: Maybe Int
targetGroupArn :: Maybe Text
containerName :: Maybe Text
loadBalancerName :: Maybe Text
$sel:containerPort:LoadBalancer' :: LoadBalancer -> Maybe Int
$sel:targetGroupArn:LoadBalancer' :: LoadBalancer -> Maybe Text
$sel:containerName:LoadBalancer' :: LoadBalancer -> Maybe Text
$sel:loadBalancerName:LoadBalancer' :: LoadBalancer -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"loadBalancerName" 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
loadBalancerName,
(Text
"containerName" 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
containerName,
(Text
"targetGroupArn" 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
targetGroupArn,
(Text
"containerPort" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
containerPort
]
)