{-# 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.CodeBuild.Types.ProjectCache where
import Amazonka.CodeBuild.Types.CacheMode
import Amazonka.CodeBuild.Types.CacheType
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data ProjectCache = ProjectCache'
{
ProjectCache -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
ProjectCache -> Maybe [CacheMode]
modes :: Prelude.Maybe [CacheMode],
ProjectCache -> CacheType
type' :: CacheType
}
deriving (ProjectCache -> ProjectCache -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectCache -> ProjectCache -> Bool
$c/= :: ProjectCache -> ProjectCache -> Bool
== :: ProjectCache -> ProjectCache -> Bool
$c== :: ProjectCache -> ProjectCache -> Bool
Prelude.Eq, ReadPrec [ProjectCache]
ReadPrec ProjectCache
Int -> ReadS ProjectCache
ReadS [ProjectCache]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectCache]
$creadListPrec :: ReadPrec [ProjectCache]
readPrec :: ReadPrec ProjectCache
$creadPrec :: ReadPrec ProjectCache
readList :: ReadS [ProjectCache]
$creadList :: ReadS [ProjectCache]
readsPrec :: Int -> ReadS ProjectCache
$creadsPrec :: Int -> ReadS ProjectCache
Prelude.Read, Int -> ProjectCache -> ShowS
[ProjectCache] -> ShowS
ProjectCache -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectCache] -> ShowS
$cshowList :: [ProjectCache] -> ShowS
show :: ProjectCache -> String
$cshow :: ProjectCache -> String
showsPrec :: Int -> ProjectCache -> ShowS
$cshowsPrec :: Int -> ProjectCache -> ShowS
Prelude.Show, forall x. Rep ProjectCache x -> ProjectCache
forall x. ProjectCache -> Rep ProjectCache x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectCache x -> ProjectCache
$cfrom :: forall x. ProjectCache -> Rep ProjectCache x
Prelude.Generic)
newProjectCache ::
CacheType ->
ProjectCache
newProjectCache :: CacheType -> ProjectCache
newProjectCache CacheType
pType_ =
ProjectCache'
{ $sel:location:ProjectCache' :: Maybe Text
location = forall a. Maybe a
Prelude.Nothing,
$sel:modes:ProjectCache' :: Maybe [CacheMode]
modes = forall a. Maybe a
Prelude.Nothing,
$sel:type':ProjectCache' :: CacheType
type' = CacheType
pType_
}
projectCache_location :: Lens.Lens' ProjectCache (Prelude.Maybe Prelude.Text)
projectCache_location :: Lens' ProjectCache (Maybe Text)
projectCache_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectCache' {Maybe Text
location :: Maybe Text
$sel:location:ProjectCache' :: ProjectCache -> Maybe Text
location} -> Maybe Text
location) (\s :: ProjectCache
s@ProjectCache' {} Maybe Text
a -> ProjectCache
s {$sel:location:ProjectCache' :: Maybe Text
location = Maybe Text
a} :: ProjectCache)
projectCache_modes :: Lens.Lens' ProjectCache (Prelude.Maybe [CacheMode])
projectCache_modes :: Lens' ProjectCache (Maybe [CacheMode])
projectCache_modes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectCache' {Maybe [CacheMode]
modes :: Maybe [CacheMode]
$sel:modes:ProjectCache' :: ProjectCache -> Maybe [CacheMode]
modes} -> Maybe [CacheMode]
modes) (\s :: ProjectCache
s@ProjectCache' {} Maybe [CacheMode]
a -> ProjectCache
s {$sel:modes:ProjectCache' :: Maybe [CacheMode]
modes = Maybe [CacheMode]
a} :: ProjectCache) 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
projectCache_type :: Lens.Lens' ProjectCache CacheType
projectCache_type :: Lens' ProjectCache CacheType
projectCache_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectCache' {CacheType
type' :: CacheType
$sel:type':ProjectCache' :: ProjectCache -> CacheType
type'} -> CacheType
type') (\s :: ProjectCache
s@ProjectCache' {} CacheType
a -> ProjectCache
s {$sel:type':ProjectCache' :: CacheType
type' = CacheType
a} :: ProjectCache)
instance Data.FromJSON ProjectCache where
parseJSON :: Value -> Parser ProjectCache
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ProjectCache"
( \Object
x ->
Maybe Text -> Maybe [CacheMode] -> CacheType -> ProjectCache
ProjectCache'
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
"location")
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
"modes" 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 a
Data..: Key
"type")
)
instance Prelude.Hashable ProjectCache where
hashWithSalt :: Int -> ProjectCache -> Int
hashWithSalt Int
_salt ProjectCache' {Maybe [CacheMode]
Maybe Text
CacheType
type' :: CacheType
modes :: Maybe [CacheMode]
location :: Maybe Text
$sel:type':ProjectCache' :: ProjectCache -> CacheType
$sel:modes:ProjectCache' :: ProjectCache -> Maybe [CacheMode]
$sel:location:ProjectCache' :: ProjectCache -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
location
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [CacheMode]
modes
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CacheType
type'
instance Prelude.NFData ProjectCache where
rnf :: ProjectCache -> ()
rnf ProjectCache' {Maybe [CacheMode]
Maybe Text
CacheType
type' :: CacheType
modes :: Maybe [CacheMode]
location :: Maybe Text
$sel:type':ProjectCache' :: ProjectCache -> CacheType
$sel:modes:ProjectCache' :: ProjectCache -> Maybe [CacheMode]
$sel:location:ProjectCache' :: ProjectCache -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
location
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [CacheMode]
modes
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CacheType
type'
instance Data.ToJSON ProjectCache where
toJSON :: ProjectCache -> Value
toJSON ProjectCache' {Maybe [CacheMode]
Maybe Text
CacheType
type' :: CacheType
modes :: Maybe [CacheMode]
location :: Maybe Text
$sel:type':ProjectCache' :: ProjectCache -> CacheType
$sel:modes:ProjectCache' :: ProjectCache -> Maybe [CacheMode]
$sel:location:ProjectCache' :: ProjectCache -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"location" 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
location,
(Key
"modes" 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 [CacheMode]
modes,
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CacheType
type')
]
)