aws-cloudformation / cloudformation-cli-typescript-plugin

The CloudFormation Provider Development Toolkit Node.js Plugin allows you to autogenerate TypeScript code based on an input schema.
Apache License 2.0
45 stars 15 forks source link

More documentation with samples in typescript #102

Open JobaDiniz opened 1 year ago

JobaDiniz commented 1 year ago

There's this walkthrough but it's using java as the language, and it's not very easy to understand.

From the documentation perspective, I don't understand how to call dynamodb from the handlers for example. It looks like I need to use the SessionProxy, but it's not documented how to get a hold of dynamodb aws client. In the init example:

// Example:
        try {
            if (session instanceof SessionProxy) {
                const client = session.client('S3');
            }
  1. Where's the documentation of which string should I pass in the .client([string]) to get dynamodb, stepfunction (or others) clients?

  2. Even after I run npm install to install the dependencies, VSCode still does not find @amazon-web-services-cloudformation/cloudformation-cli-typescript-lib

image

  1. Also, do I need to implement all "create, update, list, read..." operations? I was looking for to implement only create, update and delete.
mmaeng commented 1 year ago

This will be out of order but for

Also, do I need to implement all "create, update, list, read..." operations? I was looking for to implement only create, update and delete.

The minimum needed would be "create", "read", and "delete". https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-develop.html#resource-type-develop-implement-handlers

Even after I run npm install to install the dependencies, VSCode still does not find @amazon-web-services-cloudformation/cloudformation-cli-typescript-lib

Not sure on the VSCode error but is your node modules directory included in your tsconfig.json configuration?

Where's the documentation of which string should I pass in the .client([string]) to get dynamodb, stepfunction (or others) clients?

I'm deeper into the python stack but services are extended from the SDKs. In python this would be the reference I would use. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html

Hopefully that helps?

jabalsad commented 1 year ago

I would like to also add a request for additional documentation. This plugin deserves its own document for how to write handlers with progress chaining and stabilization. The Java docs are not very useful here.