Skip to content

Latest commit

 

History

History
 
 

README.md

{{ type_name }}

Congratulations on starting development! Next steps:

  1. Write the JSON schema describing your resource, {{ schema_path.name }}
  2. Implement your resource handlers in {{ project_path }}/handlers.py

Don't modify models.py by hand, any modifications will be overwritten when the generate or package commands are run.

Implement CloudFormation resource here. Each function must always return a ProgressEvent.

ProgressEvent(
    # Required
    # Must be one of OperationStatus.IN_PROGRESS, OperationStatus.FAILED, OperationStatus.SUCCESS
    status=OperationStatus.IN_PROGRESS,
    # Required on SUCCESS (except for LIST where resourceModels is required)
    # The current resource model after the operation; instance of ResourceModel class
    resourceModel=model,
    resourceModels=None,
    # Required on FAILED
    # Customer-facing message, displayed in e.g. CloudFormation stack events
    message="",
    # Required on FAILED: a HandlerErrorCode
    errorCode=HandlerErrorCode.InternalFailure,
    # Optional
    # Use to store any state between re-invocation via IN_PROGRESS
    callbackContext={},
    # Required on IN_PROGRESS
    # The number of seconds to delay before re-invocation
    callbackDelaySeconds=0,
)

Failures can be passed back to CloudFormation by either raising an exception from {{ support_lib_pkg }}.exceptions, or setting the ProgressEvent's status to OperationStatus.FAILED and errorCode to one of {{ support_lib_pkg }}.HandlerErrorCode. There is a static helper function, ProgressEvent.failed, for this common case.

What's with the type hints?

We hope they'll be useful for getting started quicker with an IDE that support type hints. Type hints are optional - if your code doesn't use them, it will still work.