There are two endpoints in this solution:
- PUT /product/ - This endpoint configures the bucket automatically from the CDK stack and uses the
context.requestId
for the object Keys - PUT /product/{bucket}/{key} - This endpoint allows the requestor to specify the bucket and object Key manually.
curl --location --request PUT 'https://{API_ID}.execute-api.eu-west-1.amazonaws.com/prod/product/' \
--header 'x-api-key: MyApiKeyThatIsAtLeast20Characters' \
--header 'Content-Type: application/xml' \
--data-raw '<Product>
<AssetCrossReference Type="Primary Image"/>
<AssetCrossReference Type="Image 02"/>
</Product>'
curl --location --request PUT 'https://{API_ID}.execute-api.eu-west-1.amazonaws.com/prod/product/{BUCKET}/{KEY}' \
--header 'Content-Type: application/xml' \
--header 'x-api-key: MyApiKeyThatIsAtLeast20Characters' \
--data-raw '<Product>
<AssetCrossReference Type="Primary Image"/>
<AssetCrossReference Type="Image 02"/>
</Product>'
Replace the bucket name also with the one you have created in the stack
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template