{-# 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.EndpointRequest where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.ContainerServiceHealthCheckConfig
import qualified Amazonka.Prelude as Prelude
data EndpointRequest = EndpointRequest'
{
EndpointRequest -> Maybe ContainerServiceHealthCheckConfig
healthCheck :: Prelude.Maybe ContainerServiceHealthCheckConfig,
EndpointRequest -> Text
containerName :: Prelude.Text,
EndpointRequest -> Int
containerPort :: Prelude.Int
}
deriving (EndpointRequest -> EndpointRequest -> Bool
(EndpointRequest -> EndpointRequest -> Bool)
-> (EndpointRequest -> EndpointRequest -> Bool)
-> Eq EndpointRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointRequest -> EndpointRequest -> Bool
$c/= :: EndpointRequest -> EndpointRequest -> Bool
== :: EndpointRequest -> EndpointRequest -> Bool
$c== :: EndpointRequest -> EndpointRequest -> Bool
Prelude.Eq, ReadPrec [EndpointRequest]
ReadPrec EndpointRequest
Int -> ReadS EndpointRequest
ReadS [EndpointRequest]
(Int -> ReadS EndpointRequest)
-> ReadS [EndpointRequest]
-> ReadPrec EndpointRequest
-> ReadPrec [EndpointRequest]
-> Read EndpointRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointRequest]
$creadListPrec :: ReadPrec [EndpointRequest]
readPrec :: ReadPrec EndpointRequest
$creadPrec :: ReadPrec EndpointRequest
readList :: ReadS [EndpointRequest]
$creadList :: ReadS [EndpointRequest]
readsPrec :: Int -> ReadS EndpointRequest
$creadsPrec :: Int -> ReadS EndpointRequest
Prelude.Read, Int -> EndpointRequest -> ShowS
[EndpointRequest] -> ShowS
EndpointRequest -> String
(Int -> EndpointRequest -> ShowS)
-> (EndpointRequest -> String)
-> ([EndpointRequest] -> ShowS)
-> Show EndpointRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointRequest] -> ShowS
$cshowList :: [EndpointRequest] -> ShowS
show :: EndpointRequest -> String
$cshow :: EndpointRequest -> String
showsPrec :: Int -> EndpointRequest -> ShowS
$cshowsPrec :: Int -> EndpointRequest -> ShowS
Prelude.Show, (forall x. EndpointRequest -> Rep EndpointRequest x)
-> (forall x. Rep EndpointRequest x -> EndpointRequest)
-> Generic EndpointRequest
forall x. Rep EndpointRequest x -> EndpointRequest
forall x. EndpointRequest -> Rep EndpointRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointRequest x -> EndpointRequest
$cfrom :: forall x. EndpointRequest -> Rep EndpointRequest x
Prelude.Generic)
newEndpointRequest ::
Prelude.Text ->
Prelude.Int ->
EndpointRequest
newEndpointRequest :: Text -> Int -> EndpointRequest
newEndpointRequest Text
pContainerName_ Int
pContainerPort_ =
EndpointRequest' :: Maybe ContainerServiceHealthCheckConfig
-> Text -> Int -> EndpointRequest
EndpointRequest'
{ $sel:healthCheck:EndpointRequest' :: Maybe ContainerServiceHealthCheckConfig
healthCheck = Maybe ContainerServiceHealthCheckConfig
forall a. Maybe a
Prelude.Nothing,
$sel:containerName:EndpointRequest' :: Text
containerName = Text
pContainerName_,
$sel:containerPort:EndpointRequest' :: Int
containerPort = Int
pContainerPort_
}
endpointRequest_healthCheck :: Lens.Lens' EndpointRequest (Prelude.Maybe ContainerServiceHealthCheckConfig)
endpointRequest_healthCheck :: (Maybe ContainerServiceHealthCheckConfig
-> f (Maybe ContainerServiceHealthCheckConfig))
-> EndpointRequest -> f EndpointRequest
endpointRequest_healthCheck = (EndpointRequest -> Maybe ContainerServiceHealthCheckConfig)
-> (EndpointRequest
-> Maybe ContainerServiceHealthCheckConfig -> EndpointRequest)
-> Lens
EndpointRequest
EndpointRequest
(Maybe ContainerServiceHealthCheckConfig)
(Maybe ContainerServiceHealthCheckConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Maybe ContainerServiceHealthCheckConfig
healthCheck :: Maybe ContainerServiceHealthCheckConfig
$sel:healthCheck:EndpointRequest' :: EndpointRequest -> Maybe ContainerServiceHealthCheckConfig
healthCheck} -> Maybe ContainerServiceHealthCheckConfig
healthCheck) (\s :: EndpointRequest
s@EndpointRequest' {} Maybe ContainerServiceHealthCheckConfig
a -> EndpointRequest
s {$sel:healthCheck:EndpointRequest' :: Maybe ContainerServiceHealthCheckConfig
healthCheck = Maybe ContainerServiceHealthCheckConfig
a} :: EndpointRequest)
endpointRequest_containerName :: Lens.Lens' EndpointRequest Prelude.Text
endpointRequest_containerName :: (Text -> f Text) -> EndpointRequest -> f EndpointRequest
endpointRequest_containerName = (EndpointRequest -> Text)
-> (EndpointRequest -> Text -> EndpointRequest)
-> Lens EndpointRequest EndpointRequest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Text
containerName :: Text
$sel:containerName:EndpointRequest' :: EndpointRequest -> Text
containerName} -> Text
containerName) (\s :: EndpointRequest
s@EndpointRequest' {} Text
a -> EndpointRequest
s {$sel:containerName:EndpointRequest' :: Text
containerName = Text
a} :: EndpointRequest)
endpointRequest_containerPort :: Lens.Lens' EndpointRequest Prelude.Int
endpointRequest_containerPort :: (Int -> f Int) -> EndpointRequest -> f EndpointRequest
endpointRequest_containerPort = (EndpointRequest -> Int)
-> (EndpointRequest -> Int -> EndpointRequest)
-> Lens EndpointRequest EndpointRequest Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointRequest' {Int
containerPort :: Int
$sel:containerPort:EndpointRequest' :: EndpointRequest -> Int
containerPort} -> Int
containerPort) (\s :: EndpointRequest
s@EndpointRequest' {} Int
a -> EndpointRequest
s {$sel:containerPort:EndpointRequest' :: Int
containerPort = Int
a} :: EndpointRequest)
instance Prelude.Hashable EndpointRequest
instance Prelude.NFData EndpointRequest
instance Core.ToJSON EndpointRequest where
toJSON :: EndpointRequest -> Value
toJSON EndpointRequest' {Int
Maybe ContainerServiceHealthCheckConfig
Text
containerPort :: Int
containerName :: Text
healthCheck :: Maybe ContainerServiceHealthCheckConfig
$sel:containerPort:EndpointRequest' :: EndpointRequest -> Int
$sel:containerName:EndpointRequest' :: EndpointRequest -> Text
$sel:healthCheck:EndpointRequest' :: EndpointRequest -> Maybe ContainerServiceHealthCheckConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"healthCheck" Text -> ContainerServiceHealthCheckConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ContainerServiceHealthCheckConfig -> Pair)
-> Maybe ContainerServiceHealthCheckConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContainerServiceHealthCheckConfig
healthCheck,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"containerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
containerName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"containerPort" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
containerPort)
]
)