Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JASPER-289: Lambda Function Integration #173

Merged
merged 35 commits into from
Feb 13, 2025
Merged

Conversation

ronaldo-macapobre
Copy link

Pull Request for JIRA Ticket: JASPER-289

Issue ticket number and link

https://jira.justice.gov.bc.ca/browse/JASPER-289

Description

Infrastructure

  • Simplify API Gateway to use proxy resource to handle all incoming requests
  • Fixed permission issue when rotate-key lambda rotates its key
  • Simplify lambda functions to use proxy lambda function instead
  • Added dars secret

API (backend)

  • Enable traffic redirection when JASPER is accessed locally vs the one hosted in AWS

AWS (lambda functions)

  • Removed unnecessary lambda functions and replaced with proxy handler which will handle all traffic
  • Added unit tests for all new and existing code
  • Added utils function to sanitize query string and headers
  • Updated packages to the latest

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

  • Deployed feature branch to DEV, TEST and PROD environments

Test Configuration:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Ronaldo Macapobre added 24 commits February 5, 2025 21:53
- Updates to API to redirect traffic to APIGW when conditions are met
…he correct app

- Wrap logic of determining method to call inside ApiService to make proxy lambda code simpler
- Include cert and key when calling axios request
- Added dars secret in openshift job
- Installed 'qs' package to handle the process easier
…ts routed to BC Gov API

- Enable VPC settings for lambda functions
- Added DARS secrets
- regex for replacing methodArn to wildcard
- hardcoded password
- Using * in network interface lambda policy
Comment on lines 175 to 182
- name: Parse Resource and Lambda Name
id: parse
run: |
echo "Lambda: ${{ matrix.lambda }}"
RESOURCE=$(echo "${{ matrix.lambda }}" | cut -d'/' -f1)
LAMBDA=$(echo "${{ matrix.lambda }}" | cut -d'/' -f2)
echo "RESOURCE=$RESOURCE" >> $GITHUB_ENV
echo "LAMBDA=$LAMBDA" >> $GITHUB_ENV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide an example of the input being parsed here? I might be able to recommend a better way to parse it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample inputs:

  • "auth/authorizer"
  • "auth/rotate-key"
  • "proxy/proxy-request"

Copy link
Member

@WadeBarnes WadeBarnes Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use variable substitution:

echo "RESOURCE=${${{ matrix.lambda }}%%/*}" >> $GITHUB_ENV
echo "LAMBDA=${${{ matrix.lambda }}##*/}" >> $GITHUB_ENV

Example for how it works in bash:

$ export matrix_lambda="auth/authorizer"

# Get everything before the first '/'
$ echo "RESOURCE=${matrix_lambda%%/*}"
RESOURCE=auth

# Get everything after the last '/'
$ echo "LAMBDA=${matrix_lambda##*/}"
LAMBDA=authorizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants