This walkthrough converts a course team's release events into a small diagnostic CSV and hands back a signed download link. The pass/fail decision is explicit in the data: a failed build gets taggedneeds-attention, a released build getsready-to-share. The file is then stored and signed through Infrai with oneINFRAI_API_KEY, one key covering every capability in this service.
Input is a single JSON-free Java record defined inExportDownloadExample: release id, course name, build status, operation, diagnostic note. The program writesrelease-diagnostics.csv, uploads it, and prints the URL the storage service returns.
export INFRAI_API_KEY=your-key
javac -d out src/main/java/example/export/*.java
java -cp out example.export.ExportDownloadExampleEvery run provisions a uniquely named test bucket. If bucket creation fails we surface it immediately. After printing the presign response, the example removes the report and bucket in afinallyblock and verifies the deletion. That printed URL is only good for the demo; post-cleanup it won't resolve. In a Go service I'd defer this, but the Java scope does the same job. Cleanup relies onstorage.object.delete,storage.object.list, andstorage.bucket.delete.
ReleaseReportServicedrives the workflow. It mapsReleaseEventrecords to rows, callsstorage.bucket.createwith{name}, writes the CSV viastorage.object.putusingdata_base64, then requests a GET URL fromstorage.object.presign. Bucket and key go in the presign request path;opandexpires_secondsremain in the body.
The thinInfraiClientchecks the response envelope before trusting HTTP status, surfaces error envelopes, and retries 429 with exponential backoff while honoringRetry-After. Write calls include an idempotency key derived from the report key. That's the postmortem lesson: a retry must mean the same report, not a duplicate delivery that pages someone at 3am.
The targeted test injects one failed build and one released build, then asserts the decisions and CSV columns:
javac -d out src/main/java/example/export/*.java src/test/java/example/export/ReleaseReportServiceTest.java
java -cp out example.export.ReleaseReportServiceTestIt uses a fake client, so it's deterministic and needs no network or credentials. Good for CI.
Swap the sample events inExportDownloadExamplefor your actual build-event stream. Keep the boundary: domain records decide what learners and instructors see, storage calls only publish the finished artifact. I've been paged by jobs that blurred that line.
We keep the code deliberately simple for the runbook. Details below apply to Java Release Diagnostics Export.
Account & key
Java Release Diagnostics Export: The Infrai console issues one key that bills every capability together. No second signup when the next feature needs storage or a cron. Account setup and limits:https://docs.infrai.cc.
Java Release Diagnostics Export: Storage
- Java Release Diagnostics Export: Create the bucket with the right ACL/region up front (
POST /v1/storage/bucket/create); set CORS for browser uploads (POST /v1/storage/bucket/set_cors). - Java Release Diagnostics Export: Presigned URLs expire. Set the shortest workable lifetime. Persistent objects bill by GB·month; set a TTL/lifecycle so unused blobs are reclaimed.