From 9fd5fda0ea3639db956dc5281966f119bb54aa8f Mon Sep 17 00:00:00 2001 From: Matthew Bystedt Date: Thu, 6 Oct 2022 13:15:54 -0700 Subject: [PATCH] feat: relabel actions in return value (#25) --- scripts/provision-fluentbit-demo.sh | 4 ++-- src/intention/intention.service.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/provision-fluentbit-demo.sh b/scripts/provision-fluentbit-demo.sh index 712328d2..251cdbaf 100755 --- a/scripts/provision-fluentbit-demo.sh +++ b/scripts/provision-fluentbit-demo.sh @@ -25,7 +25,7 @@ INTENTION_TOKEN=$(echo $RESPONSE | jq -r '.token') echo "===> Jenkins provision" # Get token for provisioning Jenkins vault token -JENKINS_INTENTION_TOKEN=$(echo $RESPONSE | jq -r '.intention.login.token') +JENKINS_INTENTION_TOKEN=$(echo $RESPONSE | jq -r '.actions.login.token') echo "JENKINS_INTENTION_TOKEN: $JENKINS_INTENTION_TOKEN" # Provision token for application to login as itself to Vault @@ -38,7 +38,7 @@ echo $JENKINS_VAULT_TOKEN | jq '.' echo "===> Fluent Bit provision" # Get token for provisioning a Fluentbit deployment -FLUENTBIT_INTENTION_TOKEN=$(echo $RESPONSE | jq -r '.intention.provision.token') +FLUENTBIT_INTENTION_TOKEN=$(echo $RESPONSE | jq -r '.actions.provision.token') echo "FLUENTBIT_INTENTION_TOKEN: $FLUENTBIT_INTENTION_TOKEN" # Get secret id for fluentbit provisioning diff --git a/src/intention/intention.service.ts b/src/intention/intention.service.ts index c75edcd9..966ecf61 100644 --- a/src/intention/intention.service.ts +++ b/src/intention/intention.service.ts @@ -28,7 +28,7 @@ export class IntentionService { ttl: number = INTENTION_DEFAULT_TTL_SECONDS, ) { const startDate = new Date(); - const intention = {}; + const actions = {}; if (ttl < INTENTION_MIN_TTL_SECONDS || ttl > INTENTION_MAX_TTL_SECONDS) { throw new BadRequestException(); } @@ -40,7 +40,7 @@ export class IntentionService { for (const action of intentionDto.actions) { action.transaction = intentionDto.transaction; action.trace = this.createTransaction(); - intention[action.id] = { + actions[action.id] = { token: action.trace.token, trace_id: action.trace.hash, outcome: 'success', @@ -49,7 +49,7 @@ export class IntentionService { this.auditService.recordIntentionOpen(req, intentionDto); await this.persistenceService.addIntention(intentionDto, ttl); return { - intention, + actions, token: intentionDto.transaction.token, transaction_id: intentionDto.transaction.hash, ttl,