diff --git a/run-sdk.sh b/run-sdk.sh new file mode 100755 index 00000000..575d986b --- /dev/null +++ b/run-sdk.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# Shared SDK runner — sourced by each tutorial's *-sdk.sh script. +set -eo pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[1]}")" && pwd)" +LANG="${1:-}" +usage() { + echo "Usage: $(basename "${BASH_SOURCE[1]}") " + echo " python|py, javascript|js, java, go, ruby|rb, dotnet|cs, rust|rs, kotlin|kt, swift, php, cpp" + echo "" + echo "Available:" + for d in "$SCRIPT_DIR"/*/; do [ -d "$d" ] && basename "$d" | grep -qvE '^\.' && echo " $(basename "$d")"; done + exit 1 +} +[ -z "$LANG" ] && usage +case "$LANG" in + python|py) DIR="python" ;; javascript|js|node) DIR="javascript" ;; java) DIR="java" ;; + go|golang) DIR="go" ;; ruby|rb) DIR="ruby" ;; dotnet|csharp|cs) DIR="dotnet" ;; + rust|rs) DIR="rust" ;; kotlin|kt) DIR="kotlin" ;; swift) DIR="swift" ;; + php) DIR="php" ;; cpp|c++) DIR="cpp" ;; *) echo "Unknown: $LANG"; usage ;; +esac +LANG_DIR="$SCRIPT_DIR/$DIR" +[ ! -d "$LANG_DIR" ] && echo "No $DIR example for this tutorial." && usage +check_cmd() { command -v "$1" > /dev/null 2>&1 || { echo "Required: $1 not installed. Install: $2"; exit 1; }; } +case "$DIR" in + python) check_cmd python3 "https://python.org/downloads/"; cd "$LANG_DIR" + [ ! -d ".venv" ] && python3 -m venv .venv; source .venv/bin/activate; pip install -q -r requirements.txt + echo "$ python3 scenario_getting_started.py"; echo ""; python3 scenario_getting_started.py ;; + javascript) check_cmd node "https://nodejs.org/"; cd "$LANG_DIR" + [ ! -d "node_modules" ] && npm install --quiet + echo "$ node scenarios/getting-started.js"; echo ""; node scenarios/getting-started.js ;; + java) check_cmd mvn "https://maven.apache.org/install.html"; cd "$LANG_DIR" + echo "$ mvn -q compile exec:java"; mvn -q compile exec:java 2>&1 ;; + go) check_cmd go "https://go.dev/dl/"; cd "$LANG_DIR" + echo "$ go run scenarios/getting_started.go"; echo ""; go run scenarios/getting_started.go ;; + ruby) check_cmd ruby "https://ruby-lang.org/"; cd "$LANG_DIR" + [ ! -f "Gemfile.lock" ] && bundle install --quiet + echo "$ ruby scenario_getting_started.rb"; echo ""; ruby scenario_getting_started.rb ;; + dotnet) check_cmd dotnet "https://dotnet.microsoft.com/download"; cd "$LANG_DIR" + echo "$ dotnet run"; echo ""; dotnet run ;; + rust) check_cmd cargo "https://rustup.rs/"; cd "$LANG_DIR" + echo "$ cargo run --bin scenario"; echo ""; cargo run --bin scenario ;; + kotlin) check_cmd java "https://aws.amazon.com/corretto/"; cd "$LANG_DIR" + echo "$ ./gradlew run"; chmod +x gradlew 2>/dev/null; ./gradlew run --quiet ;; + swift) check_cmd swift "https://swift.org/download/"; cd "$LANG_DIR" + echo "$ swift run"; echo ""; swift run ;; + php) check_cmd php "https://php.net/downloads"; cd "$LANG_DIR" + [ ! -d "vendor" ] && composer install --quiet + echo "$ php GettingStartedScenario.php"; echo ""; php GettingStartedScenario.php ;; + cpp) check_cmd cmake "https://cmake.org/download/"; cd "$LANG_DIR" + mkdir -p build && cd build; echo "$ cmake .. && make && ./scenario" + cmake .. -DCMAKE_BUILD_TYPE=Release > /dev/null 2>&1; make -j > /dev/null 2>&1 && ./scenario ;; +esac diff --git a/tuts/001-lightsail-gs/javascript/libs/lightsail-wrapper.js b/tuts/001-lightsail-gs/javascript/libs/lightsail-wrapper.js new file mode 100644 index 00000000..4da34d67 --- /dev/null +++ b/tuts/001-lightsail-gs/javascript/libs/lightsail-wrapper.js @@ -0,0 +1,25 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { LightsailClient, CreateDiskCommand, CreateInstancesCommand, DeleteDiskCommand, DeleteInstanceCommand, GetInstanceCommand } from "@aws-sdk/client-lightsail"; + +export const createInstances = async (client, params) => { + const command = new CreateInstancesCommand(params); + return client.send(command); +}; +export const createDisk = async (client, params) => { + const command = new CreateDiskCommand(params); + return client.send(command); +}; +export const getInstance = async (client, params) => { + const command = new GetInstanceCommand(params); + return client.send(command); +}; +export const deleteInstance = async (client, params) => { + const command = new DeleteInstanceCommand(params); + return client.send(command); +}; +export const deleteDisk = async (client, params) => { + const command = new DeleteDiskCommand(params); + return client.send(command); +}; diff --git a/tuts/001-lightsail-gs/javascript/package.json b/tuts/001-lightsail-gs/javascript/package.json new file mode 100644 index 00000000..e24d6179 --- /dev/null +++ b/tuts/001-lightsail-gs/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-lightsail", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-lightsail": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/001-lightsail-gs/javascript/scenarios/getting-started.js b/tuts/001-lightsail-gs/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..888f681b --- /dev/null +++ b/tuts/001-lightsail-gs/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { LightsailClient } from "@aws-sdk/client-lightsail"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new LightsailClient({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running lightsail getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/001-lightsail-gs/javascript/tests/lightsail.test.js b/tuts/001-lightsail-gs/javascript/tests/lightsail.test.js new file mode 100644 index 00000000..1386bed2 --- /dev/null +++ b/tuts/001-lightsail-gs/javascript/tests/lightsail.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { LightsailClient } from "@aws-sdk/client-lightsail"; + +const mock = mockClient(LightsailClient); + +describe("lightsail wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/001-lightsail-gs/lightsail-gs-sdk.sh b/tuts/001-lightsail-gs/lightsail-gs-sdk.sh new file mode 100755 index 00000000..c188f0c2 --- /dev/null +++ b/tuts/001-lightsail-gs/lightsail-gs-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash lightsail-gs-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@" diff --git a/tuts/002-vpc-gs/javascript/libs/ec2-wrapper.js b/tuts/002-vpc-gs/javascript/libs/ec2-wrapper.js new file mode 100644 index 00000000..274caff2 --- /dev/null +++ b/tuts/002-vpc-gs/javascript/libs/ec2-wrapper.js @@ -0,0 +1,5 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { EC2Client } from "@aws-sdk/client-ec2"; +// TODO: Add wrapper functions matching CLI tutorial actions diff --git a/tuts/002-vpc-gs/javascript/package.json b/tuts/002-vpc-gs/javascript/package.json new file mode 100644 index 00000000..e7921813 --- /dev/null +++ b/tuts/002-vpc-gs/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-ec2", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-ec2": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/002-vpc-gs/javascript/scenarios/getting-started.js b/tuts/002-vpc-gs/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..8e21af32 --- /dev/null +++ b/tuts/002-vpc-gs/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { EC2Client } from "@aws-sdk/client-ec2"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new EC2Client({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running ec2 getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/002-vpc-gs/javascript/tests/ec2.test.js b/tuts/002-vpc-gs/javascript/tests/ec2.test.js new file mode 100644 index 00000000..2b378c50 --- /dev/null +++ b/tuts/002-vpc-gs/javascript/tests/ec2.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { EC2Client } from "@aws-sdk/client-ec2"; + +const mock = mockClient(EC2Client); + +describe("ec2 wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/002-vpc-gs/vpc-gs-sdk.sh b/tuts/002-vpc-gs/vpc-gs-sdk.sh new file mode 100755 index 00000000..f2622fd7 --- /dev/null +++ b/tuts/002-vpc-gs/vpc-gs-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash vpc-gs-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@" diff --git a/tuts/003-s3-gettingstarted/javascript/libs/s3-wrapper.js b/tuts/003-s3-gettingstarted/javascript/libs/s3-wrapper.js new file mode 100644 index 00000000..2457afb8 --- /dev/null +++ b/tuts/003-s3-gettingstarted/javascript/libs/s3-wrapper.js @@ -0,0 +1,33 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { S3Client, CopyObjectCommand, CreateBucketCommand, DeleteBucketCommand, DeleteObjectsCommand, GetObjectCommand, ListObjectsV2Command, PutObjectCommand } from "@aws-sdk/client-s3"; + +export const createBucket = async (client, params) => { + const command = new CreateBucketCommand(params); + return client.send(command); +}; +export const putObject = async (client, params) => { + const command = new PutObjectCommand(params); + return client.send(command); +}; +export const getObject = async (client, params) => { + const command = new GetObjectCommand(params); + return client.send(command); +}; +export const copyObject = async (client, params) => { + const command = new CopyObjectCommand(params); + return client.send(command); +}; +export const listObjects = async (client, params) => { + const command = new ListObjectsV2Command(params); + return client.send(command); +}; +export const deleteObjects = async (client, params) => { + const command = new DeleteObjectsCommand(params); + return client.send(command); +}; +export const deleteBucket = async (client, params) => { + const command = new DeleteBucketCommand(params); + return client.send(command); +}; diff --git a/tuts/003-s3-gettingstarted/javascript/package.json b/tuts/003-s3-gettingstarted/javascript/package.json new file mode 100644 index 00000000..7493c98c --- /dev/null +++ b/tuts/003-s3-gettingstarted/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-s3", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-s3": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/003-s3-gettingstarted/javascript/scenarios/getting-started.js b/tuts/003-s3-gettingstarted/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..3b8cda54 --- /dev/null +++ b/tuts/003-s3-gettingstarted/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { S3Client } from "@aws-sdk/client-s3"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new S3Client({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running s3 getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/003-s3-gettingstarted/javascript/tests/s3.test.js b/tuts/003-s3-gettingstarted/javascript/tests/s3.test.js new file mode 100644 index 00000000..52a05653 --- /dev/null +++ b/tuts/003-s3-gettingstarted/javascript/tests/s3.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { S3Client } from "@aws-sdk/client-s3"; + +const mock = mockClient(S3Client); + +describe("s3 wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/003-s3-gettingstarted/s3-gettingstarted-sdk.sh b/tuts/003-s3-gettingstarted/s3-gettingstarted-sdk.sh new file mode 100755 index 00000000..6ff04a84 --- /dev/null +++ b/tuts/003-s3-gettingstarted/s3-gettingstarted-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash s3-gettingstarted-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@" diff --git a/tuts/004-cloudmap-custom-attributes/cloudmap-custom-attributes-sdk.sh b/tuts/004-cloudmap-custom-attributes/cloudmap-custom-attributes-sdk.sh new file mode 100755 index 00000000..b8a18d91 --- /dev/null +++ b/tuts/004-cloudmap-custom-attributes/cloudmap-custom-attributes-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash cloudmap-custom-attributes-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@" diff --git a/tuts/004-cloudmap-custom-attributes/javascript/libs/servicediscovery-wrapper.js b/tuts/004-cloudmap-custom-attributes/javascript/libs/servicediscovery-wrapper.js new file mode 100644 index 00000000..14da113f --- /dev/null +++ b/tuts/004-cloudmap-custom-attributes/javascript/libs/servicediscovery-wrapper.js @@ -0,0 +1,5 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { ServiceDiscoveryClient } from "@aws-sdk/client-servicediscovery"; +// TODO: Add wrapper functions matching CLI tutorial actions diff --git a/tuts/004-cloudmap-custom-attributes/javascript/package.json b/tuts/004-cloudmap-custom-attributes/javascript/package.json new file mode 100644 index 00000000..a1c9902c --- /dev/null +++ b/tuts/004-cloudmap-custom-attributes/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-servicediscovery", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-servicediscovery": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/004-cloudmap-custom-attributes/javascript/scenarios/getting-started.js b/tuts/004-cloudmap-custom-attributes/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..6523c5d4 --- /dev/null +++ b/tuts/004-cloudmap-custom-attributes/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { ServiceDiscoveryClient } from "@aws-sdk/client-servicediscovery"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new ServiceDiscoveryClient({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running servicediscovery getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/004-cloudmap-custom-attributes/javascript/tests/servicediscovery.test.js b/tuts/004-cloudmap-custom-attributes/javascript/tests/servicediscovery.test.js new file mode 100644 index 00000000..4273bc13 --- /dev/null +++ b/tuts/004-cloudmap-custom-attributes/javascript/tests/servicediscovery.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { ServiceDiscoveryClient } from "@aws-sdk/client-servicediscovery"; + +const mock = mockClient(ServiceDiscoveryClient); + +describe("servicediscovery wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/005-cloudfront-gettingstarted/cloudfront-gettingstarted-sdk.sh b/tuts/005-cloudfront-gettingstarted/cloudfront-gettingstarted-sdk.sh new file mode 100755 index 00000000..13452476 --- /dev/null +++ b/tuts/005-cloudfront-gettingstarted/cloudfront-gettingstarted-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash cloudfront-gettingstarted-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@" diff --git a/tuts/005-cloudfront-gettingstarted/javascript/libs/cloudfront-wrapper.js b/tuts/005-cloudfront-gettingstarted/javascript/libs/cloudfront-wrapper.js new file mode 100644 index 00000000..43223f02 --- /dev/null +++ b/tuts/005-cloudfront-gettingstarted/javascript/libs/cloudfront-wrapper.js @@ -0,0 +1,5 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { CloudFrontClient } from "@aws-sdk/client-cloudfront"; +// TODO: Add wrapper functions matching CLI tutorial actions diff --git a/tuts/005-cloudfront-gettingstarted/javascript/package.json b/tuts/005-cloudfront-gettingstarted/javascript/package.json new file mode 100644 index 00000000..a4e5929c --- /dev/null +++ b/tuts/005-cloudfront-gettingstarted/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-cloudfront", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-cloudfront": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/005-cloudfront-gettingstarted/javascript/scenarios/getting-started.js b/tuts/005-cloudfront-gettingstarted/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..b5b8522d --- /dev/null +++ b/tuts/005-cloudfront-gettingstarted/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { CloudFrontClient } from "@aws-sdk/client-cloudfront"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new CloudFrontClient({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running cloudfront getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/005-cloudfront-gettingstarted/javascript/tests/cloudfront.test.js b/tuts/005-cloudfront-gettingstarted/javascript/tests/cloudfront.test.js new file mode 100644 index 00000000..5e83a8c7 --- /dev/null +++ b/tuts/005-cloudfront-gettingstarted/javascript/tests/cloudfront.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { CloudFrontClient } from "@aws-sdk/client-cloudfront"; + +const mock = mockClient(CloudFrontClient); + +describe("cloudfront wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/008-vpc-private-servers-gs/javascript/libs/ec2-wrapper.js b/tuts/008-vpc-private-servers-gs/javascript/libs/ec2-wrapper.js new file mode 100644 index 00000000..274caff2 --- /dev/null +++ b/tuts/008-vpc-private-servers-gs/javascript/libs/ec2-wrapper.js @@ -0,0 +1,5 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { EC2Client } from "@aws-sdk/client-ec2"; +// TODO: Add wrapper functions matching CLI tutorial actions diff --git a/tuts/008-vpc-private-servers-gs/javascript/package.json b/tuts/008-vpc-private-servers-gs/javascript/package.json new file mode 100644 index 00000000..e7921813 --- /dev/null +++ b/tuts/008-vpc-private-servers-gs/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-ec2", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-ec2": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/008-vpc-private-servers-gs/javascript/scenarios/getting-started.js b/tuts/008-vpc-private-servers-gs/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..8e21af32 --- /dev/null +++ b/tuts/008-vpc-private-servers-gs/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { EC2Client } from "@aws-sdk/client-ec2"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new EC2Client({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running ec2 getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/008-vpc-private-servers-gs/javascript/tests/ec2.test.js b/tuts/008-vpc-private-servers-gs/javascript/tests/ec2.test.js new file mode 100644 index 00000000..2b378c50 --- /dev/null +++ b/tuts/008-vpc-private-servers-gs/javascript/tests/ec2.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { EC2Client } from "@aws-sdk/client-ec2"; + +const mock = mockClient(EC2Client); + +describe("ec2 wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/008-vpc-private-servers-gs/vpc-private-servers-gs-sdk.sh b/tuts/008-vpc-private-servers-gs/vpc-private-servers-gs-sdk.sh new file mode 100755 index 00000000..ae5cb525 --- /dev/null +++ b/tuts/008-vpc-private-servers-gs/vpc-private-servers-gs-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash vpc-private-servers-gs-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@" diff --git a/tuts/009-vpc-ipam-gs/javascript/libs/ec2-wrapper.js b/tuts/009-vpc-ipam-gs/javascript/libs/ec2-wrapper.js new file mode 100644 index 00000000..274caff2 --- /dev/null +++ b/tuts/009-vpc-ipam-gs/javascript/libs/ec2-wrapper.js @@ -0,0 +1,5 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { EC2Client } from "@aws-sdk/client-ec2"; +// TODO: Add wrapper functions matching CLI tutorial actions diff --git a/tuts/009-vpc-ipam-gs/javascript/package.json b/tuts/009-vpc-ipam-gs/javascript/package.json new file mode 100644 index 00000000..e7921813 --- /dev/null +++ b/tuts/009-vpc-ipam-gs/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-ec2", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-ec2": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/009-vpc-ipam-gs/javascript/scenarios/getting-started.js b/tuts/009-vpc-ipam-gs/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..8e21af32 --- /dev/null +++ b/tuts/009-vpc-ipam-gs/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { EC2Client } from "@aws-sdk/client-ec2"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new EC2Client({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running ec2 getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/009-vpc-ipam-gs/javascript/tests/ec2.test.js b/tuts/009-vpc-ipam-gs/javascript/tests/ec2.test.js new file mode 100644 index 00000000..2b378c50 --- /dev/null +++ b/tuts/009-vpc-ipam-gs/javascript/tests/ec2.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { EC2Client } from "@aws-sdk/client-ec2"; + +const mock = mockClient(EC2Client); + +describe("ec2 wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/009-vpc-ipam-gs/vpc-ipam-gs-sdk.sh b/tuts/009-vpc-ipam-gs/vpc-ipam-gs-sdk.sh new file mode 100755 index 00000000..f6207efc --- /dev/null +++ b/tuts/009-vpc-ipam-gs/vpc-ipam-gs-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash vpc-ipam-gs-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@" diff --git a/tuts/010-cloudmap-service-discovery/cloudmap-service-discovery-sdk.sh b/tuts/010-cloudmap-service-discovery/cloudmap-service-discovery-sdk.sh new file mode 100755 index 00000000..ae4e8ef1 --- /dev/null +++ b/tuts/010-cloudmap-service-discovery/cloudmap-service-discovery-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash cloudmap-service-discovery-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@" diff --git a/tuts/010-cloudmap-service-discovery/javascript/libs/servicediscovery-wrapper.js b/tuts/010-cloudmap-service-discovery/javascript/libs/servicediscovery-wrapper.js new file mode 100644 index 00000000..9acbc442 --- /dev/null +++ b/tuts/010-cloudmap-service-discovery/javascript/libs/servicediscovery-wrapper.js @@ -0,0 +1,21 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { ServiceDiscoveryClient, CreatePublicDnsNamespaceCommand, CreateServiceCommand, DeleteNamespaceCommand, DeleteServiceCommand } from "@aws-sdk/client-servicediscovery"; + +export const createNamespace = async (client, params) => { + const command = new CreatePublicDnsNamespaceCommand(params); + return client.send(command); +}; +export const createService = async (client, params) => { + const command = new CreateServiceCommand(params); + return client.send(command); +}; +export const deleteService = async (client, params) => { + const command = new DeleteServiceCommand(params); + return client.send(command); +}; +export const deleteNamespace = async (client, params) => { + const command = new DeleteNamespaceCommand(params); + return client.send(command); +}; diff --git a/tuts/010-cloudmap-service-discovery/javascript/package.json b/tuts/010-cloudmap-service-discovery/javascript/package.json new file mode 100644 index 00000000..a1c9902c --- /dev/null +++ b/tuts/010-cloudmap-service-discovery/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-servicediscovery", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-servicediscovery": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/010-cloudmap-service-discovery/javascript/scenarios/getting-started.js b/tuts/010-cloudmap-service-discovery/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..6523c5d4 --- /dev/null +++ b/tuts/010-cloudmap-service-discovery/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { ServiceDiscoveryClient } from "@aws-sdk/client-servicediscovery"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new ServiceDiscoveryClient({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running servicediscovery getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/010-cloudmap-service-discovery/javascript/tests/servicediscovery.test.js b/tuts/010-cloudmap-service-discovery/javascript/tests/servicediscovery.test.js new file mode 100644 index 00000000..4273bc13 --- /dev/null +++ b/tuts/010-cloudmap-service-discovery/javascript/tests/servicediscovery.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { ServiceDiscoveryClient } from "@aws-sdk/client-servicediscovery"; + +const mock = mockClient(ServiceDiscoveryClient); + +describe("servicediscovery wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/011-getting-started-batch-fargate/batch-fargate-sdk.sh b/tuts/011-getting-started-batch-fargate/batch-fargate-sdk.sh new file mode 100755 index 00000000..684a8de8 --- /dev/null +++ b/tuts/011-getting-started-batch-fargate/batch-fargate-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash batch-fargate-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@" diff --git a/tuts/011-getting-started-batch-fargate/javascript/libs/batch-wrapper.js b/tuts/011-getting-started-batch-fargate/javascript/libs/batch-wrapper.js new file mode 100644 index 00000000..1ea670a1 --- /dev/null +++ b/tuts/011-getting-started-batch-fargate/javascript/libs/batch-wrapper.js @@ -0,0 +1,21 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { BatchClient, CreateComputeEnvironmentCommand, CreateJobQueueCommand, DeleteComputeEnvironmentCommand, DeleteJobQueueCommand } from "@aws-sdk/client-batch"; + +export const createComputeEnv = async (client, params) => { + const command = new CreateComputeEnvironmentCommand(params); + return client.send(command); +}; +export const createJobQueue = async (client, params) => { + const command = new CreateJobQueueCommand(params); + return client.send(command); +}; +export const deleteJobQueue = async (client, params) => { + const command = new DeleteJobQueueCommand(params); + return client.send(command); +}; +export const deleteComputeEnv = async (client, params) => { + const command = new DeleteComputeEnvironmentCommand(params); + return client.send(command); +}; diff --git a/tuts/011-getting-started-batch-fargate/javascript/package.json b/tuts/011-getting-started-batch-fargate/javascript/package.json new file mode 100644 index 00000000..b9845f8b --- /dev/null +++ b/tuts/011-getting-started-batch-fargate/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-batch", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-batch": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/011-getting-started-batch-fargate/javascript/scenarios/getting-started.js b/tuts/011-getting-started-batch-fargate/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..b7eb98f1 --- /dev/null +++ b/tuts/011-getting-started-batch-fargate/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { BatchClient } from "@aws-sdk/client-batch"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new BatchClient({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running batch getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/011-getting-started-batch-fargate/javascript/tests/batch.test.js b/tuts/011-getting-started-batch-fargate/javascript/tests/batch.test.js new file mode 100644 index 00000000..df55b485 --- /dev/null +++ b/tuts/011-getting-started-batch-fargate/javascript/tests/batch.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { BatchClient } from "@aws-sdk/client-batch"; + +const mock = mockClient(BatchClient); + +describe("batch wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/012-transitgateway-gettingstarted/javascript/libs/ec2-wrapper.js b/tuts/012-transitgateway-gettingstarted/javascript/libs/ec2-wrapper.js new file mode 100644 index 00000000..274caff2 --- /dev/null +++ b/tuts/012-transitgateway-gettingstarted/javascript/libs/ec2-wrapper.js @@ -0,0 +1,5 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { EC2Client } from "@aws-sdk/client-ec2"; +// TODO: Add wrapper functions matching CLI tutorial actions diff --git a/tuts/012-transitgateway-gettingstarted/javascript/package.json b/tuts/012-transitgateway-gettingstarted/javascript/package.json new file mode 100644 index 00000000..e7921813 --- /dev/null +++ b/tuts/012-transitgateway-gettingstarted/javascript/package.json @@ -0,0 +1,14 @@ +{ + "name": "tutorial-ec2", + "type": "module", + "scripts": { + "test": "vitest run" + }, + "dependencies": { + "@aws-sdk/client-ec2": "latest" + }, + "devDependencies": { + "vitest": "latest", + "aws-sdk-client-mock": "latest" + } +} \ No newline at end of file diff --git a/tuts/012-transitgateway-gettingstarted/javascript/scenarios/getting-started.js b/tuts/012-transitgateway-gettingstarted/javascript/scenarios/getting-started.js new file mode 100644 index 00000000..8e21af32 --- /dev/null +++ b/tuts/012-transitgateway-gettingstarted/javascript/scenarios/getting-started.js @@ -0,0 +1,15 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { EC2Client } from "@aws-sdk/client-ec2"; +import { randomUUID } from "crypto"; + +const main = async () => { + const client = new EC2Client({}); + const suffix = randomUUID().slice(0, 8); + console.log("Running ec2 getting started scenario..."); + // TODO: implement setup, interact, teardown + console.log("Scenario complete."); +}; + +main(); diff --git a/tuts/012-transitgateway-gettingstarted/javascript/tests/ec2.test.js b/tuts/012-transitgateway-gettingstarted/javascript/tests/ec2.test.js new file mode 100644 index 00000000..2b378c50 --- /dev/null +++ b/tuts/012-transitgateway-gettingstarted/javascript/tests/ec2.test.js @@ -0,0 +1,16 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { describe, it, expect, beforeEach } from "vitest"; +import { mockClient } from "aws-sdk-client-mock"; +import { EC2Client } from "@aws-sdk/client-ec2"; + +const mock = mockClient(EC2Client); + +describe("ec2 wrapper", () => { + beforeEach(() => mock.reset()); + + it("placeholder test", () => { + expect(true).toBe(true); + }); +}); diff --git a/tuts/012-transitgateway-gettingstarted/transitgateway-gettingstarted-sdk.sh b/tuts/012-transitgateway-gettingstarted/transitgateway-gettingstarted-sdk.sh new file mode 100755 index 00000000..6ac8b4f2 --- /dev/null +++ b/tuts/012-transitgateway-gettingstarted/transitgateway-gettingstarted-sdk.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# Run the SDK example for this tutorial. Usage: bash transitgateway-gettingstarted-sdk.sh +source "$(cd "$(dirname "$0")/../.." && pwd)/run-sdk.sh" "$@"