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