Skip to content

Mystodan/cloud_assignment_2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sending requests to the service deployed to NTNU services

It is apparent that you should connect to the NTNU vpn before trying to access any of the web deployed services

  • 10.212.140.185:8080/corona/v1/<- Assignment 2 Deployment
  • 34.89.216.56:8080/corona/v1/<- Assignment 3 Deployment
    Where the service is hosted. If that was not apparant then my apologies.

Assignment 3 - Interception :)

By Daniel Hao Huynh

Peer review feedback resolved and extras

  • Improved File Structure
  • DockerFile in main repo Added
  • Testing fully implemented to 50-90% coverage
  • Implemented comparing local alpha3 country names to cases api
  • Stubbing Endpoint deprecated.
  • Threading on invocation
  • Added comprehensive commenting

Deployment

This was deployed on google cloud platform, key was transferred using built in upload function. Documentation for Assignment 2 is still valid except stubbing endpoint, which is now deprecated.

Testing

run go test .\endpoints\... -cover from root in order to test all endpoints

Assignment 2

By Daniel Hao Huynh

Implementation

All Advanced tasks, and required tasks are implemented

Difference between local and server deployment

One small change made to the web deployed service is that the constants which contain the directories for the required json files have an extra .

This is because of how its being deployed, the application searches from the file differently and therefore requires it to be so.
However This is not such a big change that requires it to have its own repository for deployment

For recreational purposes heres an example: localhost("./global_types/alpha3.json") -> 10.212.140.185/ 34.89.216.56:8080("../global_types/alpha3.json")

~~ !!! Current state of Policy API~~

> [08.04.2022 - 06.26] Currently when writing this, the policy api might be online, HOWEVER the stringency data returns data unavailable for every date
Therefore it seems like my application returns Data unavailable for the policy api, However on the stub documentation i have documented what happens on current date
When the stub was recorded, which was on the [05.04.2022]

[03.05.2022 - 05.56] Currently when writing this, the policy api IS online and working properly compared to last time :)

Project Structure

  • All constants are contained within the constants folder
    • Contains appConstants, dependConstants, serverConstants
  • All Global data types are contained within the global_types folder
    • Alpha3 local library is also located here since its a library accessed globally
  • All endpoints are contained within the endpoints folder
    • The endpoints folder also contain common functions for all endpoints
    • Testing is also documented within an endpoint /corona/v1/stubbing/policy/
  • All Server functions and caching is contained within the server folder

Dependencies

Here are the dependencies for the project:

Deployment

Deployed on NTNU's OpenStack
serviceAccountKey for firebase was passed to the server using:
scp -i MyKey.pem ./serviceAccountKey.json ubuntu@10.212.140.185:\assignment-2 serviceAccountKey.json

Running the CODE~

Use go run .\server\server.go to run from localhost:8080

The default url would therefore be localhost:8080/corona/v1/

How to use...

0a.     Special Requirement:

- IT IS REQUIRED THAT YOU CREATE A FOLDER IN assignment-2 FOLDER AND PUT IN YOUR FIREBASE SERVICE KEY AS serviceAccountKey.json IN ORDER TO RUN IT LOCALLY

0b.     Use go run .\server\server.go to run from localhost:8080 or the already deployed 10.212.140.185:8080

  • GET requests using Postman

    • Use /corona/v1/ with
      • cases/{countryname, or alpha3 code},
      • policy/{countryname, or alpha3 code} {?scope=YYYY-MM-DD}
      • notifications/ in order to see all webhooks
      • notifications/{webhook_id} in order to see a specific webhook
  • POST requests using Postman

    • Use /corona/v1/ with notification/ with [raw:JSON] in body in order to create a webhook

      {
      "url": string,
      "country": string,
      "calls": int
      }
      
  • DELETE requests using Postman

    • Use /corona/v1/ with notification/{webhook_id} in order to delete that webhook

Testing...

Stubbing was used for testing purposes

All testing is documented in the endpoint corona/v1/stubbing VIA GET REQUESTS

Examples: (Usinglocalhost:8080 or the already deployed 10.212.140.185:8080)
          -> /corona/v1/stubbing/cases/nor
          -> /corona/v1/stubbing/cases/norway
          -> /corona/v1/stubbing/cases<br>
          -> /corona/v1/stubbing/policy/nor
          -> /corona/v1/stubbing/policy/norway
          -> /corona/v1/stubbing/policy/<br>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published