{-# 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.RDSData.RollbackTransaction
(
RollbackTransaction (..),
newRollbackTransaction,
rollbackTransaction_resourceArn,
rollbackTransaction_secretArn,
rollbackTransaction_transactionId,
RollbackTransactionResponse (..),
newRollbackTransactionResponse,
rollbackTransactionResponse_transactionStatus,
rollbackTransactionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDSData.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RollbackTransaction = RollbackTransaction'
{
RollbackTransaction -> Text
resourceArn :: Prelude.Text,
RollbackTransaction -> Text
secretArn :: Prelude.Text,
RollbackTransaction -> Text
transactionId :: Prelude.Text
}
deriving (RollbackTransaction -> RollbackTransaction -> Bool
(RollbackTransaction -> RollbackTransaction -> Bool)
-> (RollbackTransaction -> RollbackTransaction -> Bool)
-> Eq RollbackTransaction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RollbackTransaction -> RollbackTransaction -> Bool
$c/= :: RollbackTransaction -> RollbackTransaction -> Bool
== :: RollbackTransaction -> RollbackTransaction -> Bool
$c== :: RollbackTransaction -> RollbackTransaction -> Bool
Prelude.Eq, ReadPrec [RollbackTransaction]
ReadPrec RollbackTransaction
Int -> ReadS RollbackTransaction
ReadS [RollbackTransaction]
(Int -> ReadS RollbackTransaction)
-> ReadS [RollbackTransaction]
-> ReadPrec RollbackTransaction
-> ReadPrec [RollbackTransaction]
-> Read RollbackTransaction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RollbackTransaction]
$creadListPrec :: ReadPrec [RollbackTransaction]
readPrec :: ReadPrec RollbackTransaction
$creadPrec :: ReadPrec RollbackTransaction
readList :: ReadS [RollbackTransaction]
$creadList :: ReadS [RollbackTransaction]
readsPrec :: Int -> ReadS RollbackTransaction
$creadsPrec :: Int -> ReadS RollbackTransaction
Prelude.Read, Int -> RollbackTransaction -> ShowS
[RollbackTransaction] -> ShowS
RollbackTransaction -> String
(Int -> RollbackTransaction -> ShowS)
-> (RollbackTransaction -> String)
-> ([RollbackTransaction] -> ShowS)
-> Show RollbackTransaction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RollbackTransaction] -> ShowS
$cshowList :: [RollbackTransaction] -> ShowS
show :: RollbackTransaction -> String
$cshow :: RollbackTransaction -> String
showsPrec :: Int -> RollbackTransaction -> ShowS
$cshowsPrec :: Int -> RollbackTransaction -> ShowS
Prelude.Show, (forall x. RollbackTransaction -> Rep RollbackTransaction x)
-> (forall x. Rep RollbackTransaction x -> RollbackTransaction)
-> Generic RollbackTransaction
forall x. Rep RollbackTransaction x -> RollbackTransaction
forall x. RollbackTransaction -> Rep RollbackTransaction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RollbackTransaction x -> RollbackTransaction
$cfrom :: forall x. RollbackTransaction -> Rep RollbackTransaction x
Prelude.Generic)
newRollbackTransaction ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
RollbackTransaction
newRollbackTransaction :: Text -> Text -> Text -> RollbackTransaction
newRollbackTransaction
Text
pResourceArn_
Text
pSecretArn_
Text
pTransactionId_ =
RollbackTransaction' :: Text -> Text -> Text -> RollbackTransaction
RollbackTransaction'
{ $sel:resourceArn:RollbackTransaction' :: Text
resourceArn = Text
pResourceArn_,
$sel:secretArn:RollbackTransaction' :: Text
secretArn = Text
pSecretArn_,
$sel:transactionId:RollbackTransaction' :: Text
transactionId = Text
pTransactionId_
}
rollbackTransaction_resourceArn :: Lens.Lens' RollbackTransaction Prelude.Text
rollbackTransaction_resourceArn :: (Text -> f Text) -> RollbackTransaction -> f RollbackTransaction
rollbackTransaction_resourceArn = (RollbackTransaction -> Text)
-> (RollbackTransaction -> Text -> RollbackTransaction)
-> Lens RollbackTransaction RollbackTransaction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackTransaction' {Text
resourceArn :: Text
$sel:resourceArn:RollbackTransaction' :: RollbackTransaction -> Text
resourceArn} -> Text
resourceArn) (\s :: RollbackTransaction
s@RollbackTransaction' {} Text
a -> RollbackTransaction
s {$sel:resourceArn:RollbackTransaction' :: Text
resourceArn = Text
a} :: RollbackTransaction)
rollbackTransaction_secretArn :: Lens.Lens' RollbackTransaction Prelude.Text
rollbackTransaction_secretArn :: (Text -> f Text) -> RollbackTransaction -> f RollbackTransaction
rollbackTransaction_secretArn = (RollbackTransaction -> Text)
-> (RollbackTransaction -> Text -> RollbackTransaction)
-> Lens RollbackTransaction RollbackTransaction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackTransaction' {Text
secretArn :: Text
$sel:secretArn:RollbackTransaction' :: RollbackTransaction -> Text
secretArn} -> Text
secretArn) (\s :: RollbackTransaction
s@RollbackTransaction' {} Text
a -> RollbackTransaction
s {$sel:secretArn:RollbackTransaction' :: Text
secretArn = Text
a} :: RollbackTransaction)
rollbackTransaction_transactionId :: Lens.Lens' RollbackTransaction Prelude.Text
rollbackTransaction_transactionId :: (Text -> f Text) -> RollbackTransaction -> f RollbackTransaction
rollbackTransaction_transactionId = (RollbackTransaction -> Text)
-> (RollbackTransaction -> Text -> RollbackTransaction)
-> Lens RollbackTransaction RollbackTransaction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackTransaction' {Text
transactionId :: Text
$sel:transactionId:RollbackTransaction' :: RollbackTransaction -> Text
transactionId} -> Text
transactionId) (\s :: RollbackTransaction
s@RollbackTransaction' {} Text
a -> RollbackTransaction
s {$sel:transactionId:RollbackTransaction' :: Text
transactionId = Text
a} :: RollbackTransaction)
instance Core.AWSRequest RollbackTransaction where
type
AWSResponse RollbackTransaction =
RollbackTransactionResponse
request :: RollbackTransaction -> Request RollbackTransaction
request = Service -> RollbackTransaction -> Request RollbackTransaction
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RollbackTransaction
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RollbackTransaction)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RollbackTransaction))
-> Logger
-> Service
-> Proxy RollbackTransaction
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RollbackTransaction)))
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 Text -> Int -> RollbackTransactionResponse
RollbackTransactionResponse'
(Maybe Text -> Int -> RollbackTransactionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RollbackTransactionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"transactionStatus")
Either String (Int -> RollbackTransactionResponse)
-> Either String Int -> Either String RollbackTransactionResponse
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 RollbackTransaction
instance Prelude.NFData RollbackTransaction
instance Core.ToHeaders RollbackTransaction where
toHeaders :: RollbackTransaction -> ResponseHeaders
toHeaders =
ResponseHeaders -> RollbackTransaction -> 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 RollbackTransaction where
toJSON :: RollbackTransaction -> Value
toJSON RollbackTransaction' {Text
transactionId :: Text
secretArn :: Text
resourceArn :: Text
$sel:transactionId:RollbackTransaction' :: RollbackTransaction -> Text
$sel:secretArn:RollbackTransaction' :: RollbackTransaction -> Text
$sel:resourceArn:RollbackTransaction' :: RollbackTransaction -> 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
"resourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"secretArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
secretArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"transactionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
transactionId)
]
)
instance Core.ToPath RollbackTransaction where
toPath :: RollbackTransaction -> ByteString
toPath = ByteString -> RollbackTransaction -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/RollbackTransaction"
instance Core.ToQuery RollbackTransaction where
toQuery :: RollbackTransaction -> QueryString
toQuery = QueryString -> RollbackTransaction -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RollbackTransactionResponse = RollbackTransactionResponse'
{
RollbackTransactionResponse -> Maybe Text
transactionStatus :: Prelude.Maybe Prelude.Text,
RollbackTransactionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RollbackTransactionResponse -> RollbackTransactionResponse -> Bool
(RollbackTransactionResponse
-> RollbackTransactionResponse -> Bool)
-> (RollbackTransactionResponse
-> RollbackTransactionResponse -> Bool)
-> Eq RollbackTransactionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RollbackTransactionResponse -> RollbackTransactionResponse -> Bool
$c/= :: RollbackTransactionResponse -> RollbackTransactionResponse -> Bool
== :: RollbackTransactionResponse -> RollbackTransactionResponse -> Bool
$c== :: RollbackTransactionResponse -> RollbackTransactionResponse -> Bool
Prelude.Eq, ReadPrec [RollbackTransactionResponse]
ReadPrec RollbackTransactionResponse
Int -> ReadS RollbackTransactionResponse
ReadS [RollbackTransactionResponse]
(Int -> ReadS RollbackTransactionResponse)
-> ReadS [RollbackTransactionResponse]
-> ReadPrec RollbackTransactionResponse
-> ReadPrec [RollbackTransactionResponse]
-> Read RollbackTransactionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RollbackTransactionResponse]
$creadListPrec :: ReadPrec [RollbackTransactionResponse]
readPrec :: ReadPrec RollbackTransactionResponse
$creadPrec :: ReadPrec RollbackTransactionResponse
readList :: ReadS [RollbackTransactionResponse]
$creadList :: ReadS [RollbackTransactionResponse]
readsPrec :: Int -> ReadS RollbackTransactionResponse
$creadsPrec :: Int -> ReadS RollbackTransactionResponse
Prelude.Read, Int -> RollbackTransactionResponse -> ShowS
[RollbackTransactionResponse] -> ShowS
RollbackTransactionResponse -> String
(Int -> RollbackTransactionResponse -> ShowS)
-> (RollbackTransactionResponse -> String)
-> ([RollbackTransactionResponse] -> ShowS)
-> Show RollbackTransactionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RollbackTransactionResponse] -> ShowS
$cshowList :: [RollbackTransactionResponse] -> ShowS
show :: RollbackTransactionResponse -> String
$cshow :: RollbackTransactionResponse -> String
showsPrec :: Int -> RollbackTransactionResponse -> ShowS
$cshowsPrec :: Int -> RollbackTransactionResponse -> ShowS
Prelude.Show, (forall x.
RollbackTransactionResponse -> Rep RollbackTransactionResponse x)
-> (forall x.
Rep RollbackTransactionResponse x -> RollbackTransactionResponse)
-> Generic RollbackTransactionResponse
forall x.
Rep RollbackTransactionResponse x -> RollbackTransactionResponse
forall x.
RollbackTransactionResponse -> Rep RollbackTransactionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RollbackTransactionResponse x -> RollbackTransactionResponse
$cfrom :: forall x.
RollbackTransactionResponse -> Rep RollbackTransactionResponse x
Prelude.Generic)
newRollbackTransactionResponse ::
Prelude.Int ->
RollbackTransactionResponse
newRollbackTransactionResponse :: Int -> RollbackTransactionResponse
newRollbackTransactionResponse Int
pHttpStatus_ =
RollbackTransactionResponse' :: Maybe Text -> Int -> RollbackTransactionResponse
RollbackTransactionResponse'
{ $sel:transactionStatus:RollbackTransactionResponse' :: Maybe Text
transactionStatus =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RollbackTransactionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
rollbackTransactionResponse_transactionStatus :: Lens.Lens' RollbackTransactionResponse (Prelude.Maybe Prelude.Text)
rollbackTransactionResponse_transactionStatus :: (Maybe Text -> f (Maybe Text))
-> RollbackTransactionResponse -> f RollbackTransactionResponse
rollbackTransactionResponse_transactionStatus = (RollbackTransactionResponse -> Maybe Text)
-> (RollbackTransactionResponse
-> Maybe Text -> RollbackTransactionResponse)
-> Lens
RollbackTransactionResponse
RollbackTransactionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackTransactionResponse' {Maybe Text
transactionStatus :: Maybe Text
$sel:transactionStatus:RollbackTransactionResponse' :: RollbackTransactionResponse -> Maybe Text
transactionStatus} -> Maybe Text
transactionStatus) (\s :: RollbackTransactionResponse
s@RollbackTransactionResponse' {} Maybe Text
a -> RollbackTransactionResponse
s {$sel:transactionStatus:RollbackTransactionResponse' :: Maybe Text
transactionStatus = Maybe Text
a} :: RollbackTransactionResponse)
rollbackTransactionResponse_httpStatus :: Lens.Lens' RollbackTransactionResponse Prelude.Int
rollbackTransactionResponse_httpStatus :: (Int -> f Int)
-> RollbackTransactionResponse -> f RollbackTransactionResponse
rollbackTransactionResponse_httpStatus = (RollbackTransactionResponse -> Int)
-> (RollbackTransactionResponse
-> Int -> RollbackTransactionResponse)
-> Lens
RollbackTransactionResponse RollbackTransactionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RollbackTransactionResponse' {Int
httpStatus :: Int
$sel:httpStatus:RollbackTransactionResponse' :: RollbackTransactionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RollbackTransactionResponse
s@RollbackTransactionResponse' {} Int
a -> RollbackTransactionResponse
s {$sel:httpStatus:RollbackTransactionResponse' :: Int
httpStatus = Int
a} :: RollbackTransactionResponse)
instance Prelude.NFData RollbackTransactionResponse