aws / aws-cdk-rfcs

RFCs for the AWS CDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS Resource Model

eladb opened this issue · comments

We are seeing an increasing value in being able to reflect on the resource model exposed by the AWS Construct Library. Two recent examples are decdk and the new API reference. In both cases, we utilize jsii-reflect to reflect on the AWS Construct Library as a whole and based on the conventions and patterns we have in the library (enforced by awslint) we are able to reason about the various resource constructs exposed by the library, their properties, attributes, metrics, alarms, grants.

It would be useful to extract these heuristics into a separate library that will offer a rich reflection API for the resource model (think jsii-reflect but with AWS semantics).

A few ideas/notes:

  • The model should be serializable and published to a well-known location such as our reference website (similar to the CloudFormation spec). This will allow people to build tools around it.
  • The library should offer rich API that will allow traversal of the model and through to the type system (e.g. it should be easy to get the jsii-reflect.ClassType object of a construct.
  • As much as possible, we should try to reuse the heuristics between awslint and this new library. It's a bit of a chicken and egg problem (awslint enforces the conventions that this library later depends on), but it might be possible to expose stuff from awslint so that this library can reuse.
  • There are already heuristics spread across decdk and API Reference that we can extract and move to this shared library.