Skip to content

Commit bd85db3

Browse files
committed
feat(client-s3-control): calculate md5 checksum to input payload
1 parent 22a4000 commit bd85db3

22 files changed

+4797
-108
lines changed

clients/client-s3-control/S3Control.ts

Lines changed: 503 additions & 0 deletions
Large diffs are not rendered by default.

clients/client-s3-control/S3ControlClient.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import {
55
} from "./commands/CreateAccessPointForObjectLambdaCommand";
66
import { CreateBucketCommandInput, CreateBucketCommandOutput } from "./commands/CreateBucketCommand";
77
import { CreateJobCommandInput, CreateJobCommandOutput } from "./commands/CreateJobCommand";
8+
import {
9+
CreateMultiRegionAccessPointCommandInput,
10+
CreateMultiRegionAccessPointCommandOutput,
11+
} from "./commands/CreateMultiRegionAccessPointCommand";
812
import { DeleteAccessPointCommandInput, DeleteAccessPointCommandOutput } from "./commands/DeleteAccessPointCommand";
913
import {
1014
DeleteAccessPointForObjectLambdaCommandInput,
@@ -29,6 +33,10 @@ import {
2933
DeleteBucketTaggingCommandOutput,
3034
} from "./commands/DeleteBucketTaggingCommand";
3135
import { DeleteJobTaggingCommandInput, DeleteJobTaggingCommandOutput } from "./commands/DeleteJobTaggingCommand";
36+
import {
37+
DeleteMultiRegionAccessPointCommandInput,
38+
DeleteMultiRegionAccessPointCommandOutput,
39+
} from "./commands/DeleteMultiRegionAccessPointCommand";
3240
import {
3341
DeletePublicAccessBlockCommandInput,
3442
DeletePublicAccessBlockCommandOutput,
@@ -42,6 +50,10 @@ import {
4250
DeleteStorageLensConfigurationTaggingCommandOutput,
4351
} from "./commands/DeleteStorageLensConfigurationTaggingCommand";
4452
import { DescribeJobCommandInput, DescribeJobCommandOutput } from "./commands/DescribeJobCommand";
53+
import {
54+
DescribeMultiRegionAccessPointOperationCommandInput,
55+
DescribeMultiRegionAccessPointOperationCommandOutput,
56+
} from "./commands/DescribeMultiRegionAccessPointOperationCommand";
4557
import { GetAccessPointCommandInput, GetAccessPointCommandOutput } from "./commands/GetAccessPointCommand";
4658
import {
4759
GetAccessPointConfigurationForObjectLambdaCommandInput,
@@ -75,6 +87,18 @@ import {
7587
import { GetBucketPolicyCommandInput, GetBucketPolicyCommandOutput } from "./commands/GetBucketPolicyCommand";
7688
import { GetBucketTaggingCommandInput, GetBucketTaggingCommandOutput } from "./commands/GetBucketTaggingCommand";
7789
import { GetJobTaggingCommandInput, GetJobTaggingCommandOutput } from "./commands/GetJobTaggingCommand";
90+
import {
91+
GetMultiRegionAccessPointCommandInput,
92+
GetMultiRegionAccessPointCommandOutput,
93+
} from "./commands/GetMultiRegionAccessPointCommand";
94+
import {
95+
GetMultiRegionAccessPointPolicyCommandInput,
96+
GetMultiRegionAccessPointPolicyCommandOutput,
97+
} from "./commands/GetMultiRegionAccessPointPolicyCommand";
98+
import {
99+
GetMultiRegionAccessPointPolicyStatusCommandInput,
100+
GetMultiRegionAccessPointPolicyStatusCommandOutput,
101+
} from "./commands/GetMultiRegionAccessPointPolicyStatusCommand";
78102
import {
79103
GetPublicAccessBlockCommandInput,
80104
GetPublicAccessBlockCommandOutput,
@@ -93,6 +117,10 @@ import {
93117
ListAccessPointsForObjectLambdaCommandOutput,
94118
} from "./commands/ListAccessPointsForObjectLambdaCommand";
95119
import { ListJobsCommandInput, ListJobsCommandOutput } from "./commands/ListJobsCommand";
120+
import {
121+
ListMultiRegionAccessPointsCommandInput,
122+
ListMultiRegionAccessPointsCommandOutput,
123+
} from "./commands/ListMultiRegionAccessPointsCommand";
96124
import {
97125
ListRegionalBucketsCommandInput,
98126
ListRegionalBucketsCommandOutput,
@@ -120,6 +148,10 @@ import {
120148
import { PutBucketPolicyCommandInput, PutBucketPolicyCommandOutput } from "./commands/PutBucketPolicyCommand";
121149
import { PutBucketTaggingCommandInput, PutBucketTaggingCommandOutput } from "./commands/PutBucketTaggingCommand";
122150
import { PutJobTaggingCommandInput, PutJobTaggingCommandOutput } from "./commands/PutJobTaggingCommand";
151+
import {
152+
PutMultiRegionAccessPointPolicyCommandInput,
153+
PutMultiRegionAccessPointPolicyCommandOutput,
154+
} from "./commands/PutMultiRegionAccessPointPolicyCommand";
123155
import {
124156
PutPublicAccessBlockCommandInput,
125157
PutPublicAccessBlockCommandOutput,
@@ -186,15 +218,18 @@ import {
186218
Logger as __Logger,
187219
Provider as __Provider,
188220
StreamCollector as __StreamCollector,
221+
StreamHasher as __StreamHasher,
189222
UrlParser as __UrlParser,
190223
UserAgent as __UserAgent,
191224
} from "@aws-sdk/types";
225+
import { Readable } from "stream";
192226

193227
export type ServiceInputTypes =
194228
| CreateAccessPointCommandInput
195229
| CreateAccessPointForObjectLambdaCommandInput
196230
| CreateBucketCommandInput
197231
| CreateJobCommandInput
232+
| CreateMultiRegionAccessPointCommandInput
198233
| DeleteAccessPointCommandInput
199234
| DeleteAccessPointForObjectLambdaCommandInput
200235
| DeleteAccessPointPolicyCommandInput
@@ -204,10 +239,12 @@ export type ServiceInputTypes =
204239
| DeleteBucketPolicyCommandInput
205240
| DeleteBucketTaggingCommandInput
206241
| DeleteJobTaggingCommandInput
242+
| DeleteMultiRegionAccessPointCommandInput
207243
| DeletePublicAccessBlockCommandInput
208244
| DeleteStorageLensConfigurationCommandInput
209245
| DeleteStorageLensConfigurationTaggingCommandInput
210246
| DescribeJobCommandInput
247+
| DescribeMultiRegionAccessPointOperationCommandInput
211248
| GetAccessPointCommandInput
212249
| GetAccessPointConfigurationForObjectLambdaCommandInput
213250
| GetAccessPointForObjectLambdaCommandInput
@@ -220,12 +257,16 @@ export type ServiceInputTypes =
220257
| GetBucketPolicyCommandInput
221258
| GetBucketTaggingCommandInput
222259
| GetJobTaggingCommandInput
260+
| GetMultiRegionAccessPointCommandInput
261+
| GetMultiRegionAccessPointPolicyCommandInput
262+
| GetMultiRegionAccessPointPolicyStatusCommandInput
223263
| GetPublicAccessBlockCommandInput
224264
| GetStorageLensConfigurationCommandInput
225265
| GetStorageLensConfigurationTaggingCommandInput
226266
| ListAccessPointsCommandInput
227267
| ListAccessPointsForObjectLambdaCommandInput
228268
| ListJobsCommandInput
269+
| ListMultiRegionAccessPointsCommandInput
229270
| ListRegionalBucketsCommandInput
230271
| ListStorageLensConfigurationsCommandInput
231272
| PutAccessPointConfigurationForObjectLambdaCommandInput
@@ -235,6 +276,7 @@ export type ServiceInputTypes =
235276
| PutBucketPolicyCommandInput
236277
| PutBucketTaggingCommandInput
237278
| PutJobTaggingCommandInput
279+
| PutMultiRegionAccessPointPolicyCommandInput
238280
| PutPublicAccessBlockCommandInput
239281
| PutStorageLensConfigurationCommandInput
240282
| PutStorageLensConfigurationTaggingCommandInput
@@ -246,6 +288,7 @@ export type ServiceOutputTypes =
246288
| CreateAccessPointForObjectLambdaCommandOutput
247289
| CreateBucketCommandOutput
248290
| CreateJobCommandOutput
291+
| CreateMultiRegionAccessPointCommandOutput
249292
| DeleteAccessPointCommandOutput
250293
| DeleteAccessPointForObjectLambdaCommandOutput
251294
| DeleteAccessPointPolicyCommandOutput
@@ -255,10 +298,12 @@ export type ServiceOutputTypes =
255298
| DeleteBucketPolicyCommandOutput
256299
| DeleteBucketTaggingCommandOutput
257300
| DeleteJobTaggingCommandOutput
301+
| DeleteMultiRegionAccessPointCommandOutput
258302
| DeletePublicAccessBlockCommandOutput
259303
| DeleteStorageLensConfigurationCommandOutput
260304
| DeleteStorageLensConfigurationTaggingCommandOutput
261305
| DescribeJobCommandOutput
306+
| DescribeMultiRegionAccessPointOperationCommandOutput
262307
| GetAccessPointCommandOutput
263308
| GetAccessPointConfigurationForObjectLambdaCommandOutput
264309
| GetAccessPointForObjectLambdaCommandOutput
@@ -271,12 +316,16 @@ export type ServiceOutputTypes =
271316
| GetBucketPolicyCommandOutput
272317
| GetBucketTaggingCommandOutput
273318
| GetJobTaggingCommandOutput
319+
| GetMultiRegionAccessPointCommandOutput
320+
| GetMultiRegionAccessPointPolicyCommandOutput
321+
| GetMultiRegionAccessPointPolicyStatusCommandOutput
274322
| GetPublicAccessBlockCommandOutput
275323
| GetStorageLensConfigurationCommandOutput
276324
| GetStorageLensConfigurationTaggingCommandOutput
277325
| ListAccessPointsCommandOutput
278326
| ListAccessPointsForObjectLambdaCommandOutput
279327
| ListJobsCommandOutput
328+
| ListMultiRegionAccessPointsCommandOutput
280329
| ListRegionalBucketsCommandOutput
281330
| ListStorageLensConfigurationsCommandOutput
282331
| PutAccessPointConfigurationForObjectLambdaCommandOutput
@@ -286,6 +335,7 @@ export type ServiceOutputTypes =
286335
| PutBucketPolicyCommandOutput
287336
| PutBucketTaggingCommandOutput
288337
| PutJobTaggingCommandOutput
338+
| PutMultiRegionAccessPointPolicyCommandOutput
289339
| PutPublicAccessBlockCommandOutput
290340
| PutStorageLensConfigurationCommandOutput
291341
| PutStorageLensConfigurationTaggingCommandOutput
@@ -398,6 +448,20 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__
398448
*/
399449
regionInfoProvider?: RegionInfoProvider;
400450

451+
/**
452+
* A constructor for a class implementing the @aws-sdk/types.Hash interface
453+
* that computes MD5 hashes.
454+
* @internal
455+
*/
456+
md5?: __HashConstructor;
457+
458+
/**
459+
* A function that, given a hash constructor and a stream, calculates the
460+
* hash of the streamed value.
461+
* @internal
462+
*/
463+
streamHasher?: __StreamHasher<Readable> | __StreamHasher<Blob>;
464+
401465
/**
402466
* The provider populating default tracking information to be sent with `user-agent`, `x-amz-user-agent` header
403467
* @internal

clients/client-s3-control/commands/CreateBucketCommand.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
deserializeAws_restXmlCreateBucketCommand,
55
serializeAws_restXmlCreateBucketCommand,
66
} from "../protocols/Aws_restXml";
7+
import { getApplyMd5BodyChecksumPlugin } from "@aws-sdk/middleware-apply-body-checksum";
78
import { getRedirectFromPostIdPlugin } from "@aws-sdk/middleware-sdk-s3-control";
89
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
910
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
@@ -110,6 +111,7 @@ export class CreateBucketCommand extends $Command<
110111
options?: __HttpHandlerOptions
111112
): Handler<CreateBucketCommandInput, CreateBucketCommandOutput> {
112113
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
114+
this.middlewareStack.use(getApplyMd5BodyChecksumPlugin(configuration));
113115
this.middlewareStack.use(getRedirectFromPostIdPlugin(configuration));
114116

115117
const stack = clientStack.concat(this.middlewareStack);
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
import { S3ControlClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../S3ControlClient";
2+
import { CreateMultiRegionAccessPointRequest, CreateMultiRegionAccessPointResult } from "../models/models_0";
3+
import {
4+
deserializeAws_restXmlCreateMultiRegionAccessPointCommand,
5+
serializeAws_restXmlCreateMultiRegionAccessPointCommand,
6+
} from "../protocols/Aws_restXml";
7+
import { getApplyMd5BodyChecksumPlugin } from "@aws-sdk/middleware-apply-body-checksum";
8+
import { getProcessArnablesPlugin } from "@aws-sdk/middleware-sdk-s3-control";
9+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
10+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
11+
import { Command as $Command } from "@aws-sdk/smithy-client";
12+
import {
13+
FinalizeHandlerArguments,
14+
Handler,
15+
HandlerExecutionContext,
16+
MiddlewareStack,
17+
HttpHandlerOptions as __HttpHandlerOptions,
18+
MetadataBearer as __MetadataBearer,
19+
SerdeContext as __SerdeContext,
20+
} from "@aws-sdk/types";
21+
22+
export interface CreateMultiRegionAccessPointCommandInput extends CreateMultiRegionAccessPointRequest {}
23+
export interface CreateMultiRegionAccessPointCommandOutput
24+
extends CreateMultiRegionAccessPointResult,
25+
__MetadataBearer {}
26+
27+
/**
28+
* <p>Creates a Multi-Region Access Point and associates it with the specified buckets. For more information about creating Multi-Region Access Points, see
29+
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html">Creating
30+
* Multi-Region Access Points</a> in the <i>Amazon S3 User Guide</i>.</p>
31+
* <p>This action will always be routed to the US West (Oregon) Region. For more
32+
* information about the restrictions around managing Multi-Region Access Points, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html">Managing
33+
* Multi-Region Access Points</a> in the
34+
* <i>Amazon S3 User Guide</i>.</p>
35+
* <p>This request is asynchronous, meaning that you might receive a response before the
36+
* command has completed. When this request provides a response, it provides a token that
37+
* you can use to monitor the status of the request with
38+
* <code>DescribeMultiRegionAccessPointOperation</code>.</p>
39+
* <p>The following actions are related to <code>CreateMultiRegionAccessPoint</code>:</p>
40+
* <ul>
41+
* <li>
42+
* <p>
43+
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteMultiRegionAccessPoint.html">DeleteMultiRegionAccessPoint</a>
44+
* </p>
45+
* </li>
46+
* <li>
47+
* <p>
48+
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeMultiRegionAccessPointOperation.html">DescribeMultiRegionAccessPointOperation</a>
49+
* </p>
50+
* </li>
51+
* <li>
52+
* <p>
53+
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetMultiRegionAccessPoint.html">GetMultiRegionAccessPoint</a>
54+
* </p>
55+
* </li>
56+
* <li>
57+
* <p>
58+
* <a href="https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListMultiRegionAccessPoints.html">ListMultiRegionAccessPoints</a>
59+
* </p>
60+
* </li>
61+
* </ul>
62+
* @example
63+
* Use a bare-bones client and the command you need to make an API call.
64+
* ```javascript
65+
* import { S3ControlClient, CreateMultiRegionAccessPointCommand } from "@aws-sdk/client-s3-control"; // ES Modules import
66+
* // const { S3ControlClient, CreateMultiRegionAccessPointCommand } = require("@aws-sdk/client-s3-control"); // CommonJS import
67+
* const client = new S3ControlClient(config);
68+
* const command = new CreateMultiRegionAccessPointCommand(input);
69+
* const response = await client.send(command);
70+
* ```
71+
*
72+
* @see {@link CreateMultiRegionAccessPointCommandInput} for command's `input` shape.
73+
* @see {@link CreateMultiRegionAccessPointCommandOutput} for command's `response` shape.
74+
* @see {@link S3ControlClientResolvedConfig | config} for command's `input` shape.
75+
*
76+
*/
77+
export class CreateMultiRegionAccessPointCommand extends $Command<
78+
CreateMultiRegionAccessPointCommandInput,
79+
CreateMultiRegionAccessPointCommandOutput,
80+
S3ControlClientResolvedConfig
81+
> {
82+
// Start section: command_properties
83+
// End section: command_properties
84+
85+
constructor(readonly input: CreateMultiRegionAccessPointCommandInput) {
86+
// Start section: command_constructor
87+
super();
88+
// End section: command_constructor
89+
}
90+
91+
/**
92+
* @internal
93+
*/
94+
resolveMiddleware(
95+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
96+
configuration: S3ControlClientResolvedConfig,
97+
options?: __HttpHandlerOptions
98+
): Handler<CreateMultiRegionAccessPointCommandInput, CreateMultiRegionAccessPointCommandOutput> {
99+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
100+
this.middlewareStack.use(getApplyMd5BodyChecksumPlugin(configuration));
101+
this.middlewareStack.use(getProcessArnablesPlugin(configuration));
102+
103+
const stack = clientStack.concat(this.middlewareStack);
104+
105+
const { logger } = configuration;
106+
const clientName = "S3ControlClient";
107+
const commandName = "CreateMultiRegionAccessPointCommand";
108+
const handlerExecutionContext: HandlerExecutionContext = {
109+
logger,
110+
clientName,
111+
commandName,
112+
inputFilterSensitiveLog: CreateMultiRegionAccessPointRequest.filterSensitiveLog,
113+
outputFilterSensitiveLog: CreateMultiRegionAccessPointResult.filterSensitiveLog,
114+
};
115+
const { requestHandler } = configuration;
116+
return stack.resolve(
117+
(request: FinalizeHandlerArguments<any>) =>
118+
requestHandler.handle(request.request as __HttpRequest, options || {}),
119+
handlerExecutionContext
120+
);
121+
}
122+
123+
private serialize(input: CreateMultiRegionAccessPointCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
124+
return serializeAws_restXmlCreateMultiRegionAccessPointCommand(input, context);
125+
}
126+
127+
private deserialize(
128+
output: __HttpResponse,
129+
context: __SerdeContext
130+
): Promise<CreateMultiRegionAccessPointCommandOutput> {
131+
return deserializeAws_restXmlCreateMultiRegionAccessPointCommand(output, context);
132+
}
133+
134+
// Start section: command_body_extra
135+
// End section: command_body_extra
136+
}

0 commit comments

Comments
 (0)