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