{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DynamoDB.Types
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
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]
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
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. 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'
{ $sel:tableName:UpdateTimeToLive' :: Text
tableName = Text
pTableName_,
$sel:timeToLiveSpecification:UpdateTimeToLive' :: TimeToLiveSpecification
timeToLiveSpecification = TimeToLiveSpecification
pTimeToLiveSpecification_
}
updateTimeToLive_tableName :: Lens.Lens' UpdateTimeToLive Prelude.Text
updateTimeToLive_tableName :: Lens' UpdateTimeToLive Text
updateTimeToLive_tableName = 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 :: Lens' UpdateTimeToLive TimeToLiveSpecification
updateTimeToLive_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 :: (Service -> Service)
-> UpdateTimeToLive -> Request UpdateTimeToLive
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateTimeToLive
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTimeToLive)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe TimeToLiveSpecification -> Int -> UpdateTimeToLiveResponse
UpdateTimeToLiveResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"TimeToLiveSpecification")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateTimeToLive where
hashWithSalt :: Int -> UpdateTimeToLive -> Int
hashWithSalt Int
_salt UpdateTimeToLive' {Text
TimeToLiveSpecification
timeToLiveSpecification :: TimeToLiveSpecification
tableName :: Text
$sel:timeToLiveSpecification:UpdateTimeToLive' :: UpdateTimeToLive -> TimeToLiveSpecification
$sel:tableName:UpdateTimeToLive' :: UpdateTimeToLive -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TimeToLiveSpecification
timeToLiveSpecification
instance Prelude.NFData UpdateTimeToLive where
rnf :: UpdateTimeToLive -> ()
rnf UpdateTimeToLive' {Text
TimeToLiveSpecification
timeToLiveSpecification :: TimeToLiveSpecification
tableName :: Text
$sel:timeToLiveSpecification:UpdateTimeToLive' :: UpdateTimeToLive -> TimeToLiveSpecification
$sel:tableName:UpdateTimeToLive' :: UpdateTimeToLive -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TimeToLiveSpecification
timeToLiveSpecification
instance Data.ToHeaders UpdateTimeToLive where
toHeaders :: UpdateTimeToLive -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"DynamoDB_20120810.UpdateTimeToLive" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"TableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName),
forall a. a -> Maybe a
Prelude.Just
( Key
"TimeToLiveSpecification"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= TimeToLiveSpecification
timeToLiveSpecification
)
]
)
instance Data.ToPath UpdateTimeToLive where
toPath :: UpdateTimeToLive -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateTimeToLive where
toQuery :: UpdateTimeToLive -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:timeToLiveSpecification:UpdateTimeToLiveResponse' :: Maybe TimeToLiveSpecification
timeToLiveSpecification =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateTimeToLiveResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateTimeToLiveResponse_timeToLiveSpecification :: Lens.Lens' UpdateTimeToLiveResponse (Prelude.Maybe TimeToLiveSpecification)
updateTimeToLiveResponse_timeToLiveSpecification :: Lens' UpdateTimeToLiveResponse (Maybe TimeToLiveSpecification)
updateTimeToLiveResponse_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 :: Lens' UpdateTimeToLiveResponse Int
updateTimeToLiveResponse_httpStatus = 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 where
rnf :: UpdateTimeToLiveResponse -> ()
rnf UpdateTimeToLiveResponse' {Int
Maybe TimeToLiveSpecification
httpStatus :: Int
timeToLiveSpecification :: Maybe TimeToLiveSpecification
$sel:httpStatus:UpdateTimeToLiveResponse' :: UpdateTimeToLiveResponse -> Int
$sel:timeToLiveSpecification:UpdateTimeToLiveResponse' :: UpdateTimeToLiveResponse -> Maybe TimeToLiveSpecification
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe TimeToLiveSpecification
timeToLiveSpecification
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus