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	"time"
13)
14
15// Exports journal contents within a date and time range from a ledger into a
16// specified Amazon Simple Storage Service (Amazon S3) bucket. The data is written
17// as files in Amazon Ion format. If the ledger with the given Name doesn't exist,
18// then throws ResourceNotFoundException. If the ledger with the given Name is in
19// CREATING status, then throws ResourcePreconditionNotMetException. You can
20// initiate up to two concurrent journal export requests for each ledger. Beyond
21// this limit, journal export requests throw LimitExceededException.
22func (c *Client) ExportJournalToS3(ctx context.Context, params *ExportJournalToS3Input, optFns ...func(*Options)) (*ExportJournalToS3Output, error) {
23	if params == nil {
24		params = &ExportJournalToS3Input{}
25	}
26
27	result, metadata, err := c.invokeOperation(ctx, "ExportJournalToS3", params, optFns, addOperationExportJournalToS3Middlewares)
28	if err != nil {
29		return nil, err
30	}
31
32	out := result.(*ExportJournalToS3Output)
33	out.ResultMetadata = metadata
34	return out, nil
35}
36
37type ExportJournalToS3Input struct {
38
39	// The exclusive end date and time for the range of journal contents that you want
40	// to export. The ExclusiveEndTime must be in ISO 8601 date and time format and in
41	// Universal Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z The
42	// ExclusiveEndTime must be less than or equal to the current UTC date and time.
43	//
44	// This member is required.
45	ExclusiveEndTime *time.Time
46
47	// The inclusive start date and time for the range of journal contents that you
48	// want to export. The InclusiveStartTime must be in ISO 8601 date and time format
49	// and in Universal Coordinated Time (UTC). For example: 2019-06-13T21:36:34Z The
50	// InclusiveStartTime must be before ExclusiveEndTime. If you provide an
51	// InclusiveStartTime that is before the ledger's CreationDateTime, Amazon QLDB
52	// defaults it to the ledger's CreationDateTime.
53	//
54	// This member is required.
55	InclusiveStartTime *time.Time
56
57	// The name of the ledger.
58	//
59	// This member is required.
60	Name *string
61
62	// The Amazon Resource Name (ARN) of the IAM role that grants QLDB permissions for
63	// a journal export job to do the following:
64	//
65	// * Write objects into your Amazon
66	// Simple Storage Service (Amazon S3) bucket.
67	//
68	// * (Optional) Use your customer
69	// master key (CMK) in AWS Key Management Service (AWS KMS) for server-side
70	// encryption of your exported data.
71	//
72	// This member is required.
73	RoleArn *string
74
75	// The configuration settings of the Amazon S3 bucket destination for your export
76	// request.
77	//
78	// This member is required.
79	S3ExportConfiguration *types.S3ExportConfiguration
80}
81
82type ExportJournalToS3Output struct {
83
84	// The unique ID that QLDB assigns to each journal export job. To describe your
85	// export request and check the status of the job, you can use ExportId to call
86	// DescribeJournalS3Export.
87	//
88	// This member is required.
89	ExportId *string
90
91	// Metadata pertaining to the operation's result.
92	ResultMetadata middleware.Metadata
93}
94
95func addOperationExportJournalToS3Middlewares(stack *middleware.Stack, options Options) (err error) {
96	err = stack.Serialize.Add(&awsRestjson1_serializeOpExportJournalToS3{}, middleware.After)
97	if err != nil {
98		return err
99	}
100	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpExportJournalToS3{}, middleware.After)
101	if err != nil {
102		return err
103	}
104	if err = addSetLoggerMiddleware(stack, options); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
108		return err
109	}
110	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
111		return err
112	}
113	if err = addResolveEndpointMiddleware(stack, options); err != nil {
114		return err
115	}
116	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
117		return err
118	}
119	if err = addRetryMiddlewares(stack, options); err != nil {
120		return err
121	}
122	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
123		return err
124	}
125	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
126		return err
127	}
128	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
129		return err
130	}
131	if err = addClientUserAgent(stack); err != nil {
132		return err
133	}
134	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
135		return err
136	}
137	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
138		return err
139	}
140	if err = addOpExportJournalToS3ValidationMiddleware(stack); err != nil {
141		return err
142	}
143	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExportJournalToS3(options.Region), middleware.Before); err != nil {
144		return err
145	}
146	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
147		return err
148	}
149	if err = addResponseErrorMiddleware(stack); err != nil {
150		return err
151	}
152	if err = addRequestResponseLogging(stack, options); err != nil {
153		return err
154	}
155	return nil
156}
157
158func newServiceMetadataMiddleware_opExportJournalToS3(region string) *awsmiddleware.RegisterServiceMetadata {
159	return &awsmiddleware.RegisterServiceMetadata{
160		Region:        region,
161		ServiceID:     ServiceID,
162		SigningName:   "qldb",
163		OperationName: "ExportJournalToS3",
164	}
165}
166