You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Examples/S3_AWSSDK/README.md
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# API Gateway
1
+
# List Amazon S3 Buckets with the AWS SDK for Swift
2
2
3
3
This is a simple example of an AWS Lambda function that uses the [AWS SDK for Swift](https://github.com/awslabs/aws-sdk-swift) to read data from Amazon S3.
4
4
5
5
## Code
6
6
7
-
The Lambda function reads all bucket names from your AWS account and return them as a String.
7
+
The Lambda function reads all bucket names from your AWS account and returns them as a String.
8
8
9
9
The code creates a `LambdaRuntime` struct. In it's simplest form, the initializer takes a function as argument. The function is the handler that will be invoked when the API Gateway receives an HTTP request.
10
10
@@ -17,7 +17,7 @@ The function must return a `APIGatewayV2Response`.
17
17
`APIGatewayV2Request` and `APIGatewayV2Response` are defined in the [Swift AWS Lambda Events](https://github.com/swift-server/swift-aws-lambda-events) library.
18
18
19
19
The handler creates an S3 client and `ListBucketsInput` object. It passes the input object to the client and receives an output response.
20
-
It then extract the list of bucket names from the output to create a `\n`separated list of names, as a `String`
20
+
It then extracts the list of bucket names from the output and creates a `\n`-separated list of names, as a `String`
21
21
22
22
## Build & Package
23
23
@@ -77,9 +77,10 @@ This should print text similar to
77
77
```bash
78
78
my_bucket_1
79
79
my_bucket_2
80
+
...
80
81
```
81
82
82
-
## Undeploy
83
+
## Delete the infrastructure
83
84
84
85
When done testing, you can delete the infrastructure with this command.
Copy file name to clipboardExpand all lines: Examples/S3_Soto/README.md
+7-12Lines changed: 7 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,10 @@
1
-
sam deploy \
2
-
--resolve-s3 \
3
-
--template-file template.yaml \
4
-
--stack-name AWSSDKExample \
5
-
--capabilities CAPABILITY_IAM
6
-
7
-
# API Gateway
1
+
# List Amazon S3 Buckets with Soto
8
2
9
3
This is a simple example of an AWS Lambda function that uses the [Soto SDK for AWS](https://github.com/soto-project/soto) to read data from Amazon S3.
10
4
11
5
## Code
12
6
13
-
The Lambda function reads all bucket names from your AWS account and return them as a String.
7
+
The Lambda function reads all bucket names from your AWS account and returns them as a String.
14
8
15
9
The code creates a `LambdaRuntime` struct. In it's simplest form, the initializer takes a function as argument. The function is the handler that will be invoked when the API Gateway receives an HTTP request.
16
10
@@ -22,12 +16,12 @@ The function must return a `APIGatewayV2Response`.
22
16
23
17
`APIGatewayV2Request` and `APIGatewayV2Response` are defined in the [Swift AWS Lambda Events](https://github.com/swift-server/swift-aws-lambda-events) library.
24
18
25
-
The handler creates AWS and S3 clients. It then calls `listBuckets()` on the S3 client and receives an output response.
26
-
It then extract the list of bucket names from the output to create a `\n`separated list of names, as a `String`
19
+
The handler creates two clients : an AWS client that manages the communication with AWS API and and the S3 client that expose the S3 API. Then, the handler calls `listBuckets()` on the S3 client and receives an output response.
20
+
Finally, the handler extracts the list of bucket names from the output to create a `\n`-separated list of names, as a `String`.
27
21
28
22
## Build & Package
29
23
30
-
To build the package, type the following commands.
24
+
To build the package, type the following command.
31
25
32
26
```bash
33
27
swift build
@@ -83,9 +77,10 @@ This should print text similar to
83
77
```bash
84
78
my_bucket_1
85
79
my_bucket_2
80
+
...
86
81
```
87
82
88
-
## Undeploy
83
+
## Delete the infrastructure
89
84
90
85
When done testing, you can delete the infrastructure with this command.
0 commit comments