{-# 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.HeaderObject where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types.ForwardValues
import Amazonka.Lightsail.Types.HeaderEnum
import qualified Amazonka.Prelude as Prelude
data =
{
:: Prelude.Maybe [HeaderEnum],
:: Prelude.Maybe ForwardValues
}
deriving (HeaderObject -> HeaderObject -> Bool
(HeaderObject -> HeaderObject -> Bool)
-> (HeaderObject -> HeaderObject -> Bool) -> Eq HeaderObject
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeaderObject -> HeaderObject -> Bool
$c/= :: HeaderObject -> HeaderObject -> Bool
== :: HeaderObject -> HeaderObject -> Bool
$c== :: HeaderObject -> HeaderObject -> Bool
Prelude.Eq, ReadPrec [HeaderObject]
ReadPrec HeaderObject
Int -> ReadS HeaderObject
ReadS [HeaderObject]
(Int -> ReadS HeaderObject)
-> ReadS [HeaderObject]
-> ReadPrec HeaderObject
-> ReadPrec [HeaderObject]
-> Read HeaderObject
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HeaderObject]
$creadListPrec :: ReadPrec [HeaderObject]
readPrec :: ReadPrec HeaderObject
$creadPrec :: ReadPrec HeaderObject
readList :: ReadS [HeaderObject]
$creadList :: ReadS [HeaderObject]
readsPrec :: Int -> ReadS HeaderObject
$creadsPrec :: Int -> ReadS HeaderObject
Prelude.Read, Int -> HeaderObject -> ShowS
[HeaderObject] -> ShowS
HeaderObject -> String
(Int -> HeaderObject -> ShowS)
-> (HeaderObject -> String)
-> ([HeaderObject] -> ShowS)
-> Show HeaderObject
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeaderObject] -> ShowS
$cshowList :: [HeaderObject] -> ShowS
show :: HeaderObject -> String
$cshow :: HeaderObject -> String
showsPrec :: Int -> HeaderObject -> ShowS
$cshowsPrec :: Int -> HeaderObject -> ShowS
Prelude.Show, (forall x. HeaderObject -> Rep HeaderObject x)
-> (forall x. Rep HeaderObject x -> HeaderObject)
-> Generic HeaderObject
forall x. Rep HeaderObject x -> HeaderObject
forall x. HeaderObject -> Rep HeaderObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HeaderObject x -> HeaderObject
$cfrom :: forall x. HeaderObject -> Rep HeaderObject x
Prelude.Generic)
newHeaderObject ::
HeaderObject
=
HeaderObject' :: Maybe [HeaderEnum] -> Maybe ForwardValues -> HeaderObject
HeaderObject'
{ $sel:headersAllowList:HeaderObject' :: Maybe [HeaderEnum]
headersAllowList = Maybe [HeaderEnum]
forall a. Maybe a
Prelude.Nothing,
$sel:option:HeaderObject' :: Maybe ForwardValues
option = Maybe ForwardValues
forall a. Maybe a
Prelude.Nothing
}
headerObject_headersAllowList :: Lens.Lens' HeaderObject (Prelude.Maybe [HeaderEnum])
= (HeaderObject -> Maybe [HeaderEnum])
-> (HeaderObject -> Maybe [HeaderEnum] -> HeaderObject)
-> Lens
HeaderObject HeaderObject (Maybe [HeaderEnum]) (Maybe [HeaderEnum])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeaderObject' {Maybe [HeaderEnum]
headersAllowList :: Maybe [HeaderEnum]
$sel:headersAllowList:HeaderObject' :: HeaderObject -> Maybe [HeaderEnum]
headersAllowList} -> Maybe [HeaderEnum]
headersAllowList) (\s :: HeaderObject
s@HeaderObject' {} Maybe [HeaderEnum]
a -> HeaderObject
s {$sel:headersAllowList:HeaderObject' :: Maybe [HeaderEnum]
headersAllowList = Maybe [HeaderEnum]
a} :: HeaderObject) ((Maybe [HeaderEnum] -> f (Maybe [HeaderEnum]))
-> HeaderObject -> f HeaderObject)
-> ((Maybe [HeaderEnum] -> f (Maybe [HeaderEnum]))
-> Maybe [HeaderEnum] -> f (Maybe [HeaderEnum]))
-> (Maybe [HeaderEnum] -> f (Maybe [HeaderEnum]))
-> HeaderObject
-> f HeaderObject
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [HeaderEnum] [HeaderEnum] [HeaderEnum] [HeaderEnum]
-> Iso
(Maybe [HeaderEnum])
(Maybe [HeaderEnum])
(Maybe [HeaderEnum])
(Maybe [HeaderEnum])
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 [HeaderEnum] [HeaderEnum] [HeaderEnum] [HeaderEnum]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
headerObject_option :: Lens.Lens' HeaderObject (Prelude.Maybe ForwardValues)
= (HeaderObject -> Maybe ForwardValues)
-> (HeaderObject -> Maybe ForwardValues -> HeaderObject)
-> Lens
HeaderObject
HeaderObject
(Maybe ForwardValues)
(Maybe ForwardValues)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeaderObject' {Maybe ForwardValues
option :: Maybe ForwardValues
$sel:option:HeaderObject' :: HeaderObject -> Maybe ForwardValues
option} -> Maybe ForwardValues
option) (\s :: HeaderObject
s@HeaderObject' {} Maybe ForwardValues
a -> HeaderObject
s {$sel:option:HeaderObject' :: Maybe ForwardValues
option = Maybe ForwardValues
a} :: HeaderObject)
instance Core.FromJSON HeaderObject where
parseJSON :: Value -> Parser HeaderObject
parseJSON =
String
-> (Object -> Parser HeaderObject) -> Value -> Parser HeaderObject
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HeaderObject"
( \Object
x ->
Maybe [HeaderEnum] -> Maybe ForwardValues -> HeaderObject
HeaderObject'
(Maybe [HeaderEnum] -> Maybe ForwardValues -> HeaderObject)
-> Parser (Maybe [HeaderEnum])
-> Parser (Maybe ForwardValues -> HeaderObject)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [HeaderEnum]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"headersAllowList"
Parser (Maybe (Maybe [HeaderEnum]))
-> Maybe [HeaderEnum] -> Parser (Maybe [HeaderEnum])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [HeaderEnum]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe ForwardValues -> HeaderObject)
-> Parser (Maybe ForwardValues) -> Parser HeaderObject
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ForwardValues)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"option")
)
instance Prelude.Hashable HeaderObject
instance Prelude.NFData HeaderObject
instance Core.ToJSON HeaderObject where
toJSON :: HeaderObject -> Value
toJSON HeaderObject' {Maybe [HeaderEnum]
Maybe ForwardValues
option :: Maybe ForwardValues
headersAllowList :: Maybe [HeaderEnum]
$sel:option:HeaderObject' :: HeaderObject -> Maybe ForwardValues
$sel:headersAllowList:HeaderObject' :: HeaderObject -> Maybe [HeaderEnum]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"headersAllowList" Text -> [HeaderEnum] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([HeaderEnum] -> Pair) -> Maybe [HeaderEnum] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [HeaderEnum]
headersAllowList,
(Text
"option" Text -> ForwardValues -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ForwardValues -> Pair) -> Maybe ForwardValues -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ForwardValues
option
]
)