Skip to content

Commit 54e6473

Browse files
committed
move all example sunder one swift project
1 parent de38324 commit 54e6473

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+312
-733
lines changed
File renamed without changes.

Examples/APIGateway+LambdaAuthorizer/Package.swift

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

Examples/APIGateway+LambdaAuthorizer/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ This example uses an authorizer that returns the simple response. The authorizer
1818
To build the package, type the following commands.
1919

2020
```bash
21-
swift build
22-
swift package archive --allow-network-connections docker
21+
swift build --target APIGatewayLambda --target AuthorizerLambda
22+
swift package archive --products APIGatewayLambda --products AuthorizerLambda --allow-network-connections docker
2323
```
2424

2525
If there is no error, there are two ZIP files ready to deploy, one for the authorizer function and one for the business function.

Examples/APIGateway/.gitignore

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

Examples/APIGateway/Package.swift

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

Examples/APIGateway/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ The function must return a `APIGatewayV2Response`.
2121
To build the package, type the following commands.
2222

2323
```bash
24-
swift build
25-
swift package archive --allow-network-connections docker
24+
swift build --target APIGateway
25+
swift package archive --products APIGateway --allow-network-connections docker
2626
```
2727

2828
If there is no error, there is a ZIP file ready to deploy.
29-
The ZIP file is located at `.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/APIGatewayLambda/APIGatewayLambda.zip`
29+
The ZIP file is located at `.build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/APIGateway/APIGateway.zip`
3030

3131
## Deploy
3232

Examples/APIGateway/event.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"version": "2.0",
3+
"routeKey": "$default",
4+
"rawPath": "/my/path",
5+
"rawQueryString": "parameter1=value1&parameter1=value2&parameter2=value",
6+
"cookies": [
7+
"cookie1",
8+
"cookie2"
9+
],
10+
"headers": {
11+
"header1": "value1",
12+
"header2": "value1,value2"
13+
},
14+
"queryStringParameters": {
15+
"parameter1": "value1,value2",
16+
"parameter2": "value"
17+
},
18+
"requestContext": {
19+
"accountId": "123456789012",
20+
"apiId": "api-id",
21+
"authentication": {
22+
"clientCert": {
23+
"clientCertPem": "CERT_CONTENT",
24+
"subjectDN": "www.example.com",
25+
"issuerDN": "Example issuer",
26+
"serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1",
27+
"validity": {
28+
"notBefore": "May 28 12:30:02 2019 GMT",
29+
"notAfter": "Aug 5 09:36:04 2021 GMT"
30+
}
31+
}
32+
},
33+
"authorizer": {
34+
"jwt": {
35+
"claims": {
36+
"claim1": "value1",
37+
"claim2": "value2"
38+
},
39+
"scopes": [
40+
"scope1",
41+
"scope2"
42+
]
43+
}
44+
},
45+
"domainName": "id.execute-api.us-east-1.amazonaws.com",
46+
"domainPrefix": "id",
47+
"http": {
48+
"method": "POST",
49+
"path": "/my/path",
50+
"protocol": "HTTP/1.1",
51+
"sourceIp": "192.0.2.1",
52+
"userAgent": "agent"
53+
},
54+
"requestId": "id",
55+
"routeKey": "$default",
56+
"stage": "$default",
57+
"time": "12/Mar/2020:19:03:58 +0000",
58+
"timeEpoch": 1583348638390
59+
},
60+
"body": "Hello from Lambda",
61+
"pathParameters": {
62+
"parameter1": "value1"
63+
},
64+
"isBase64Encoded": false,
65+
"stageVariables": {
66+
"stageVariable1": "value1",
67+
"stageVariable2": "value2"
68+
}
69+
}

Examples/APIGateway/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Resources:
77
APIGatewayLambda:
88
Type: AWS::Serverless::Function
99
Properties:
10-
CodeUri: .build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/APIGatewayLambda/APIGatewayLambda.zip
10+
CodeUri: .build/plugins/AWSLambdaPackager/outputs/AWSLambdaPackager/APIGateway/APIGateway.zip
1111
Timeout: 60
1212
Handler: swift.bootstrap # ignored by the Swift runtime
1313
Runtime: provided.al2

Examples/BackgroundTasks/.gitignore

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

Examples/BackgroundTasks/Package.swift

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

0 commit comments

Comments
 (0)