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