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