Skip to content

Latest commit

 

History

History
64 lines (42 loc) · 2.27 KB

DEVELOPMENT.md

File metadata and controls

64 lines (42 loc) · 2.27 KB

Developing AWSX components

Prerequisites

Essentials:

  • NodeJS
  • Go
  • Make

For building the SDKs:

  • Dotnet
  • Python

Project Structure

  • awsx: the provider, written in Typescript
  • awsx-classic: the original typescript-only version of AWSX
  • examples: multi-lang examples which are executed as acceptance tests
  • examples-classic: examples of aws-classic (no longer run as acceptance tests)
  • schemagen: Go program for generating the schema and SDKs
  • sdk: Generated SDKs in each language

Development Workflow

Common Targets

  • make lints, builds and runs unit tests
  • make dev tests and build the provider and builds only the nodejs SDK
  • make build tests and build the provider and all SDKS
  • make clean removes all build artifacts ready for a clean build
  • make install_sdks installs all SDKs
  • make test runs all acceptance tests
  • make test Test=TEST_NAME runs a single test

Implementing New Components

The schema (schema.json) is generated by schemagen. The entry point is schemagen/pkg/gen/schema.go. Amend the go code to generate the schema for the component with its inputs, outputs and any relevant types. Run make schema to test your changes.

From the schema.json we generate provider types (awsx/schema-types.ts) which describe the interfaces that the provider must implement. Running make provider will automatically re-generate this as needed.

To implement a new provider resource:

  1. Define a class for your resource in an appropriate folder which:

    • Inherits from the appropriate schema-types abstract class
    • Uses the schema-types 'Args' object for the constructor args
    • Sets all provider output members in the constructor
  2. Register the new component implementation in awsx/resources.ts.

The SDKs are also generated from the schema.json using the schemagen program. This can be done by calling make build.

Testing Workflow

Before testing, make sure you are authenticated with Pulumi and AWS in your terminal.

For running Typescript examples locally:

  1. make install_provider install_nodejs_sdk - prep provider and SDK for local use
  2. cd examples/YOUR_EXAMPLE
  3. yarn && yarn link @pulumi/awsx - install dependencies, but use local version of
  4. PATH=~/YOUR_DEV_FOLDER/pulumi-awsx/bin/:$PATH pulumi up