{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:cookiesAllowList:CookieObject' :: Maybe [Text]
cookiesAllowList = forall a. Maybe a
Prelude.Nothing,
$sel:option:CookieObject' :: Maybe ForwardValues
option = forall a. Maybe a
Prelude.Nothing
}
cookieObject_cookiesAllowList :: Lens.Lens' CookieObject (Prelude.Maybe [Prelude.Text])
cookieObject_cookiesAllowList :: Lens' CookieObject (Maybe [Text])
cookieObject_cookiesAllowList = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' CookieObject (Maybe ForwardValues)
cookieObject_option = 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 Data.FromJSON CookieObject where
parseJSON :: Value -> Parser CookieObject
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"CookieObject"
( \Object
x ->
Maybe [Text] -> Maybe ForwardValues -> CookieObject
CookieObject'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"cookiesAllowList"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"option")
)
instance Prelude.Hashable CookieObject where
hashWithSalt :: Int -> CookieObject -> Int
hashWithSalt Int
_salt CookieObject' {Maybe [Text]
Maybe ForwardValues
option :: Maybe ForwardValues
cookiesAllowList :: Maybe [Text]
$sel:option:CookieObject' :: CookieObject -> Maybe ForwardValues
$sel:cookiesAllowList:CookieObject' :: CookieObject -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
cookiesAllowList
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ForwardValues
option
instance Prelude.NFData CookieObject where
rnf :: CookieObject -> ()
rnf CookieObject' {Maybe [Text]
Maybe ForwardValues
option :: Maybe ForwardValues
cookiesAllowList :: Maybe [Text]
$sel:option:CookieObject' :: CookieObject -> Maybe ForwardValues
$sel:cookiesAllowList:CookieObject' :: CookieObject -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
cookiesAllowList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ForwardValues
option
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"cookiesAllowList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
cookiesAllowList,
(Key
"option" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ForwardValues
option
]
)