{-# 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.GlobalAccelerator.Types.EndpointConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EndpointConfiguration = EndpointConfiguration'
{
EndpointConfiguration -> Maybe Natural
weight :: Prelude.Maybe Prelude.Natural,
EndpointConfiguration -> Maybe Bool
clientIPPreservationEnabled :: Prelude.Maybe Prelude.Bool,
EndpointConfiguration -> Maybe Text
endpointId :: Prelude.Maybe Prelude.Text
}
deriving (EndpointConfiguration -> EndpointConfiguration -> Bool
(EndpointConfiguration -> EndpointConfiguration -> Bool)
-> (EndpointConfiguration -> EndpointConfiguration -> Bool)
-> Eq EndpointConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointConfiguration -> EndpointConfiguration -> Bool
$c/= :: EndpointConfiguration -> EndpointConfiguration -> Bool
== :: EndpointConfiguration -> EndpointConfiguration -> Bool
$c== :: EndpointConfiguration -> EndpointConfiguration -> Bool
Prelude.Eq, ReadPrec [EndpointConfiguration]
ReadPrec EndpointConfiguration
Int -> ReadS EndpointConfiguration
ReadS [EndpointConfiguration]
(Int -> ReadS EndpointConfiguration)
-> ReadS [EndpointConfiguration]
-> ReadPrec EndpointConfiguration
-> ReadPrec [EndpointConfiguration]
-> Read EndpointConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointConfiguration]
$creadListPrec :: ReadPrec [EndpointConfiguration]
readPrec :: ReadPrec EndpointConfiguration
$creadPrec :: ReadPrec EndpointConfiguration
readList :: ReadS [EndpointConfiguration]
$creadList :: ReadS [EndpointConfiguration]
readsPrec :: Int -> ReadS EndpointConfiguration
$creadsPrec :: Int -> ReadS EndpointConfiguration
Prelude.Read, Int -> EndpointConfiguration -> ShowS
[EndpointConfiguration] -> ShowS
EndpointConfiguration -> String
(Int -> EndpointConfiguration -> ShowS)
-> (EndpointConfiguration -> String)
-> ([EndpointConfiguration] -> ShowS)
-> Show EndpointConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointConfiguration] -> ShowS
$cshowList :: [EndpointConfiguration] -> ShowS
show :: EndpointConfiguration -> String
$cshow :: EndpointConfiguration -> String
showsPrec :: Int -> EndpointConfiguration -> ShowS
$cshowsPrec :: Int -> EndpointConfiguration -> ShowS
Prelude.Show, (forall x. EndpointConfiguration -> Rep EndpointConfiguration x)
-> (forall x. Rep EndpointConfiguration x -> EndpointConfiguration)
-> Generic EndpointConfiguration
forall x. Rep EndpointConfiguration x -> EndpointConfiguration
forall x. EndpointConfiguration -> Rep EndpointConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointConfiguration x -> EndpointConfiguration
$cfrom :: forall x. EndpointConfiguration -> Rep EndpointConfiguration x
Prelude.Generic)
newEndpointConfiguration ::
EndpointConfiguration
newEndpointConfiguration :: EndpointConfiguration
newEndpointConfiguration =
EndpointConfiguration' :: Maybe Natural -> Maybe Bool -> Maybe Text -> EndpointConfiguration
EndpointConfiguration'
{ $sel:weight:EndpointConfiguration' :: Maybe Natural
weight = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:clientIPPreservationEnabled:EndpointConfiguration' :: Maybe Bool
clientIPPreservationEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:endpointId:EndpointConfiguration' :: Maybe Text
endpointId = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
endpointConfiguration_weight :: Lens.Lens' EndpointConfiguration (Prelude.Maybe Prelude.Natural)
endpointConfiguration_weight :: (Maybe Natural -> f (Maybe Natural))
-> EndpointConfiguration -> f EndpointConfiguration
endpointConfiguration_weight = (EndpointConfiguration -> Maybe Natural)
-> (EndpointConfiguration
-> Maybe Natural -> EndpointConfiguration)
-> Lens
EndpointConfiguration
EndpointConfiguration
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointConfiguration' {Maybe Natural
weight :: Maybe Natural
$sel:weight:EndpointConfiguration' :: EndpointConfiguration -> Maybe Natural
weight} -> Maybe Natural
weight) (\s :: EndpointConfiguration
s@EndpointConfiguration' {} Maybe Natural
a -> EndpointConfiguration
s {$sel:weight:EndpointConfiguration' :: Maybe Natural
weight = Maybe Natural
a} :: EndpointConfiguration)
endpointConfiguration_clientIPPreservationEnabled :: Lens.Lens' EndpointConfiguration (Prelude.Maybe Prelude.Bool)
endpointConfiguration_clientIPPreservationEnabled :: (Maybe Bool -> f (Maybe Bool))
-> EndpointConfiguration -> f EndpointConfiguration
endpointConfiguration_clientIPPreservationEnabled = (EndpointConfiguration -> Maybe Bool)
-> (EndpointConfiguration -> Maybe Bool -> EndpointConfiguration)
-> Lens
EndpointConfiguration
EndpointConfiguration
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointConfiguration' {Maybe Bool
clientIPPreservationEnabled :: Maybe Bool
$sel:clientIPPreservationEnabled:EndpointConfiguration' :: EndpointConfiguration -> Maybe Bool
clientIPPreservationEnabled} -> Maybe Bool
clientIPPreservationEnabled) (\s :: EndpointConfiguration
s@EndpointConfiguration' {} Maybe Bool
a -> EndpointConfiguration
s {$sel:clientIPPreservationEnabled:EndpointConfiguration' :: Maybe Bool
clientIPPreservationEnabled = Maybe Bool
a} :: EndpointConfiguration)
endpointConfiguration_endpointId :: Lens.Lens' EndpointConfiguration (Prelude.Maybe Prelude.Text)
endpointConfiguration_endpointId :: (Maybe Text -> f (Maybe Text))
-> EndpointConfiguration -> f EndpointConfiguration
endpointConfiguration_endpointId = (EndpointConfiguration -> Maybe Text)
-> (EndpointConfiguration -> Maybe Text -> EndpointConfiguration)
-> Lens
EndpointConfiguration
EndpointConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointConfiguration' {Maybe Text
endpointId :: Maybe Text
$sel:endpointId:EndpointConfiguration' :: EndpointConfiguration -> Maybe Text
endpointId} -> Maybe Text
endpointId) (\s :: EndpointConfiguration
s@EndpointConfiguration' {} Maybe Text
a -> EndpointConfiguration
s {$sel:endpointId:EndpointConfiguration' :: Maybe Text
endpointId = Maybe Text
a} :: EndpointConfiguration)
instance Prelude.Hashable EndpointConfiguration
instance Prelude.NFData EndpointConfiguration
instance Core.ToJSON EndpointConfiguration where
toJSON :: EndpointConfiguration -> Value
toJSON EndpointConfiguration' {Maybe Bool
Maybe Natural
Maybe Text
endpointId :: Maybe Text
clientIPPreservationEnabled :: Maybe Bool
weight :: Maybe Natural
$sel:endpointId:EndpointConfiguration' :: EndpointConfiguration -> Maybe Text
$sel:clientIPPreservationEnabled:EndpointConfiguration' :: EndpointConfiguration -> Maybe Bool
$sel:weight:EndpointConfiguration' :: EndpointConfiguration -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Weight" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
weight,
(Text
"ClientIPPreservationEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
clientIPPreservationEnabled,
(Text
"EndpointId" 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
endpointId
]
)