{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.AppSync.UpdateApiCache
(
UpdateApiCache (..),
newUpdateApiCache,
updateApiCache_apiId,
updateApiCache_ttl,
updateApiCache_apiCachingBehavior,
updateApiCache_type,
UpdateApiCacheResponse (..),
newUpdateApiCacheResponse,
updateApiCacheResponse_apiCache,
updateApiCacheResponse_httpStatus,
)
where
import Amazonka.AppSync.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateApiCache = UpdateApiCache'
{
UpdateApiCache -> Text
apiId :: Prelude.Text,
UpdateApiCache -> Integer
ttl :: Prelude.Integer,
UpdateApiCache -> ApiCachingBehavior
apiCachingBehavior :: ApiCachingBehavior,
UpdateApiCache -> ApiCacheType
type' :: ApiCacheType
}
deriving (UpdateApiCache -> UpdateApiCache -> Bool
(UpdateApiCache -> UpdateApiCache -> Bool)
-> (UpdateApiCache -> UpdateApiCache -> Bool) -> Eq UpdateApiCache
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateApiCache -> UpdateApiCache -> Bool
$c/= :: UpdateApiCache -> UpdateApiCache -> Bool
== :: UpdateApiCache -> UpdateApiCache -> Bool
$c== :: UpdateApiCache -> UpdateApiCache -> Bool
Prelude.Eq, ReadPrec [UpdateApiCache]
ReadPrec UpdateApiCache
Int -> ReadS UpdateApiCache
ReadS [UpdateApiCache]
(Int -> ReadS UpdateApiCache)
-> ReadS [UpdateApiCache]
-> ReadPrec UpdateApiCache
-> ReadPrec [UpdateApiCache]
-> Read UpdateApiCache
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateApiCache]
$creadListPrec :: ReadPrec [UpdateApiCache]
readPrec :: ReadPrec UpdateApiCache
$creadPrec :: ReadPrec UpdateApiCache
readList :: ReadS [UpdateApiCache]
$creadList :: ReadS [UpdateApiCache]
readsPrec :: Int -> ReadS UpdateApiCache
$creadsPrec :: Int -> ReadS UpdateApiCache
Prelude.Read, Int -> UpdateApiCache -> ShowS
[UpdateApiCache] -> ShowS
UpdateApiCache -> String
(Int -> UpdateApiCache -> ShowS)
-> (UpdateApiCache -> String)
-> ([UpdateApiCache] -> ShowS)
-> Show UpdateApiCache
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateApiCache] -> ShowS
$cshowList :: [UpdateApiCache] -> ShowS
show :: UpdateApiCache -> String
$cshow :: UpdateApiCache -> String
showsPrec :: Int -> UpdateApiCache -> ShowS
$cshowsPrec :: Int -> UpdateApiCache -> ShowS
Prelude.Show, (forall x. UpdateApiCache -> Rep UpdateApiCache x)
-> (forall x. Rep UpdateApiCache x -> UpdateApiCache)
-> Generic UpdateApiCache
forall x. Rep UpdateApiCache x -> UpdateApiCache
forall x. UpdateApiCache -> Rep UpdateApiCache x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateApiCache x -> UpdateApiCache
$cfrom :: forall x. UpdateApiCache -> Rep UpdateApiCache x
Prelude.Generic)
newUpdateApiCache ::
Prelude.Text ->
Prelude.Integer ->
ApiCachingBehavior ->
ApiCacheType ->
UpdateApiCache
newUpdateApiCache :: Text
-> Integer -> ApiCachingBehavior -> ApiCacheType -> UpdateApiCache
newUpdateApiCache
Text
pApiId_
Integer
pTtl_
ApiCachingBehavior
pApiCachingBehavior_
ApiCacheType
pType_ =
UpdateApiCache' :: Text
-> Integer -> ApiCachingBehavior -> ApiCacheType -> UpdateApiCache
UpdateApiCache'
{ $sel:apiId:UpdateApiCache' :: Text
apiId = Text
pApiId_,
$sel:ttl:UpdateApiCache' :: Integer
ttl = Integer
pTtl_,
$sel:apiCachingBehavior:UpdateApiCache' :: ApiCachingBehavior
apiCachingBehavior = ApiCachingBehavior
pApiCachingBehavior_,
$sel:type':UpdateApiCache' :: ApiCacheType
type' = ApiCacheType
pType_
}
updateApiCache_apiId :: Lens.Lens' UpdateApiCache Prelude.Text
updateApiCache_apiId :: (Text -> f Text) -> UpdateApiCache -> f UpdateApiCache
updateApiCache_apiId = (UpdateApiCache -> Text)
-> (UpdateApiCache -> Text -> UpdateApiCache)
-> Lens UpdateApiCache UpdateApiCache Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiCache' {Text
apiId :: Text
$sel:apiId:UpdateApiCache' :: UpdateApiCache -> Text
apiId} -> Text
apiId) (\s :: UpdateApiCache
s@UpdateApiCache' {} Text
a -> UpdateApiCache
s {$sel:apiId:UpdateApiCache' :: Text
apiId = Text
a} :: UpdateApiCache)
updateApiCache_ttl :: Lens.Lens' UpdateApiCache Prelude.Integer
updateApiCache_ttl :: (Integer -> f Integer) -> UpdateApiCache -> f UpdateApiCache
updateApiCache_ttl = (UpdateApiCache -> Integer)
-> (UpdateApiCache -> Integer -> UpdateApiCache)
-> Lens UpdateApiCache UpdateApiCache Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiCache' {Integer
ttl :: Integer
$sel:ttl:UpdateApiCache' :: UpdateApiCache -> Integer
ttl} -> Integer
ttl) (\s :: UpdateApiCache
s@UpdateApiCache' {} Integer
a -> UpdateApiCache
s {$sel:ttl:UpdateApiCache' :: Integer
ttl = Integer
a} :: UpdateApiCache)
updateApiCache_apiCachingBehavior :: Lens.Lens' UpdateApiCache ApiCachingBehavior
updateApiCache_apiCachingBehavior :: (ApiCachingBehavior -> f ApiCachingBehavior)
-> UpdateApiCache -> f UpdateApiCache
updateApiCache_apiCachingBehavior = (UpdateApiCache -> ApiCachingBehavior)
-> (UpdateApiCache -> ApiCachingBehavior -> UpdateApiCache)
-> Lens
UpdateApiCache UpdateApiCache ApiCachingBehavior ApiCachingBehavior
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiCache' {ApiCachingBehavior
apiCachingBehavior :: ApiCachingBehavior
$sel:apiCachingBehavior:UpdateApiCache' :: UpdateApiCache -> ApiCachingBehavior
apiCachingBehavior} -> ApiCachingBehavior
apiCachingBehavior) (\s :: UpdateApiCache
s@UpdateApiCache' {} ApiCachingBehavior
a -> UpdateApiCache
s {$sel:apiCachingBehavior:UpdateApiCache' :: ApiCachingBehavior
apiCachingBehavior = ApiCachingBehavior
a} :: UpdateApiCache)
updateApiCache_type :: Lens.Lens' UpdateApiCache ApiCacheType
updateApiCache_type :: (ApiCacheType -> f ApiCacheType)
-> UpdateApiCache -> f UpdateApiCache
updateApiCache_type = (UpdateApiCache -> ApiCacheType)
-> (UpdateApiCache -> ApiCacheType -> UpdateApiCache)
-> Lens UpdateApiCache UpdateApiCache ApiCacheType ApiCacheType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiCache' {ApiCacheType
type' :: ApiCacheType
$sel:type':UpdateApiCache' :: UpdateApiCache -> ApiCacheType
type'} -> ApiCacheType
type') (\s :: UpdateApiCache
s@UpdateApiCache' {} ApiCacheType
a -> UpdateApiCache
s {$sel:type':UpdateApiCache' :: ApiCacheType
type' = ApiCacheType
a} :: UpdateApiCache)
instance Core.AWSRequest UpdateApiCache where
type
AWSResponse UpdateApiCache =
UpdateApiCacheResponse
request :: UpdateApiCache -> Request UpdateApiCache
request = Service -> UpdateApiCache -> Request UpdateApiCache
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateApiCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateApiCache)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateApiCache))
-> Logger
-> Service
-> Proxy UpdateApiCache
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateApiCache)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe ApiCache -> Int -> UpdateApiCacheResponse
UpdateApiCacheResponse'
(Maybe ApiCache -> Int -> UpdateApiCacheResponse)
-> Either String (Maybe ApiCache)
-> Either String (Int -> UpdateApiCacheResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ApiCache)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"apiCache")
Either String (Int -> UpdateApiCacheResponse)
-> Either String Int -> Either String UpdateApiCacheResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateApiCache
instance Prelude.NFData UpdateApiCache
instance Core.ToHeaders UpdateApiCache where
toHeaders :: UpdateApiCache -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateApiCache -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateApiCache where
toJSON :: UpdateApiCache -> Value
toJSON UpdateApiCache' {Integer
Text
ApiCacheType
ApiCachingBehavior
type' :: ApiCacheType
apiCachingBehavior :: ApiCachingBehavior
ttl :: Integer
apiId :: Text
$sel:type':UpdateApiCache' :: UpdateApiCache -> ApiCacheType
$sel:apiCachingBehavior:UpdateApiCache' :: UpdateApiCache -> ApiCachingBehavior
$sel:ttl:UpdateApiCache' :: UpdateApiCache -> Integer
$sel:apiId:UpdateApiCache' :: UpdateApiCache -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ttl" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Integer
ttl),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"apiCachingBehavior" Text -> ApiCachingBehavior -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ApiCachingBehavior
apiCachingBehavior),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> ApiCacheType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ApiCacheType
type')
]
)
instance Core.ToPath UpdateApiCache where
toPath :: UpdateApiCache -> ByteString
toPath UpdateApiCache' {Integer
Text
ApiCacheType
ApiCachingBehavior
type' :: ApiCacheType
apiCachingBehavior :: ApiCachingBehavior
ttl :: Integer
apiId :: Text
$sel:type':UpdateApiCache' :: UpdateApiCache -> ApiCacheType
$sel:apiCachingBehavior:UpdateApiCache' :: UpdateApiCache -> ApiCachingBehavior
$sel:ttl:UpdateApiCache' :: UpdateApiCache -> Integer
$sel:apiId:UpdateApiCache' :: UpdateApiCache -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/v1/apis/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiId, ByteString
"/ApiCaches/update"]
instance Core.ToQuery UpdateApiCache where
toQuery :: UpdateApiCache -> QueryString
toQuery = QueryString -> UpdateApiCache -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateApiCacheResponse = UpdateApiCacheResponse'
{
UpdateApiCacheResponse -> Maybe ApiCache
apiCache :: Prelude.Maybe ApiCache,
UpdateApiCacheResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateApiCacheResponse -> UpdateApiCacheResponse -> Bool
(UpdateApiCacheResponse -> UpdateApiCacheResponse -> Bool)
-> (UpdateApiCacheResponse -> UpdateApiCacheResponse -> Bool)
-> Eq UpdateApiCacheResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateApiCacheResponse -> UpdateApiCacheResponse -> Bool
$c/= :: UpdateApiCacheResponse -> UpdateApiCacheResponse -> Bool
== :: UpdateApiCacheResponse -> UpdateApiCacheResponse -> Bool
$c== :: UpdateApiCacheResponse -> UpdateApiCacheResponse -> Bool
Prelude.Eq, ReadPrec [UpdateApiCacheResponse]
ReadPrec UpdateApiCacheResponse
Int -> ReadS UpdateApiCacheResponse
ReadS [UpdateApiCacheResponse]
(Int -> ReadS UpdateApiCacheResponse)
-> ReadS [UpdateApiCacheResponse]
-> ReadPrec UpdateApiCacheResponse
-> ReadPrec [UpdateApiCacheResponse]
-> Read UpdateApiCacheResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateApiCacheResponse]
$creadListPrec :: ReadPrec [UpdateApiCacheResponse]
readPrec :: ReadPrec UpdateApiCacheResponse
$creadPrec :: ReadPrec UpdateApiCacheResponse
readList :: ReadS [UpdateApiCacheResponse]
$creadList :: ReadS [UpdateApiCacheResponse]
readsPrec :: Int -> ReadS UpdateApiCacheResponse
$creadsPrec :: Int -> ReadS UpdateApiCacheResponse
Prelude.Read, Int -> UpdateApiCacheResponse -> ShowS
[UpdateApiCacheResponse] -> ShowS
UpdateApiCacheResponse -> String
(Int -> UpdateApiCacheResponse -> ShowS)
-> (UpdateApiCacheResponse -> String)
-> ([UpdateApiCacheResponse] -> ShowS)
-> Show UpdateApiCacheResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateApiCacheResponse] -> ShowS
$cshowList :: [UpdateApiCacheResponse] -> ShowS
show :: UpdateApiCacheResponse -> String
$cshow :: UpdateApiCacheResponse -> String
showsPrec :: Int -> UpdateApiCacheResponse -> ShowS
$cshowsPrec :: Int -> UpdateApiCacheResponse -> ShowS
Prelude.Show, (forall x. UpdateApiCacheResponse -> Rep UpdateApiCacheResponse x)
-> (forall x.
Rep UpdateApiCacheResponse x -> UpdateApiCacheResponse)
-> Generic UpdateApiCacheResponse
forall x. Rep UpdateApiCacheResponse x -> UpdateApiCacheResponse
forall x. UpdateApiCacheResponse -> Rep UpdateApiCacheResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateApiCacheResponse x -> UpdateApiCacheResponse
$cfrom :: forall x. UpdateApiCacheResponse -> Rep UpdateApiCacheResponse x
Prelude.Generic)
newUpdateApiCacheResponse ::
Prelude.Int ->
UpdateApiCacheResponse
newUpdateApiCacheResponse :: Int -> UpdateApiCacheResponse
newUpdateApiCacheResponse Int
pHttpStatus_ =
UpdateApiCacheResponse' :: Maybe ApiCache -> Int -> UpdateApiCacheResponse
UpdateApiCacheResponse'
{ $sel:apiCache:UpdateApiCacheResponse' :: Maybe ApiCache
apiCache = Maybe ApiCache
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateApiCacheResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateApiCacheResponse_apiCache :: Lens.Lens' UpdateApiCacheResponse (Prelude.Maybe ApiCache)
updateApiCacheResponse_apiCache :: (Maybe ApiCache -> f (Maybe ApiCache))
-> UpdateApiCacheResponse -> f UpdateApiCacheResponse
updateApiCacheResponse_apiCache = (UpdateApiCacheResponse -> Maybe ApiCache)
-> (UpdateApiCacheResponse
-> Maybe ApiCache -> UpdateApiCacheResponse)
-> Lens
UpdateApiCacheResponse
UpdateApiCacheResponse
(Maybe ApiCache)
(Maybe ApiCache)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiCacheResponse' {Maybe ApiCache
apiCache :: Maybe ApiCache
$sel:apiCache:UpdateApiCacheResponse' :: UpdateApiCacheResponse -> Maybe ApiCache
apiCache} -> Maybe ApiCache
apiCache) (\s :: UpdateApiCacheResponse
s@UpdateApiCacheResponse' {} Maybe ApiCache
a -> UpdateApiCacheResponse
s {$sel:apiCache:UpdateApiCacheResponse' :: Maybe ApiCache
apiCache = Maybe ApiCache
a} :: UpdateApiCacheResponse)
updateApiCacheResponse_httpStatus :: Lens.Lens' UpdateApiCacheResponse Prelude.Int
updateApiCacheResponse_httpStatus :: (Int -> f Int)
-> UpdateApiCacheResponse -> f UpdateApiCacheResponse
updateApiCacheResponse_httpStatus = (UpdateApiCacheResponse -> Int)
-> (UpdateApiCacheResponse -> Int -> UpdateApiCacheResponse)
-> Lens UpdateApiCacheResponse UpdateApiCacheResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApiCacheResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateApiCacheResponse' :: UpdateApiCacheResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateApiCacheResponse
s@UpdateApiCacheResponse' {} Int
a -> UpdateApiCacheResponse
s {$sel:httpStatus:UpdateApiCacheResponse' :: Int
httpStatus = Int
a} :: UpdateApiCacheResponse)
instance Prelude.NFData UpdateApiCacheResponse