Skip to content

Commit 14d8979

Browse files
authored
Merge branch 'main' into V1130698383
2 parents f6d76ba + 2c0dd73 commit 14d8979

38 files changed

+173
-616
lines changed

.doc_gen/metadata/bedrock-runtime_metadata.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,14 @@ bedrock-runtime_InvokeModel_AmazonNovaImageGeneration:
13211321
- description: Create an image with the Amazon Nova Canvas.
13221322
snippet_tags:
13231323
- python.example_code.bedrock-runtime.InvokeModel_AmazonNovaImageGeneration
1324+
Swift:
1325+
versions:
1326+
- sdk_version: 1
1327+
github: swift/example_code/bedrock-runtime
1328+
excerpts:
1329+
- description: Create an image with Amazon Nova Canvas.
1330+
snippet_tags:
1331+
- swift.example_code.bedrock-runtime.InvokeModel_AmazonNovaImageGeneration
13241332
services:
13251333
bedrock-runtime: {InvokeModel}
13261334

.doc_gen/metadata/qldb_metadata.yaml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.doc_gen/metadata/workdocs_metadata.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/post-items-handler.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@ const postItemsHandler: Handler = {
1111
({ rdsDataClient }) =>
1212
async (req, res) => {
1313
const { description, guide, status, name }: Item = req.body;
14+
const values = {
15+
description: { StringValue: description },
16+
guide: { StringValue: guide },
17+
status: { StringValue: status },
18+
name: { StringValue: name },
19+
};
1420
const command = buildStatementCommand(
15-
`insert into items (iditem, description, guide, status, username, archived)\nvalues ("${uuidv4()}", "${description}", "${guide}", "${status}", "${name}", 0)`,
21+
`insert into items (iditem, description, guide, status, username, archived)
22+
values ("${uuidv4()}", ":description", ":guide", ":status", ":name", 0)`,
23+
values,
1624
);
17-
1825
await rdsDataClient.send(command);
1926
res.status(200).send({});
2027
},

javascriptv3/example_code/cross-services/aurora-serverless-app/src/handlers/put-items-archive-handler.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ const putItemsArchiveHandler: Handler = {
99
({ rdsDataClient }) =>
1010
async (req, res) => {
1111
const { itemId } = req.params;
12-
12+
const values = {
13+
itemId: { StringValue: itemId },
14+
};
1315
const command = buildStatementCommand(
14-
`update items\nset archived = 1\nwhere iditem = "${itemId}"`,
16+
`update items
17+
set archived = 1
18+
where iditem = ":itemId"`,
19+
values,
1520
);
1621

1722
await rdsDataClient.send(command);

javascriptv3/example_code/cross-services/aurora-serverless-app/src/statement-commands/command-helper.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33
import { ExecuteStatementCommand } from "@aws-sdk/client-rds-data";
4-
import env from "../../env.json" assert { type: "json" };
4+
import env from "../../env.json" with { type: "json" };
55

6-
const buildStatementCommand = (sql: string) => {
6+
const buildStatementCommand = (
7+
sql: string,
8+
parameters?: { [key: string]: { [key: string]: unknown } },
9+
) => {
710
return new ExecuteStatementCommand({
811
resourceArn: env.CLUSTER_ARN,
912
secretArn: env.SECRET_ARN,
1013
database: env.DB_NAME,
1114
sql,
15+
[parameters ? "parameters" : ""]: [parameters],
1216
});
1317
};
1418

javascriptv3/example_code/cross-services/aurora-serverless-app/tests/command-helper.unit.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,14 @@ describe("command-helper", () => {
1212
expect(command.input.sql).toBe(sql);
1313
});
1414
});
15+
it("should create an ExecuteStatementCommand with the provided SQL statement and parameters", () => {
16+
const sql = "select * from some_table where id = :id";
17+
const parameters = {
18+
id: { StringValue: "123" },
19+
};
20+
const command = buildStatementCommand(sql, parameters);
21+
expect(command.constructor.name).toBe("ExecuteStatementCommand");
22+
expect(command.input.sql).toBe(sql);
23+
expect(command.input.parameters).toEqual([parameters]);
24+
});
1525
});

javav2/example_code/s3/src/main/java/com/example/s3/GeneratePresignedGetUrlAndRetrieve.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static void main(String[] args) {
6060
String presignedUrlString = presign.createPresignedGetUrl(bucketName, keyName);
6161
presign.useHttpUrlConnectionToGet(presignedUrlString);
6262
presign.useHttpClientToGet(presignedUrlString);
63-
presign.useSdkHttpClientToPut(presignedUrlString);
63+
presign.useSdkHttpClientToGet(presignedUrlString);
6464
} finally {
6565
PresignUrlUtils.deleteObject(bucketName, keyName, s3Client);
6666
PresignUrlUtils.deleteBucket(bucketName, s3Client);
@@ -142,7 +142,7 @@ public byte[] useHttpClientToGet(String presignedUrlString) {
142142

143143
// snippet-start:[presigned.java2.generatepresignedgeturlandretrieve.sdkhttpclient]
144144
/* Use the AWS SDK for Java SdkHttpClient class to do the download. */
145-
public byte[] useSdkHttpClientToPut(String presignedUrlString) {
145+
public byte[] useSdkHttpClientToGet(String presignedUrlString) {
146146

147147
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); // Capture the response body to a byte array.
148148
try {

javav2/example_code/s3/src/test/java/com/example/s3/presignurl/GeneratePresignedGetUrlTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void testUsingJdkHttpClient() {
7070
GeneratePresignedGetUrlAndRetrieve presignInstanceUnderTest = new GeneratePresignedGetUrlAndRetrieve();
7171
final String presignedUrlString = presignInstanceUnderTest.createPresignedGetUrl(BUCKET_NAME, KEY_NAME);
7272

73-
final byte[] bytes = presignInstanceUnderTest.useSdkHttpClientToPut(presignedUrlString);
73+
final byte[] bytes = presignInstanceUnderTest.useSdkHttpClientToGet(presignedUrlString);
7474
Assertions.assertTrue(bytes.length > 0);
7575
}
7676
}

php/example_code/class_examples/CommandPool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
$s3Service = new S3Service($client, true);
3939

40-
$bucket = 'my-bucket-' . uniqid(); // This bucket will be deleted at the end of this example.
40+
$bucket = 'amzn-s3-demo-bucket-' . uniqid(); // This bucket will be deleted at the end of this example.
4141

4242
$client->createBucket([
4343
"Bucket" => $bucket,

0 commit comments

Comments
 (0)