{-# 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.HttpHeaderConditionConfig where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data =
{
:: Prelude.Maybe [Prelude.Text],
:: Prelude.Maybe Prelude.Text
}
deriving (HttpHeaderConditionConfig -> HttpHeaderConditionConfig -> Bool
(HttpHeaderConditionConfig -> HttpHeaderConditionConfig -> Bool)
-> (HttpHeaderConditionConfig -> HttpHeaderConditionConfig -> Bool)
-> Eq HttpHeaderConditionConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HttpHeaderConditionConfig -> HttpHeaderConditionConfig -> Bool
$c/= :: HttpHeaderConditionConfig -> HttpHeaderConditionConfig -> Bool
== :: HttpHeaderConditionConfig -> HttpHeaderConditionConfig -> Bool
$c== :: HttpHeaderConditionConfig -> HttpHeaderConditionConfig -> Bool
Prelude.Eq, ReadPrec [HttpHeaderConditionConfig]
ReadPrec HttpHeaderConditionConfig
Int -> ReadS HttpHeaderConditionConfig
ReadS [HttpHeaderConditionConfig]
(Int -> ReadS HttpHeaderConditionConfig)
-> ReadS [HttpHeaderConditionConfig]
-> ReadPrec HttpHeaderConditionConfig
-> ReadPrec [HttpHeaderConditionConfig]
-> Read HttpHeaderConditionConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HttpHeaderConditionConfig]
$creadListPrec :: ReadPrec [HttpHeaderConditionConfig]
readPrec :: ReadPrec HttpHeaderConditionConfig
$creadPrec :: ReadPrec HttpHeaderConditionConfig
readList :: ReadS [HttpHeaderConditionConfig]
$creadList :: ReadS [HttpHeaderConditionConfig]
readsPrec :: Int -> ReadS HttpHeaderConditionConfig
$creadsPrec :: Int -> ReadS HttpHeaderConditionConfig
Prelude.Read, Int -> HttpHeaderConditionConfig -> ShowS
[HttpHeaderConditionConfig] -> ShowS
HttpHeaderConditionConfig -> String
(Int -> HttpHeaderConditionConfig -> ShowS)
-> (HttpHeaderConditionConfig -> String)
-> ([HttpHeaderConditionConfig] -> ShowS)
-> Show HttpHeaderConditionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HttpHeaderConditionConfig] -> ShowS
$cshowList :: [HttpHeaderConditionConfig] -> ShowS
show :: HttpHeaderConditionConfig -> String
$cshow :: HttpHeaderConditionConfig -> String
showsPrec :: Int -> HttpHeaderConditionConfig -> ShowS
$cshowsPrec :: Int -> HttpHeaderConditionConfig -> ShowS
Prelude.Show, (forall x.
HttpHeaderConditionConfig -> Rep HttpHeaderConditionConfig x)
-> (forall x.
Rep HttpHeaderConditionConfig x -> HttpHeaderConditionConfig)
-> Generic HttpHeaderConditionConfig
forall x.
Rep HttpHeaderConditionConfig x -> HttpHeaderConditionConfig
forall x.
HttpHeaderConditionConfig -> Rep HttpHeaderConditionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HttpHeaderConditionConfig x -> HttpHeaderConditionConfig
$cfrom :: forall x.
HttpHeaderConditionConfig -> Rep HttpHeaderConditionConfig x
Prelude.Generic)
newHttpHeaderConditionConfig ::
HttpHeaderConditionConfig
=
HttpHeaderConditionConfig' :: Maybe [Text] -> Maybe Text -> HttpHeaderConditionConfig
HttpHeaderConditionConfig'
{ $sel:values:HttpHeaderConditionConfig' :: Maybe [Text]
values =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:httpHeaderName:HttpHeaderConditionConfig' :: Maybe Text
httpHeaderName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
httpHeaderConditionConfig_values :: Lens.Lens' HttpHeaderConditionConfig (Prelude.Maybe [Prelude.Text])
= (HttpHeaderConditionConfig -> Maybe [Text])
-> (HttpHeaderConditionConfig
-> Maybe [Text] -> HttpHeaderConditionConfig)
-> Lens
HttpHeaderConditionConfig
HttpHeaderConditionConfig
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpHeaderConditionConfig' {Maybe [Text]
values :: Maybe [Text]
$sel:values:HttpHeaderConditionConfig' :: HttpHeaderConditionConfig -> Maybe [Text]
values} -> Maybe [Text]
values) (\s :: HttpHeaderConditionConfig
s@HttpHeaderConditionConfig' {} Maybe [Text]
a -> HttpHeaderConditionConfig
s {$sel:values:HttpHeaderConditionConfig' :: Maybe [Text]
values = Maybe [Text]
a} :: HttpHeaderConditionConfig) ((Maybe [Text] -> f (Maybe [Text]))
-> HttpHeaderConditionConfig -> f HttpHeaderConditionConfig)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> HttpHeaderConditionConfig
-> f HttpHeaderConditionConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
httpHeaderConditionConfig_httpHeaderName :: Lens.Lens' HttpHeaderConditionConfig (Prelude.Maybe Prelude.Text)
= (HttpHeaderConditionConfig -> Maybe Text)
-> (HttpHeaderConditionConfig
-> Maybe Text -> HttpHeaderConditionConfig)
-> Lens
HttpHeaderConditionConfig
HttpHeaderConditionConfig
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HttpHeaderConditionConfig' {Maybe Text
httpHeaderName :: Maybe Text
$sel:httpHeaderName:HttpHeaderConditionConfig' :: HttpHeaderConditionConfig -> Maybe Text
httpHeaderName} -> Maybe Text
httpHeaderName) (\s :: HttpHeaderConditionConfig
s@HttpHeaderConditionConfig' {} Maybe Text
a -> HttpHeaderConditionConfig
s {$sel:httpHeaderName:HttpHeaderConditionConfig' :: Maybe Text
httpHeaderName = Maybe Text
a} :: HttpHeaderConditionConfig)
instance Core.FromXML HttpHeaderConditionConfig where
parseXML :: [Node] -> Either String HttpHeaderConditionConfig
parseXML [Node]
x =
Maybe [Text] -> Maybe Text -> HttpHeaderConditionConfig
HttpHeaderConditionConfig'
(Maybe [Text] -> Maybe Text -> HttpHeaderConditionConfig)
-> Either String (Maybe [Text])
-> Either String (Maybe Text -> HttpHeaderConditionConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Values" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe Text -> HttpHeaderConditionConfig)
-> Either String (Maybe Text)
-> Either String HttpHeaderConditionConfig
forall (f :: * -> *) a b. Applicative f => 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
"HttpHeaderName")
instance Prelude.Hashable HttpHeaderConditionConfig
instance Prelude.NFData HttpHeaderConditionConfig
instance Core.ToQuery HttpHeaderConditionConfig where
toQuery :: HttpHeaderConditionConfig -> QueryString
toQuery HttpHeaderConditionConfig' {Maybe [Text]
Maybe Text
httpHeaderName :: Maybe Text
values :: Maybe [Text]
$sel:httpHeaderName:HttpHeaderConditionConfig' :: HttpHeaderConditionConfig -> Maybe Text
$sel:values:HttpHeaderConditionConfig' :: HttpHeaderConditionConfig -> Maybe [Text]
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Values"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
(ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
values),
ByteString
"HttpHeaderName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
httpHeaderName
]