-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DAC-1889 Provide interface for analysts to use Quicksight user lambda (…
…#490) Add new get-quicksight-user-spreadsheet script which uses google APIs to get data from the users spreadsheet Add new quicksight-add-users-from-spreadsheet lambda which parses the user spreadsheet and invokes the quicksight-add-users lambda Add new add-quicksight-users workflow to allow running the new functionality from github
- Loading branch information
1 parent
f0fac6c
commit ea02288
Showing
16 changed files
with
1,442 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: ✳️ Add users to Quicksight | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dryRun: | ||
type: boolean | ||
required: true | ||
description: If true, this action only prints the users it thinks need adding | ||
default: false | ||
environment: | ||
type: string | ||
required: true | ||
description: AWS Environment | ||
options: [DEV, TEST, FEATURE, PRODUCTION] | ||
type: | ||
type: choice | ||
required: true | ||
description: Type of user (determines which spreadsheet sheet to read) | ||
options: [GDS, RP] | ||
|
||
jobs: | ||
get-spreadsheet-users-and-invoke-lambda: | ||
# These permissions are needed to interact with GitHub's OIDC Token endpoint (enabling the aws-actions/configure-aws-credentials action) | ||
permissions: | ||
id-token: write | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Node setup | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
cache: npm | ||
- name: Install node packages | ||
run: npm ci | ||
- name: Create users file | ||
run: node scripts/get-quicksight-user-spreadsheet.mjs ${{ inputs.type }} ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }} > spreadsheet.json | ||
- name: Assume AWS add users lambda invoke role | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: eu-west-2 | ||
role-to-assume: ${{ secrets[format('ADD_USERS_LAMBDA_INVOKE_ROLE_{0}', inputs.environment)] }} | ||
- name: Invoke lambda | ||
run: | | ||
PAYLOAD=$(echo "{\"dryRun\": ${{ inputs.dryRun }}, \"spreadsheet\": $(cat spreadsheet.json)}") | ||
ENCODED=$(echo "$PAYLOAD" | openssl base64) | ||
aws --region eu-west-2 lambda invoke --function-name quicksight-add-users-from-spreadsheet --payload "$ENCODED" out.json | ||
cat out.json |
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
Oops, something went wrong.