-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,731 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/sh | ||
set -eou pipefail | ||
|
||
cd shared || true | ||
|
||
for file in NA12878.bam NA12878_20k_b37.bam; do | ||
ENC_SHA=$(sha256sum "$file.c4gh" | cut -d' ' -f 1) | ||
ENC_MD5=$(md5sum "$file.c4gh" | cut -d' ' -f 1) | ||
|
||
## get correlation id from upload message | ||
CORRID=$( | ||
curl -s -X POST \ | ||
-H "content-type:application/json" \ | ||
-u guest:guest http://localhost:15672/api/queues/sda/inbox/get \ | ||
-d '{"count":1,"encoding":"auto","ackmode":"ack_requeue_false"}' | jq -r .[0].properties.correlation_id | ||
) | ||
|
||
## publish message to trigger ingestion | ||
properties=$( | ||
jq -c -n \ | ||
--argjson delivery_mode 2 \ | ||
--arg correlation_id "$CORRID" \ | ||
--arg content_encoding UTF-8 \ | ||
--arg content_type application/json \ | ||
'$ARGS.named' | ||
) | ||
|
||
encrypted_checksums=$( | ||
jq -c -n \ | ||
--arg sha256 "$ENC_SHA" \ | ||
--arg md5 "$ENC_MD5" \ | ||
'$ARGS.named|to_entries|map(with_entries(select(.key=="key").key="type"))' | ||
) | ||
|
||
ingest_payload=$( | ||
jq -r -c -n \ | ||
--arg type ingest \ | ||
--arg user [email protected] \ | ||
--arg filepath test_dummy.org/"$file.c4gh" \ | ||
--argjson encrypted_checksums "$encrypted_checksums" \ | ||
'$ARGS.named|@base64' | ||
) | ||
|
||
ingest_body=$( | ||
jq -c -n \ | ||
--arg vhost sda \ | ||
--arg name sda \ | ||
--argjson properties "$properties" \ | ||
--arg routing_key "ingest" \ | ||
--arg payload_encoding base64 \ | ||
--arg payload "$ingest_payload" \ | ||
'$ARGS.named' | ||
) | ||
|
||
curl -s -u guest:guest "http://localhost:15672/api/exchanges/sda/sda/publish" \ | ||
-H 'Content-Type: application/json;charset=UTF-8' \ | ||
-d "$ingest_body" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
go 1.20 | ||
|
||
use ( | ||
./cmd/s3inbox | ||
./internal/database | ||
) |
Oops, something went wrong.