1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package qldb
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/qldb/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Returns a revision data object for a specified document ID and block address.
15// Also returns a proof of the specified revision for verification if
16// DigestTipAddress is provided.
17func (c *Client) GetRevision(ctx context.Context, params *GetRevisionInput, optFns ...func(*Options)) (*GetRevisionOutput, error) {
18	if params == nil {
19		params = &GetRevisionInput{}
20	}
21
22	result, metadata, err := c.invokeOperation(ctx, "GetRevision", params, optFns, addOperationGetRevisionMiddlewares)
23	if err != nil {
24		return nil, err
25	}
26
27	out := result.(*GetRevisionOutput)
28	out.ResultMetadata = metadata
29	return out, nil
30}
31
32type GetRevisionInput struct {
33
34	// The block location of the document revision to be verified. An address is an
35	// Amazon Ion structure that has two fields: strandId and sequenceNo. For example:
36	// {strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:14}
37	//
38	// This member is required.
39	BlockAddress *types.ValueHolder
40
41	// The unique ID of the document to be verified.
42	//
43	// This member is required.
44	DocumentId *string
45
46	// The name of the ledger.
47	//
48	// This member is required.
49	Name *string
50
51	// The latest block location covered by the digest for which to request a proof. An
52	// address is an Amazon Ion structure that has two fields: strandId and sequenceNo.
53	// For example: {strandId:"BlFTjlSXze9BIh1KOszcE3",sequenceNo:49}
54	DigestTipAddress *types.ValueHolder
55}
56
57type GetRevisionOutput struct {
58
59	// The document revision data object in Amazon Ion format.
60	//
61	// This member is required.
62	Revision *types.ValueHolder
63
64	// The proof object in Amazon Ion format returned by a GetRevision request. A proof
65	// contains the list of hash values that are required to recalculate the specified
66	// digest using a Merkle tree, starting with the specified document revision.
67	Proof *types.ValueHolder
68
69	// Metadata pertaining to the operation's result.
70	ResultMetadata middleware.Metadata
71}
72
73func addOperationGetRevisionMiddlewares(stack *middleware.Stack, options Options) (err error) {
74	err = stack.Serialize.Add(&awsRestjson1_serializeOpGetRevision{}, middleware.After)
75	if err != nil {
76		return err
77	}
78	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetRevision{}, middleware.After)
79	if err != nil {
80		return err
81	}
82	if err = addSetLoggerMiddleware(stack, options); err != nil {
83		return err
84	}
85	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
86		return err
87	}
88	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
89		return err
90	}
91	if err = addResolveEndpointMiddleware(stack, options); err != nil {
92		return err
93	}
94	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
95		return err
96	}
97	if err = addRetryMiddlewares(stack, options); err != nil {
98		return err
99	}
100	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
101		return err
102	}
103	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
104		return err
105	}
106	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
107		return err
108	}
109	if err = addClientUserAgent(stack); err != nil {
110		return err
111	}
112	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
113		return err
114	}
115	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
116		return err
117	}
118	if err = addOpGetRevisionValidationMiddleware(stack); err != nil {
119		return err
120	}
121	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRevision(options.Region), middleware.Before); err != nil {
122		return err
123	}
124	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
125		return err
126	}
127	if err = addResponseErrorMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addRequestResponseLogging(stack, options); err != nil {
131		return err
132	}
133	return nil
134}
135
136func newServiceMetadataMiddleware_opGetRevision(region string) *awsmiddleware.RegisterServiceMetadata {
137	return &awsmiddleware.RegisterServiceMetadata{
138		Region:        region,
139		ServiceID:     ServiceID,
140		SigningName:   "qldb",
141		OperationName: "GetRevision",
142	}
143}
144