Development
Sandboxing
Section titled “Sandboxing”Creating a Sandbox
Section titled “Creating a Sandbox”The following command create a sandbox in the given AWS profile (-e|—profile)
cd <topology-dir>tc create [--sandbox SANDBOX] [-e ENV]
Incremental updates
Section titled “Incremental updates”While developing, we often need to incrementally deploy certain components without recreating the entire topology. tc
provides an update command that updates given entity and components.
An entity is a core composable servereless resource. . A component is an attribute or instance of the entity.
We can update an entity and/or component as follows:
tc update -s sandbox -e env -c Entity/Component
Updating Entities
Section titled “Updating Entities”tc update -s sandbox -e env -c routestc update -s sandbox -e env -c eventstc update -s sandbox -e env -c functionstc update -s sandbox -e env -c mutationstc update -s sandbox -e env -c channelstc update -s sandbox -e env -c schedulestc update -s sandbox -e env -c queues
Updating specific component in an entity
Section titled “Updating specific component in an entity”Components in function
entity:
tc update -s sandbox -e env -c functions/layerstc update -s sandbox -e env -c functions/varstc update -s sandbox -e env -c functions/concurrencytc update -s sandbox -e env -c functions/runtimetc update -s sandbox -e env -c functions/tagstc update -s sandbox -e env -c functions/rolestc update -s sandnox -e env -c functions/function-name
Components in mutation
entity:
tc update -s sandbox -e env -c mutations/authorizertc update -s sandbox -e env -c mutations/typestc update -s sandbox -e env -c mutations/rolestc update -s sandbox -e env -c mutations/RESOLVER_NAME
Components in event
entity:
tc update -s sandbox -e env -c events/EVENT_NAMEtc update -s sandbox -e env -c events/roles
Components in route
entity:
tc update -s sandbox -e env -c routes/ROUTE_NAMEtc update -s sandbox -e env -c routes/ROUTE_NAME/authorizertc update -s sandbox -e env -c routes/roles
Deleting Sandbox
Section titled “Deleting Sandbox”To delete a sandbox:
tc delete -s sandbox -e env
To delete a specific entity/component. See update commands (above) for list of components
tc delete -s sandbox -e env -c ENTITY/COMPONENT
Invoking
Section titled “Invoking”Specifying Payload
Section titled “Specifying Payload”To simply invoke a functor
tc invoke --sandbox main --env dev
By default, tc picks up a payload.json
file in the current directory. You could optionally specify a payload file
tc invoke --sandbox main --env dev --payload payload.json
or via stdin
cat payload.json | tc invoke --sandbox main --env dev
or as a param
tc invoke --sandbox main --env dev --payload '{"data": "foo"}'
Invoking Events and Lambdas
Section titled “Invoking Events and Lambdas”By default, tc
invokes a stepfn. We can also invoke a lambda or trigger an Eventbridge event
tc invoke --kind lambda -e dev --payload '{"data"...}'tc invoke --kind event -e dev --payload '{"data"...}'
Emulator
Section titled “Emulator”Lambdas
Section titled “Lambdas”To emulate the Lambda Runtime environment. The following command spins up a docker container with the defined layers in function.json, sets up the paths, environment variables, AWS access, local code and runtime parameters (mem, handlers etc)
cd <function-dir>tc emulate
To run in foreground
tc emulate
You can now invoke a payload locally with this emulator
tc invoke --local [--payload <payload.json | json-str>]