.PHONY: build deploy destroy invoke

STACK=${artifactId}
FUNCTION_NAME=${artifactId}
BUCKET=lambda-function-repository-${artifactId}

build:
	mvn clean package

deploy:
	aws cloudformation package --template-file template.yml --s3-bucket $(BUCKET) --output-template-file out.yml
	aws cloudformation deploy --template-file out.yml --stack-name $(STACK) --capabilities CAPABILITY_NAMED_IAM

destroy:
	aws cloudformation delete-stack --stack-name $(STACK)

invoke:
	aws lambda invoke --function-name $(FUNCTION_NAME) --log-type Tail out.json
