{-# 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.QLDB.GetRevision
(
GetRevision (..),
newGetRevision,
getRevision_digestTipAddress,
getRevision_name,
getRevision_blockAddress,
getRevision_documentId,
GetRevisionResponse (..),
newGetRevisionResponse,
getRevisionResponse_proof,
getRevisionResponse_httpStatus,
getRevisionResponse_revision,
)
where
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
import Amazonka.QLDB.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetRevision = GetRevision'
{
GetRevision -> Maybe (Sensitive ValueHolder)
digestTipAddress :: Prelude.Maybe (Data.Sensitive ValueHolder),
GetRevision -> Text
name :: Prelude.Text,
GetRevision -> Sensitive ValueHolder
blockAddress :: Data.Sensitive ValueHolder,
GetRevision -> Text
documentId :: Prelude.Text
}
deriving (GetRevision -> GetRevision -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRevision -> GetRevision -> Bool
$c/= :: GetRevision -> GetRevision -> Bool
== :: GetRevision -> GetRevision -> Bool
$c== :: GetRevision -> GetRevision -> Bool
Prelude.Eq, Int -> GetRevision -> ShowS
[GetRevision] -> ShowS
GetRevision -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRevision] -> ShowS
$cshowList :: [GetRevision] -> ShowS
show :: GetRevision -> String
$cshow :: GetRevision -> String
showsPrec :: Int -> GetRevision -> ShowS
$cshowsPrec :: Int -> GetRevision -> ShowS
Prelude.Show, forall x. Rep GetRevision x -> GetRevision
forall x. GetRevision -> Rep GetRevision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRevision x -> GetRevision
$cfrom :: forall x. GetRevision -> Rep GetRevision x
Prelude.Generic)
newGetRevision ::
Prelude.Text ->
ValueHolder ->
Prelude.Text ->
GetRevision
newGetRevision :: Text -> ValueHolder -> Text -> GetRevision
newGetRevision Text
pName_ ValueHolder
pBlockAddress_ Text
pDocumentId_ =
GetRevision'
{ $sel:digestTipAddress:GetRevision' :: Maybe (Sensitive ValueHolder)
digestTipAddress = forall a. Maybe a
Prelude.Nothing,
$sel:name:GetRevision' :: Text
name = Text
pName_,
$sel:blockAddress:GetRevision' :: Sensitive ValueHolder
blockAddress = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# ValueHolder
pBlockAddress_,
$sel:documentId:GetRevision' :: Text
documentId = Text
pDocumentId_
}
getRevision_digestTipAddress :: Lens.Lens' GetRevision (Prelude.Maybe ValueHolder)
getRevision_digestTipAddress :: Lens' GetRevision (Maybe ValueHolder)
getRevision_digestTipAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRevision' {Maybe (Sensitive ValueHolder)
digestTipAddress :: Maybe (Sensitive ValueHolder)
$sel:digestTipAddress:GetRevision' :: GetRevision -> Maybe (Sensitive ValueHolder)
digestTipAddress} -> Maybe (Sensitive ValueHolder)
digestTipAddress) (\s :: GetRevision
s@GetRevision' {} Maybe (Sensitive ValueHolder)
a -> GetRevision
s {$sel:digestTipAddress:GetRevision' :: Maybe (Sensitive ValueHolder)
digestTipAddress = Maybe (Sensitive ValueHolder)
a} :: GetRevision) 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 a. Iso' (Sensitive a) a
Data._Sensitive
getRevision_name :: Lens.Lens' GetRevision Prelude.Text
getRevision_name :: Lens' GetRevision Text
getRevision_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRevision' {Text
name :: Text
$sel:name:GetRevision' :: GetRevision -> Text
name} -> Text
name) (\s :: GetRevision
s@GetRevision' {} Text
a -> GetRevision
s {$sel:name:GetRevision' :: Text
name = Text
a} :: GetRevision)
getRevision_blockAddress :: Lens.Lens' GetRevision ValueHolder
getRevision_blockAddress :: Lens' GetRevision ValueHolder
getRevision_blockAddress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRevision' {Sensitive ValueHolder
blockAddress :: Sensitive ValueHolder
$sel:blockAddress:GetRevision' :: GetRevision -> Sensitive ValueHolder
blockAddress} -> Sensitive ValueHolder
blockAddress) (\s :: GetRevision
s@GetRevision' {} Sensitive ValueHolder
a -> GetRevision
s {$sel:blockAddress:GetRevision' :: Sensitive ValueHolder
blockAddress = Sensitive ValueHolder
a} :: GetRevision) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
getRevision_documentId :: Lens.Lens' GetRevision Prelude.Text
getRevision_documentId :: Lens' GetRevision Text
getRevision_documentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRevision' {Text
documentId :: Text
$sel:documentId:GetRevision' :: GetRevision -> Text
documentId} -> Text
documentId) (\s :: GetRevision
s@GetRevision' {} Text
a -> GetRevision
s {$sel:documentId:GetRevision' :: Text
documentId = Text
a} :: GetRevision)
instance Core.AWSRequest GetRevision where
type AWSResponse GetRevision = GetRevisionResponse
request :: (Service -> Service) -> GetRevision -> Request GetRevision
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 GetRevision
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetRevision)))
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 (Sensitive ValueHolder)
-> Int -> Sensitive ValueHolder -> GetRevisionResponse
GetRevisionResponse'
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
"Proof")
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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"Revision")
)
instance Prelude.Hashable GetRevision where
hashWithSalt :: Int -> GetRevision -> Int
hashWithSalt Int
_salt GetRevision' {Maybe (Sensitive ValueHolder)
Text
Sensitive ValueHolder
documentId :: Text
blockAddress :: Sensitive ValueHolder
name :: Text
digestTipAddress :: Maybe (Sensitive ValueHolder)
$sel:documentId:GetRevision' :: GetRevision -> Text
$sel:blockAddress:GetRevision' :: GetRevision -> Sensitive ValueHolder
$sel:name:GetRevision' :: GetRevision -> Text
$sel:digestTipAddress:GetRevision' :: GetRevision -> Maybe (Sensitive ValueHolder)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive ValueHolder)
digestTipAddress
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive ValueHolder
blockAddress
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
documentId
instance Prelude.NFData GetRevision where
rnf :: GetRevision -> ()
rnf GetRevision' {Maybe (Sensitive ValueHolder)
Text
Sensitive ValueHolder
documentId :: Text
blockAddress :: Sensitive ValueHolder
name :: Text
digestTipAddress :: Maybe (Sensitive ValueHolder)
$sel:documentId:GetRevision' :: GetRevision -> Text
$sel:blockAddress:GetRevision' :: GetRevision -> Sensitive ValueHolder
$sel:name:GetRevision' :: GetRevision -> Text
$sel:digestTipAddress:GetRevision' :: GetRevision -> Maybe (Sensitive ValueHolder)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive ValueHolder)
digestTipAddress
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive ValueHolder
blockAddress
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
documentId
instance Data.ToHeaders GetRevision where
toHeaders :: GetRevision -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetRevision where
toJSON :: GetRevision -> Value
toJSON GetRevision' {Maybe (Sensitive ValueHolder)
Text
Sensitive ValueHolder
documentId :: Text
blockAddress :: Sensitive ValueHolder
name :: Text
digestTipAddress :: Maybe (Sensitive ValueHolder)
$sel:documentId:GetRevision' :: GetRevision -> Text
$sel:blockAddress:GetRevision' :: GetRevision -> Sensitive ValueHolder
$sel:name:GetRevision' :: GetRevision -> Text
$sel:digestTipAddress:GetRevision' :: GetRevision -> Maybe (Sensitive ValueHolder)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DigestTipAddress" 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 (Sensitive ValueHolder)
digestTipAddress,
forall a. a -> Maybe a
Prelude.Just (Key
"BlockAddress" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive ValueHolder
blockAddress),
forall a. a -> Maybe a
Prelude.Just (Key
"DocumentId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
documentId)
]
)
instance Data.ToPath GetRevision where
toPath :: GetRevision -> ByteString
toPath GetRevision' {Maybe (Sensitive ValueHolder)
Text
Sensitive ValueHolder
documentId :: Text
blockAddress :: Sensitive ValueHolder
name :: Text
digestTipAddress :: Maybe (Sensitive ValueHolder)
$sel:documentId:GetRevision' :: GetRevision -> Text
$sel:blockAddress:GetRevision' :: GetRevision -> Sensitive ValueHolder
$sel:name:GetRevision' :: GetRevision -> Text
$sel:digestTipAddress:GetRevision' :: GetRevision -> Maybe (Sensitive ValueHolder)
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/ledgers/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name, ByteString
"/revision"]
instance Data.ToQuery GetRevision where
toQuery :: GetRevision -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetRevisionResponse = GetRevisionResponse'
{
GetRevisionResponse -> Maybe (Sensitive ValueHolder)
proof :: Prelude.Maybe (Data.Sensitive ValueHolder),
GetRevisionResponse -> Int
httpStatus :: Prelude.Int,
GetRevisionResponse -> Sensitive ValueHolder
revision :: Data.Sensitive ValueHolder
}
deriving (GetRevisionResponse -> GetRevisionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRevisionResponse -> GetRevisionResponse -> Bool
$c/= :: GetRevisionResponse -> GetRevisionResponse -> Bool
== :: GetRevisionResponse -> GetRevisionResponse -> Bool
$c== :: GetRevisionResponse -> GetRevisionResponse -> Bool
Prelude.Eq, Int -> GetRevisionResponse -> ShowS
[GetRevisionResponse] -> ShowS
GetRevisionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRevisionResponse] -> ShowS
$cshowList :: [GetRevisionResponse] -> ShowS
show :: GetRevisionResponse -> String
$cshow :: GetRevisionResponse -> String
showsPrec :: Int -> GetRevisionResponse -> ShowS
$cshowsPrec :: Int -> GetRevisionResponse -> ShowS
Prelude.Show, forall x. Rep GetRevisionResponse x -> GetRevisionResponse
forall x. GetRevisionResponse -> Rep GetRevisionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRevisionResponse x -> GetRevisionResponse
$cfrom :: forall x. GetRevisionResponse -> Rep GetRevisionResponse x
Prelude.Generic)
newGetRevisionResponse ::
Prelude.Int ->
ValueHolder ->
GetRevisionResponse
newGetRevisionResponse :: Int -> ValueHolder -> GetRevisionResponse
newGetRevisionResponse Int
pHttpStatus_ ValueHolder
pRevision_ =
GetRevisionResponse'
{ $sel:proof:GetRevisionResponse' :: Maybe (Sensitive ValueHolder)
proof = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRevisionResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:revision:GetRevisionResponse' :: Sensitive ValueHolder
revision = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# ValueHolder
pRevision_
}
getRevisionResponse_proof :: Lens.Lens' GetRevisionResponse (Prelude.Maybe ValueHolder)
getRevisionResponse_proof :: Lens' GetRevisionResponse (Maybe ValueHolder)
getRevisionResponse_proof = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRevisionResponse' {Maybe (Sensitive ValueHolder)
proof :: Maybe (Sensitive ValueHolder)
$sel:proof:GetRevisionResponse' :: GetRevisionResponse -> Maybe (Sensitive ValueHolder)
proof} -> Maybe (Sensitive ValueHolder)
proof) (\s :: GetRevisionResponse
s@GetRevisionResponse' {} Maybe (Sensitive ValueHolder)
a -> GetRevisionResponse
s {$sel:proof:GetRevisionResponse' :: Maybe (Sensitive ValueHolder)
proof = Maybe (Sensitive ValueHolder)
a} :: GetRevisionResponse) 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 a. Iso' (Sensitive a) a
Data._Sensitive
getRevisionResponse_httpStatus :: Lens.Lens' GetRevisionResponse Prelude.Int
getRevisionResponse_httpStatus :: Lens' GetRevisionResponse Int
getRevisionResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRevisionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRevisionResponse' :: GetRevisionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRevisionResponse
s@GetRevisionResponse' {} Int
a -> GetRevisionResponse
s {$sel:httpStatus:GetRevisionResponse' :: Int
httpStatus = Int
a} :: GetRevisionResponse)
getRevisionResponse_revision :: Lens.Lens' GetRevisionResponse ValueHolder
getRevisionResponse_revision :: Lens' GetRevisionResponse ValueHolder
getRevisionResponse_revision = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRevisionResponse' {Sensitive ValueHolder
revision :: Sensitive ValueHolder
$sel:revision:GetRevisionResponse' :: GetRevisionResponse -> Sensitive ValueHolder
revision} -> Sensitive ValueHolder
revision) (\s :: GetRevisionResponse
s@GetRevisionResponse' {} Sensitive ValueHolder
a -> GetRevisionResponse
s {$sel:revision:GetRevisionResponse' :: Sensitive ValueHolder
revision = Sensitive ValueHolder
a} :: GetRevisionResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Prelude.NFData GetRevisionResponse where
rnf :: GetRevisionResponse -> ()
rnf GetRevisionResponse' {Int
Maybe (Sensitive ValueHolder)
Sensitive ValueHolder
revision :: Sensitive ValueHolder
httpStatus :: Int
proof :: Maybe (Sensitive ValueHolder)
$sel:revision:GetRevisionResponse' :: GetRevisionResponse -> Sensitive ValueHolder
$sel:httpStatus:GetRevisionResponse' :: GetRevisionResponse -> Int
$sel:proof:GetRevisionResponse' :: GetRevisionResponse -> Maybe (Sensitive ValueHolder)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive ValueHolder)
proof
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive ValueHolder
revision