{-# 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.DynamoDB.UpdateTimeToLive
(
UpdateTimeToLive (..),
newUpdateTimeToLive,
updateTimeToLive_tableName,
updateTimeToLive_timeToLiveSpecification,
UpdateTimeToLiveResponse (..),
newUpdateTimeToLiveResponse,
updateTimeToLiveResponse_timeToLiveSpecification,
updateTimeToLiveResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types
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 UpdateTimeToLive = UpdateTimeToLive'
{
UpdateTimeToLive -> Text
tableName :: Prelude.Text,
UpdateTimeToLive -> TimeToLiveSpecification
timeToLiveSpecification :: TimeToLiveSpecification
}
deriving (UpdateTimeToLive -> UpdateTimeToLive -> Bool
(UpdateTimeToLive -> UpdateTimeToLive -> Bool)
-> (UpdateTimeToLive -> UpdateTimeToLive -> Bool)
-> Eq UpdateTimeToLive
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTimeToLive -> UpdateTimeToLive -> Bool
$c/= :: UpdateTimeToLive -> UpdateTimeToLive -> Bool
== :: UpdateTimeToLive -> UpdateTimeToLive -> Bool
$c== :: UpdateTimeToLive -> UpdateTimeToLive -> Bool
Prelude.Eq, ReadPrec [UpdateTimeToLive]
ReadPrec UpdateTimeToLive
Int -> ReadS UpdateTimeToLive
ReadS [UpdateTimeToLive]
(Int -> ReadS UpdateTimeToLive)
-> ReadS [UpdateTimeToLive]
-> ReadPrec UpdateTimeToLive
-> ReadPrec [UpdateTimeToLive]
-> Read UpdateTimeToLive
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTimeToLive]
$creadListPrec :: ReadPrec [UpdateTimeToLive]
readPrec :: ReadPrec UpdateTimeToLive
$creadPrec :: ReadPrec UpdateTimeToLive
readList :: ReadS [UpdateTimeToLive]
$creadList :: ReadS [UpdateTimeToLive]
readsPrec :: Int -> ReadS UpdateTimeToLive
$creadsPrec :: Int -> ReadS UpdateTimeToLive
Prelude.Read, Int -> UpdateTimeToLive -> ShowS
[UpdateTimeToLive] -> ShowS
UpdateTimeToLive -> String
(Int -> UpdateTimeToLive -> ShowS)
-> (UpdateTimeToLive -> String)
-> ([UpdateTimeToLive] -> ShowS)
-> Show UpdateTimeToLive
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTimeToLive] -> ShowS
$cshowList :: [UpdateTimeToLive] -> ShowS
show :: UpdateTimeToLive -> String
$cshow :: UpdateTimeToLive -> String
showsPrec :: Int -> UpdateTimeToLive -> ShowS
$cshowsPrec :: Int -> UpdateTimeToLive -> ShowS
Prelude.Show, (forall x. UpdateTimeToLive -> Rep UpdateTimeToLive x)
-> (forall x. Rep UpdateTimeToLive x -> UpdateTimeToLive)
-> Generic UpdateTimeToLive
forall x. Rep UpdateTimeToLive x -> UpdateTimeToLive
forall x. UpdateTimeToLive -> Rep UpdateTimeToLive x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTimeToLive x -> UpdateTimeToLive
$cfrom :: forall x. UpdateTimeToLive -> Rep UpdateTimeToLive x
Prelude.Generic)
newUpdateTimeToLive ::
Prelude.Text ->
TimeToLiveSpecification ->
UpdateTimeToLive
newUpdateTimeToLive :: Text -> TimeToLiveSpecification -> UpdateTimeToLive
newUpdateTimeToLive
Text
pTableName_
TimeToLiveSpecification
pTimeToLiveSpecification_ =
UpdateTimeToLive' :: Text -> TimeToLiveSpecification -> UpdateTimeToLive
UpdateTimeToLive'
{ $sel:tableName:UpdateTimeToLive' :: Text
tableName = Text
pTableName_,
$sel:timeToLiveSpecification:UpdateTimeToLive' :: TimeToLiveSpecification
timeToLiveSpecification = TimeToLiveSpecification
pTimeToLiveSpecification_
}
updateTimeToLive_tableName :: Lens.Lens' UpdateTimeToLive Prelude.Text
updateTimeToLive_tableName :: (Text -> f Text) -> UpdateTimeToLive -> f UpdateTimeToLive
updateTimeToLive_tableName = (UpdateTimeToLive -> Text)
-> (UpdateTimeToLive -> Text -> UpdateTimeToLive)
-> Lens UpdateTimeToLive UpdateTimeToLive Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTimeToLive' {Text
tableName :: Text
$sel:tableName:UpdateTimeToLive' :: UpdateTimeToLive -> Text
tableName} -> Text
tableName) (\s :: UpdateTimeToLive
s@UpdateTimeToLive' {} Text
a -> UpdateTimeToLive
s {$sel:tableName:UpdateTimeToLive' :: Text
tableName = Text
a} :: UpdateTimeToLive)
updateTimeToLive_timeToLiveSpecification :: Lens.Lens' UpdateTimeToLive TimeToLiveSpecification
updateTimeToLive_timeToLiveSpecification :: (TimeToLiveSpecification -> f TimeToLiveSpecification)
-> UpdateTimeToLive -> f UpdateTimeToLive
updateTimeToLive_timeToLiveSpecification = (UpdateTimeToLive -> TimeToLiveSpecification)
-> (UpdateTimeToLive
-> TimeToLiveSpecification -> UpdateTimeToLive)
-> Lens
UpdateTimeToLive
UpdateTimeToLive
TimeToLiveSpecification
TimeToLiveSpecification
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTimeToLive' {TimeToLiveSpecification
timeToLiveSpecification :: TimeToLiveSpecification
$sel:timeToLiveSpecification:UpdateTimeToLive' :: UpdateTimeToLive -> TimeToLiveSpecification
timeToLiveSpecification} -> TimeToLiveSpecification
timeToLiveSpecification) (\s :: UpdateTimeToLive
s@UpdateTimeToLive' {} TimeToLiveSpecification
a -> UpdateTimeToLive
s {$sel:timeToLiveSpecification:UpdateTimeToLive' :: TimeToLiveSpecification
timeToLiveSpecification = TimeToLiveSpecification
a} :: UpdateTimeToLive)
instance Core.AWSRequest UpdateTimeToLive where
type
AWSResponse UpdateTimeToLive =
UpdateTimeToLiveResponse
request :: UpdateTimeToLive -> Request UpdateTimeToLive
request = Service -> UpdateTimeToLive -> Request UpdateTimeToLive
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateTimeToLive
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTimeToLive)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateTimeToLive))
-> Logger
-> Service
-> Proxy UpdateTimeToLive
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTimeToLive)))
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 TimeToLiveSpecification -> Int -> UpdateTimeToLiveResponse
UpdateTimeToLiveResponse'
(Maybe TimeToLiveSpecification -> Int -> UpdateTimeToLiveResponse)
-> Either String (Maybe TimeToLiveSpecification)
-> Either String (Int -> UpdateTimeToLiveResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe TimeToLiveSpecification)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TimeToLiveSpecification")
Either String (Int -> UpdateTimeToLiveResponse)
-> Either String Int -> Either String UpdateTimeToLiveResponse
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 UpdateTimeToLive
instance Prelude.NFData UpdateTimeToLive
instance Core.ToHeaders UpdateTimeToLive where
toHeaders :: UpdateTimeToLive -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateTimeToLive -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DynamoDB_20120810.UpdateTimeToLive" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateTimeToLive where
toJSON :: UpdateTimeToLive -> Value
toJSON UpdateTimeToLive' {Text
TimeToLiveSpecification
timeToLiveSpecification :: TimeToLiveSpecification
tableName :: Text
$sel:timeToLiveSpecification:UpdateTimeToLive' :: UpdateTimeToLive -> TimeToLiveSpecification
$sel:tableName:UpdateTimeToLive' :: UpdateTimeToLive -> 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
"TableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"TimeToLiveSpecification"
Text -> TimeToLiveSpecification -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TimeToLiveSpecification
timeToLiveSpecification
)
]
)
instance Core.ToPath UpdateTimeToLive where
toPath :: UpdateTimeToLive -> ByteString
toPath = ByteString -> UpdateTimeToLive -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateTimeToLive where
toQuery :: UpdateTimeToLive -> QueryString
toQuery = QueryString -> UpdateTimeToLive -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateTimeToLiveResponse = UpdateTimeToLiveResponse'
{
UpdateTimeToLiveResponse -> Maybe TimeToLiveSpecification
timeToLiveSpecification :: Prelude.Maybe TimeToLiveSpecification,
UpdateTimeToLiveResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateTimeToLiveResponse -> UpdateTimeToLiveResponse -> Bool
(UpdateTimeToLiveResponse -> UpdateTimeToLiveResponse -> Bool)
-> (UpdateTimeToLiveResponse -> UpdateTimeToLiveResponse -> Bool)
-> Eq UpdateTimeToLiveResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTimeToLiveResponse -> UpdateTimeToLiveResponse -> Bool
$c/= :: UpdateTimeToLiveResponse -> UpdateTimeToLiveResponse -> Bool
== :: UpdateTimeToLiveResponse -> UpdateTimeToLiveResponse -> Bool
$c== :: UpdateTimeToLiveResponse -> UpdateTimeToLiveResponse -> Bool
Prelude.Eq, ReadPrec [UpdateTimeToLiveResponse]
ReadPrec UpdateTimeToLiveResponse
Int -> ReadS UpdateTimeToLiveResponse
ReadS [UpdateTimeToLiveResponse]
(Int -> ReadS UpdateTimeToLiveResponse)
-> ReadS [UpdateTimeToLiveResponse]
-> ReadPrec UpdateTimeToLiveResponse
-> ReadPrec [UpdateTimeToLiveResponse]
-> Read UpdateTimeToLiveResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTimeToLiveResponse]
$creadListPrec :: ReadPrec [UpdateTimeToLiveResponse]
readPrec :: ReadPrec UpdateTimeToLiveResponse
$creadPrec :: ReadPrec UpdateTimeToLiveResponse
readList :: ReadS [UpdateTimeToLiveResponse]
$creadList :: ReadS [UpdateTimeToLiveResponse]
readsPrec :: Int -> ReadS UpdateTimeToLiveResponse
$creadsPrec :: Int -> ReadS UpdateTimeToLiveResponse
Prelude.Read, Int -> UpdateTimeToLiveResponse -> ShowS
[UpdateTimeToLiveResponse] -> ShowS
UpdateTimeToLiveResponse -> String
(Int -> UpdateTimeToLiveResponse -> ShowS)
-> (UpdateTimeToLiveResponse -> String)
-> ([UpdateTimeToLiveResponse] -> ShowS)
-> Show UpdateTimeToLiveResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTimeToLiveResponse] -> ShowS
$cshowList :: [UpdateTimeToLiveResponse] -> ShowS
show :: UpdateTimeToLiveResponse -> String
$cshow :: UpdateTimeToLiveResponse -> String
showsPrec :: Int -> UpdateTimeToLiveResponse -> ShowS
$cshowsPrec :: Int -> UpdateTimeToLiveResponse -> ShowS
Prelude.Show, (forall x.
UpdateTimeToLiveResponse -> Rep UpdateTimeToLiveResponse x)
-> (forall x.
Rep UpdateTimeToLiveResponse x -> UpdateTimeToLiveResponse)
-> Generic UpdateTimeToLiveResponse
forall x.
Rep UpdateTimeToLiveResponse x -> UpdateTimeToLiveResponse
forall x.
UpdateTimeToLiveResponse -> Rep UpdateTimeToLiveResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateTimeToLiveResponse x -> UpdateTimeToLiveResponse
$cfrom :: forall x.
UpdateTimeToLiveResponse -> Rep UpdateTimeToLiveResponse x
Prelude.Generic)
newUpdateTimeToLiveResponse ::
Prelude.Int ->
UpdateTimeToLiveResponse
newUpdateTimeToLiveResponse :: Int -> UpdateTimeToLiveResponse
newUpdateTimeToLiveResponse Int
pHttpStatus_ =
UpdateTimeToLiveResponse' :: Maybe TimeToLiveSpecification -> Int -> UpdateTimeToLiveResponse
UpdateTimeToLiveResponse'
{ $sel:timeToLiveSpecification:UpdateTimeToLiveResponse' :: Maybe TimeToLiveSpecification
timeToLiveSpecification =
Maybe TimeToLiveSpecification
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateTimeToLiveResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateTimeToLiveResponse_timeToLiveSpecification :: Lens.Lens' UpdateTimeToLiveResponse (Prelude.Maybe TimeToLiveSpecification)
updateTimeToLiveResponse_timeToLiveSpecification :: (Maybe TimeToLiveSpecification
-> f (Maybe TimeToLiveSpecification))
-> UpdateTimeToLiveResponse -> f UpdateTimeToLiveResponse
updateTimeToLiveResponse_timeToLiveSpecification = (UpdateTimeToLiveResponse -> Maybe TimeToLiveSpecification)
-> (UpdateTimeToLiveResponse
-> Maybe TimeToLiveSpecification -> UpdateTimeToLiveResponse)
-> Lens
UpdateTimeToLiveResponse
UpdateTimeToLiveResponse
(Maybe TimeToLiveSpecification)
(Maybe TimeToLiveSpecification)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTimeToLiveResponse' {Maybe TimeToLiveSpecification
timeToLiveSpecification :: Maybe TimeToLiveSpecification
$sel:timeToLiveSpecification:UpdateTimeToLiveResponse' :: UpdateTimeToLiveResponse -> Maybe TimeToLiveSpecification
timeToLiveSpecification} -> Maybe TimeToLiveSpecification
timeToLiveSpecification) (\s :: UpdateTimeToLiveResponse
s@UpdateTimeToLiveResponse' {} Maybe TimeToLiveSpecification
a -> UpdateTimeToLiveResponse
s {$sel:timeToLiveSpecification:UpdateTimeToLiveResponse' :: Maybe TimeToLiveSpecification
timeToLiveSpecification = Maybe TimeToLiveSpecification
a} :: UpdateTimeToLiveResponse)
updateTimeToLiveResponse_httpStatus :: Lens.Lens' UpdateTimeToLiveResponse Prelude.Int
updateTimeToLiveResponse_httpStatus :: (Int -> f Int)
-> UpdateTimeToLiveResponse -> f UpdateTimeToLiveResponse
updateTimeToLiveResponse_httpStatus = (UpdateTimeToLiveResponse -> Int)
-> (UpdateTimeToLiveResponse -> Int -> UpdateTimeToLiveResponse)
-> Lens UpdateTimeToLiveResponse UpdateTimeToLiveResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTimeToLiveResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateTimeToLiveResponse' :: UpdateTimeToLiveResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateTimeToLiveResponse
s@UpdateTimeToLiveResponse' {} Int
a -> UpdateTimeToLiveResponse
s {$sel:httpStatus:UpdateTimeToLiveResponse' :: Int
httpStatus = Int
a} :: UpdateTimeToLiveResponse)
instance Prelude.NFData UpdateTimeToLiveResponse