- Notifications
You must be signed in to change notification settings - Fork 5.8k
Changes ported from https://github.com/awsdocs/aws-doc-sdk-examples/p… #1252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
12 commits Select commit Hold shift + click to select a range
83c7411 Changes ported from https://github.com/awsdocs/aws-doc-sdk-examples/p…
brmur 17e5383 Adding Metadata.yaml
brmur 48e172f Adding Metadata.yaml
brmur 913811c Adding Metadata.yaml
brmur 7e839ab small text change throughout
brmur 72118e3 small text change throughout
brmur ad0f5d8 small text change throughout
brmur 5e46625 small text change throughout
brmur 6795b51 small text change throughout
brmur 779749a small text change throughout
brmur 3cfaae5 small text change throughout
brmur e11889c Merge branch 'master' into master
Doug-AWS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
52 changes: 52 additions & 0 deletions 52 javascript/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/cardslots.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| @charset "UTF-8"; | ||
| /* CSS Document */ | ||
| | ||
| #appframe { | ||
| background-image: url(resources/slotmachine.jpg); | ||
| background-repeat: no-repeat; | ||
| background-origin:content-box; | ||
| position:relative; | ||
| min-height: 1080px; | ||
| width: 1000px; | ||
| } | ||
| | ||
| #slot_L { | ||
| position: absolute; | ||
| left: 354px; | ||
| top: 272px; | ||
| min-height: 199px; | ||
| width: 80px; | ||
| } | ||
| | ||
| #slot_M { | ||
| position: absolute; | ||
| left: 482px; | ||
| top: 272px; | ||
| min-height: 199px; | ||
| width: 80px; | ||
| } | ||
| | ||
| #slot_R { | ||
| position: absolute; | ||
| left: 606px; | ||
| top: 272px; | ||
| min-height: 199px; | ||
| width: 80px; | ||
| } | ||
| | ||
| #slot_handle { | ||
| position: absolute; | ||
| left: 860px; | ||
| top: 10px; | ||
| min-height: 943px; | ||
| width: 114px; | ||
| } | ||
| | ||
| #winner_light { | ||
| position: absolute; | ||
| left: 318px; | ||
| top: 540px; | ||
| min-height: 48px; | ||
| width: 247px; | ||
| visibility:hidden; | ||
| } |
22 changes: 22 additions & 0 deletions 22 javascript/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/index.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <!doctype html> | ||
| <html> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Card Slots</title> | ||
| <link href="cardslots.css" rel="stylesheet" type="text/css"> | ||
| | ||
| </head> | ||
| | ||
| <body> | ||
| <div id="appframe"> | ||
| | ||
| <img id="slot_L" src="resources/hart_q.png" height="199" width="80" alt="slot wheel 1"/> | ||
| <img id="slot_M" src="resources/hart_q.png" height="199" width="80" alt="slot wheel 2"/> | ||
| <img id="slot_R" src="resources/hart_q.png" height="199" width="80" alt="slot wheel 3"/> | ||
| <img id="slot_handle" src="resources/lever-up.png" height="943" width="114"/> | ||
| <img id="winner_light" src="resources/winner.png" height="48" width="247" alt="winner indicator"/> | ||
| | ||
| </div> | ||
| <script type="text/javascript" src="main.js"></script> | ||
| </body> | ||
| </html> |
Binary file added BIN +23.1 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/club_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.4 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/club_j.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.6 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/club_k.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.2 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/club_q.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.3 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/diam_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.4 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/diam_j.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.9 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/diam_k.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.5 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/diam_q.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.1 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/hart_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.6 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/hart_j.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +24.1 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/hart_k.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.7 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/hart_q.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +62.6 KB ...t/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/lever-dn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +61.7 KB ...t/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/lever-up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +212 KB ...xample_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/slotmachine.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +81.2 KB ..._code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/slotpullanimation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +22.9 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/spad_a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.2 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/spad_j.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +23.2 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/spad_k.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +22.9 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/spad_q.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added BIN +1.95 KB ...ipt/example_code_v3/lambda/tutorial/slotassets/MyLambdaApp/resources/winner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 62 additions & 0 deletions 62 javascript/example_code_v3/lambda/tutorial/slotassets/ddb-table-create.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| | ||
| ABOUT THIS NODE.JS EXAMPLE: This example works with Version 3 (V3) of the AWS JavaScript SDK, | ||
| which is scheduled for release later in 2020. The prerelease version of the SDK is available | ||
| at https://github.com/aws/aws-sdk-js-v3. The 'SDK for JavaScript Developer Guide' for V3 is also | ||
| scheduled for release later in 2020, and the topic containing this example will be hosted at | ||
| https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/using-lambda-ddb-setup.html. | ||
| | ||
| Purpose: | ||
| ddb-table-create.js demonstrates how to create a Amazon DynamoDB database table.. | ||
brmur marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
| | ||
| Inputs: | ||
| - REGION (into command line below) | ||
| | ||
| | ||
| Running the code: | ||
| node ddb-table-create.js REGION | ||
| */ | ||
| // snippet-start:[lambda.JavaScript.v3.CreateTable] | ||
| // Load the DynamoDB client | ||
| const { DynamoDBClient, CreateTableCommand } = require('@aws-sdk/client-dynamodb'); | ||
| // Instantiate a DynamoDB client | ||
| const region = process.argv[2]; | ||
| const ddb = new DynamoDBClient({region: region}); | ||
| // Define the table schema | ||
| var tableParams = { | ||
| AttributeDefinitions: [ | ||
| { | ||
| AttributeName: 'slotPosition', | ||
| AttributeType: 'N' | ||
| } | ||
| ], | ||
| KeySchema: [ | ||
| { | ||
| AttributeName: 'slotPosition', | ||
| KeyType: 'HASH' | ||
| } | ||
| ], | ||
| ProvisionedThroughput: { | ||
| ReadCapacityUnits: 5, | ||
| WriteCapacityUnits: 5 | ||
| }, | ||
| //TODO: change back to TABLE_NAME | ||
| TableName: 'v3-lambda-tutorial-table', | ||
| StreamSpecification: { | ||
| StreamEnabled: false | ||
| } | ||
| }; | ||
| | ||
| async function run() { | ||
| try { | ||
| const data = await ddb.send(new CreateTableCommand(tableParams)); | ||
| console.log('Success', data); | ||
| } catch(err) { | ||
| console.log('Error', err); | ||
| } | ||
| } | ||
| | ||
| run(); | ||
| // snippet-end:[lambda.JavaScript.v3.CreateTable] | ||
| exports.run = run; //for unit tests only | ||
158 changes: 158 additions & 0 deletions 158 javascript/example_code_v3/lambda/tutorial/slotassets/ddb-table-populate.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| | ||
| ABOUT THIS NODE.JS EXAMPLE: This example works with Version 3 (V3) of the AWS JavaScript SDK, | ||
| which is scheduled for release later in 2020. The prerelease version of the SDK is available | ||
| at https://github.com/aws/aws-sdk-js-v3. The 'SDK for JavaScript Developer Guide' for V3 is also | ||
| scheduled for release later in 2020, and the topic containing this example will be hosted at | ||
| https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/using-lambda-ddb-setup.html. | ||
| | ||
| Purpose: | ||
| ddb-table-populate.js demonstrates how to populate an Amazon DynamoDB table. | ||
| | ||
| Inputs: | ||
| - REGION (into command line below) | ||
| - TABLE_NAME (into command line below) | ||
| | ||
| Running the code: | ||
| node ddb-table-populate.js REGION TABLE_NAME | ||
| */ | ||
| | ||
| // snippet-start:[lambda.JavaScript.v3.PopulateTable] | ||
| // Load the DynamoDB client | ||
| const { DynamoDBClient, PutItemCommand } = require('@aws-sdk/client-dynamodb'); | ||
| // Instantiate a DynamoDB client | ||
| const region = process.argv[2]; //REGION | ||
| const ddb = new DynamoDBClient(region); | ||
| | ||
| const myTable = process.argv[3]; //TABLE_NAME | ||
| | ||
| // Add the four spade results | ||
brmur marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
| async function run() { | ||
| let params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '0'}, 'imageFile' : {S: 'spad_a.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '1'}, 'imageFile' : {S: 'spad_k.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '2'}, 'imageFile' : {S: 'spad_q.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '3'}, 'imageFile' : {S: 'spad_j.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| // Add the four heart results | ||
brmur marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '4'}, 'imageFile' : {S: 'hart_a.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '5'}, 'imageFile' : {S: 'hart_k.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '6'}, 'imageFile' : {S: 'hart_q.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '7'}, 'imageFile' : {S: 'hart_j.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| // Add the four diamonds results | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '8'}, 'imageFile' : {S: 'diam_a.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '9'}, 'imageFile' : {S: 'diam_k.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '10'}, 'imageFile' : {S: 'diam_q.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '11'}, 'imageFile' : {S: 'diam_j.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
brmur marked this conversation as resolved. Show resolved Hide resolved | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '12'}, 'imageFile' : {S: 'club_a.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '13'}, 'imageFile' : {S: 'club_k.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '14'}, 'imageFile' : {S: 'club_q.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| | ||
| params = { | ||
| TableName: myTable, | ||
| Item: {'slotPosition' : {N: '15'}, 'imageFile' : {S: 'club_j.png'} | ||
| } | ||
| }; | ||
| await post(params); | ||
| } | ||
| | ||
| run(); | ||
| | ||
| async function post (params) { | ||
| try { | ||
| const data = await ddb.send(new PutItemCommand(params)); | ||
| console.log("Success", data); | ||
| } catch(err) { | ||
| console.log("Error", err); | ||
| } | ||
| } | ||
| | ||
| // snippet-end:[lambda.JavaScript.v3.PopulateTable] | ||
44 changes: 44 additions & 0 deletions 44 javascript/example_code_v3/lambda/tutorial/slotassets/lambda-function-setup.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| | ||
| ABOUT THIS NODE.JS EXAMPLE: This example works with Version 3 (V3) of the AWS JavaScript SDK, | ||
| which is scheduled for release later in 2020. The prerelease version of the SDK is available | ||
| at https://github.com/aws/aws-sdk-js-v3. The 'SDK for JavaScript Developer Guide' for V3 is also | ||
| scheduled for release later in 2020, and the topic containing this example will be hosted at | ||
| https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/using-lambda-function-prep.html. | ||
| Purpose: | ||
| lambda-function-setup.js demostrates how to create a lambda function. | ||
brmur marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
| | ||
| Inputs: | ||
| - REGION (into command line below) | ||
| - BUCKET_NAME (in code) | ||
| - ZIP_FILE_NAME (in code) | ||
| | ||
| Running the code: | ||
| node lambda-function-setup.js REGION ACCESS_KEY_ID | ||
| */ | ||
| | ||
| // snippet-start:[lambda.JavaScript.v3.LambdaFunctionSetUp] | ||
| // Load the Lambda client | ||
| const { LambdaClient, CreateFunctionCommand } = require('@aws-sdk/client-lambda'); | ||
| // Instantiate a Lambda client | ||
| const region = process.argv[2]; | ||
| const lambda = new LambdaClient(region); | ||
| | ||
| var params = { | ||
| Code: { /* required */ | ||
| S3Bucket: 'BUCKET_NAME', | ||
| S3Key: 'ZIP_FILE_NAME' | ||
| }, | ||
| FunctionName: 'slotpull', /* required */ | ||
| Handler: 'index.handler', /* required */ | ||
| Role: 'arn:aws:iam::650138640062:role/v3-lambda-tutorial-lambda-role', /* required */ | ||
| Runtime: 'nodejs12.x', /* required */ | ||
| Description: 'Slot machine game results generator', | ||
| }; | ||
| lambda.send(new CreateFunctionCommand(params)).then( | ||
| data => { console.log(data) }, // successful response | ||
| err => {console.log(err)} // an error occurred | ||
| ); | ||
| | ||
| // snippet-end:[lambda.JavaScript.v3.LambdaFunctionSetUp] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.