Skip to content

COMS Object Storage

afwilcox edited this page Jun 21, 2024 · 9 revisions

This project uses the NRS Object Store and the Common Object Management Service (COMS) API in order to store files in S3 storage. For more information see:

NRS Object Store

See: https://github.com/bcgov/nr-compliance-enforcement/wiki/NRS-Objectstore

Environment Mapping

The following table indicates the mapping that is in place between this application, the object store and the COMS API

Application Environment Object Store Bucket Object Store Folder COMS Environment COMS Buckets
Dev and Localhost cedsde dev-barrett dev ba17e1f8-b2e9-47ef-b17c-fe3441003c85 (@barrfalk)
dev-alec dfa6101f-0c43-42d4-8592-c2da2be521be (@afwilcox)
dev-mike f45a5a7d-ad56-4965-bf5a-cdb4cd045c89 (@marqueone-ps)
dev-chris afe61496-2439-4f42-8dea-9f97a9cd104a (@cnesmithsalus)
dev-scarlett f940c6ce-ff9e-4cd3-a197-5fa928718a83 (@scarlett-truong)
dev-dmitri 8fe1d19f-c00e-41f1-8e9d-29db971a72bc (@dmitri-korin-bcps)
dev b105c416-21cd-44fa-8f5b-175d6ca56e93 (OpenShift PRs)
Test cedsts test test d8fbfec3-b3fd-4d53-aa19-11172857150a (OpenShift Test)
Prod TBD prod prod 422da9bc-3d1c-47e6-90ee-a6e7957ce210 (OpenShift Prod)

Onboarding A New Bucket

To set up a new bucket for use by the application the following requests to the COMS API are required

  • PUT /bucket -- Creates the bucket. The following parameters are required:

    • accessKeyId - The Access Key Id for the bucket you are going to create (e.g. nrs-ceds-del)
    • bucket - The name of the S3 bucket in the NRS Object Store (e.g. cedsde)
    • bucketName - The name you want COMS to use for your bucket (e.g. Compliance and Enforcement Local Development: )
    • endpoint - The URL to the NRS Object Store (e.g. https://nrs.objectstore.gov.bc.ca:443)
    • secretAccessKey - The secret access key to your bucket from the NRS Object Store
    • active - If the bucket should be active in COMS (e.g. True)
    • key - The folder to use withing your bucket (e.g. dev-)
  • PUT /permission/bucket/{bucketId} -- Adds permissions to bucket (optional). The following parameters are required.

    • userId - The COMS Unique User GUID
    • permcode - One of either CREATE, READ, UPDATE, DELETE or Manage

Once complete either the OpenShift secret or the .ENV file for local usage should be updated with the newly created bucketId

Note that the call to grant permission to the bucket requires an internal COMS UserId. This can be found by calling the COMS method GET /user and supplying valid search criteria. However a user will only be found if they have have interacted previously with the COMS API. One way to force an interaction is to have the user log in to the complaint management application in the target environment and access a complaint. This will attempt to retrieve the attachments for a complaint, fail, but will still record the users identity in the system.