Congratulations on starting development! Next steps:
- Write the JSON schema describing your resource,
mug-lambda-pythonlayer.json
- Implement your resource handlers in
mug_lambda_pythonlayer/handlers.py
Don't modify
models.py
by hand, any modifications will be overwritten when thegenerate
orpackage
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 cloudformation_cli_python_lib.exceptions
, or setting the ProgressEvent's status
to OperationStatus.FAILED
and errorCode
to one of cloudformation_cli_python_lib.HandlerErrorCode
. There is a static helper function, ProgressEvent.failed
, for this common case.
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.