An AuditLog triggered Java Cloud Functions template.
Compile:
mvn compile
Run the function:
mvn function:run
...
INFO: Serving function...
Feb 24, 2023 10:39:15 AM com.google.cloud.functions.invoker.runner.Invoker logServerInfo
INFO: Function: functions.Function
Feb 24, 2023 10:39:15 AM com.google.cloud.functions.invoker.runner.Invoker logServerInfo
INFO: URL: http://localhost:8081/
Inside the scripts folder, run test_local.sh to test the function locally:
./test_local.sh
< HTTP/1.1 200 OK
< Date: Wed, 22 Feb 2023 13:20:00 GMT
< Content-Length: 0
< Server: Jetty(9.4.45.v20220203)
You should see the following in service logs:
Feb 24, 2023 10:40:27 AM functions.Function accept
INFO: ProtoPayload: status {
}
authentication_info {
principal_email: "[email protected]"
}
...
Feb 24, 2023 10:40:27 AM functions.Function accept
INFO: ServiceName: bigquery.googleapis.com
Feb 24, 2023 10:40:27 AM functions.Function accept
INFO: MethodName: jobservice.jobcompleted
Feb 24, 2023 10:40:27 AM functions.Function accept
INFO: ResourceName: projects/test-project/jobs/sample-job
Run setup.sh to enable required services:
./setup.sh
Run deploy.sh to deploy to Google Cloud:
./deploy.sh
TODO
When you're done, you can cleanup created resources:
./cleanup.sh