diff --git a/versioned_docs/version-latest/01-start-here/03-hello.md b/versioned_docs/version-latest/01-start-here/03-hello.md index 22a66fca6..fe814fa26 100644 --- a/versioned_docs/version-latest/01-start-here/03-hello.md +++ b/versioned_docs/version-latest/01-start-here/03-hello.md @@ -24,15 +24,19 @@ entrypoint of your Wing application. bring cloud; let bucket = new cloud.Bucket(); +let counter = new cloud.Counter( + initial: 1 +); let queue = new cloud.Queue(); queue.setConsumer(inflight (message: str) => { - bucket.put("wing.txt", "Hello, ${message}"); - log("file created"); + let index = counter.inc(); + bucket.put("wing-${index}.txt", "Hello, ${message}"); + log("file wing-${index}.txt created"); }); ``` -This code should be mostly self explanatory. We define a queue, and every time a -message is added to the queue, a handler is triggered and creates a file named `wing.txt` with `"Hello, ${message}!"` content . +This code should be mostly self explanatory. We define a queue and a counter, and every time a +message is added to the queue, a handler is triggered and creates a file named `wing-.txt` with `"Hello, ${message}!"` content, and the counter is incremented by 1. Now that we've written this program, let's run and test it using the **Wing Console**. diff --git a/versioned_docs/version-latest/01-start-here/04-run-locally.md b/versioned_docs/version-latest/01-start-here/04-run-locally.md index 3ae5edc48..40764bdf4 100644 --- a/versioned_docs/version-latest/01-start-here/04-run-locally.md +++ b/versioned_docs/version-latest/01-start-here/04-run-locally.md @@ -41,7 +41,7 @@ On the interaction panel, Type a message in the `Push Message` text area (let's Now, click on the bucket in the map view. Notice that the interaction panel has changed and now shows the bucket's interaction view. -When you click on the `wing.txt` file, you should be able to see its contents. +When you click on the `wing-1.txt` file, you should be able to see its contents. ![Bucket resource view in Wing Console](./console-bucket-1.png 'Bucket resource') diff --git a/versioned_docs/version-latest/01-start-here/05-aws.md b/versioned_docs/version-latest/01-start-here/05-aws.md index c0bc11f6a..77a1358cc 100644 --- a/versioned_docs/version-latest/01-start-here/05-aws.md +++ b/versioned_docs/version-latest/01-start-here/05-aws.md @@ -90,6 +90,9 @@ plan. Resource actions are indicated with the following symbols: Terraform will perform the following actions: + # aws_dynamodb_table.cloudCounter will be created + + resource "aws_dynamodb_table" "cloudCounter" {...} + # aws_iam_role.cloudQueue-SetConsumer-cdafee6e_IamRole_2548D828 will be created + resource "aws_iam_role" "cloudQueue-SetConsumer-cdafee6e_IamRole_2548D828" {...} @@ -123,7 +126,7 @@ Terraform will perform the following actions: # aws_sqs_queue.cloudQueue will be created + resource "aws_sqs_queue" "cloudQueue" {...} -Plan: 11 to add, 0 to change, 0 to destroy. +Plan: 12 to add, 0 to change, 0 to destroy. ``` > This is a good opportunity to observe how much complexity the Wing compiler @@ -134,7 +137,7 @@ If you choose to proceed, Terraform will do its magic and will create all of the account. ``` -Apply complete! Resources: 11 added, 0 changed, 0 destroyed. +Apply complete! Resources: 12 added, 0 changed, 0 destroyed. ``` ## Explore your app on AWS @@ -149,15 +152,15 @@ through the AWS Management Console. 5. In the **Message Body** box type `cloud` and hit **Send message**. 6. Jump over to the [S3 Console](https://s3.console.aws.amazon.com/s3/buckets) 7. There should be some buckets prefixed with `cloud-bucket-`. -8. Cycle through the buckets until you find one that contains `wing.txt`. -9. Click `wing.txt` then click the `Open` button. +8. Cycle through the buckets until you find one that contains `wing-1.txt`. +9. Click `wing-1.txt` then click the `Open` button. 10. The file should contain `Hello, cloud`. ## Cleanup Terraform doesn't allow destroying a non-empty bucket by default. To prepare for easy cleanup, you may delete the newly created file by marking the checkbox next -to `wing.txt`, clicking the `Delete` button, typing `permanently delete` in the +to `wing-1.txt`, clicking the `Delete` button, typing `permanently delete` in the confirmation box and clicking the `Delete objects` button. Once you're done, you can destroy all of the resources that were created on your AWS account by running: diff --git a/versioned_docs/version-latest/01-start-here/console-app.png b/versioned_docs/version-latest/01-start-here/console-app.png index 8f51b0820..0068cbcc7 100644 Binary files a/versioned_docs/version-latest/01-start-here/console-app.png and b/versioned_docs/version-latest/01-start-here/console-app.png differ diff --git a/versioned_docs/version-latest/01-start-here/console-bucket-1.png b/versioned_docs/version-latest/01-start-here/console-bucket-1.png index df09111d8..09efb10ed 100644 Binary files a/versioned_docs/version-latest/01-start-here/console-bucket-1.png and b/versioned_docs/version-latest/01-start-here/console-bucket-1.png differ diff --git a/versioned_docs/version-latest/01-start-here/console-queue.png b/versioned_docs/version-latest/01-start-here/console-queue.png index 2aee42171..db1c14a58 100644 Binary files a/versioned_docs/version-latest/01-start-here/console-queue.png and b/versioned_docs/version-latest/01-start-here/console-queue.png differ