Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
Hmis functionality feature (#613)
Browse files Browse the repository at this point in the history
* HMIS-1065 Added acceptance tests for unsupported destinations for some of the 28 API end points

* Hmis 1065 dev (#594)

* corrected space introduced by formatter

* removed space

Co-authored-by: Milan Jotic <[email protected]>

* HMIS-1065 Reworked test logic and structure and all tests updated previously after the code was re-written and the logic was changed on how to handle the checks of the unsupported destinations.

* Bearer change committed

* Bearer change committed (#596)

* HMIS-1065 Added acceptance tests to check for the unsupported destinations.for the remaining 20 API end points

* Vh elinks change committed

* Vh elinks change committed

* Vh elinks bearer space removed

* Vh elinks bearer space removed

* Hmis 1065 dev (#597)

* Bearer change committed

* Vh elinks change committed

* Vh elinks change committed

* Vh elinks bearer space removed

* Vh elinks bearer space removed

* removed space

Co-authored-by: mjotichmcts <[email protected]>

* HMIS-1065 Rework test to change response code back to 202 from 200

* spelling of authenticate (#599)

* Hmis 1065 dev (#600)

* spelling of authenticate

* updated operation id for vh

* APIM rev to 47

* Cache changes added vh by user

* Cache changes added vh by user

* Hmis 1065 dev (#608)

* Hmi rota perf feature (#605)

* initial version

* using specific params file

* renamed params file

* added file endpoint

* updated param names

* updated to latest version

* added la enricher

* fixed file name

* file name correction

* formatted

* added multiple connections

* using 5 connections

* connections 10

* added connectors

* testing with 5 connectors

* using 10 connectors

* 15 connectors

* using 10 connectors

* update file status if error

* added status check

* fixed '1'

* restored connector id

* added conn value

* removed extra conn

* adjusted runAfter

* stopping trigger

* added delta identification

* reduced to 2 runs

* added http for session enricher

* added 15 conn

* updated app logic with conn

* restored to 1 conn

* added single judge parsing

* processing 10

* trigger 5min

* removed conns

* parse judges object

* setting judges to empty if not found

* back to 1

* back to 1

* fixed

* using 10conn

* updated connector

* corrected attrib joh

* back to 10 runs

* removed storage params

* added to build

* wip

* removed space in name

* removed SA connector

* removed storageAccountName

* fixed param name

* added SA key

* removed wrong connection

* added SAname and SAkey

* corrected name

* using 1conn

* added calls to HMI

* added keyVault conn

* corrected conn name

* sending failures to SNow

* publishing params

* file-pub params

* enricher params

* not needed

* removed params not used

* removed scopeUrl

* added keyvaultName

* removed keyvault

* removed rota-dtu

* updated depends on

* removed unused params

* trimmed params

* removed ScopeUrl param

* removed unused params

* back to 15connn

* updated hmiSchedulesUrl

* params for HMI call added

* added enricher params

* added enricher url

* hmiDestination to MOCK

* added error file processing

* added SNow call

* added params for KV

* formatting

* renamed action

* back to 1conn

* added file copy

* back to 15conn

* added purge sessions LA

* corrected name

* using 15conn

* new env added

* fixed SA name

* 1 conn used

* purge files that are loading more than 24hrs

* corrected conn name

* using 15conn

* Hmis 1066 dev (#604)

* Policies updates for unsupported endpoint functionality

* Policies updates for unsupported endpoint functionality

* Policies updates for unsupported endpoint functionality

* Policies updates for unsupported endpoint functionality

* Policies updates for unsupported endpoint functionality

* Policies updates for unsupported endpoint functionality

* Policies updates for unsupported endpoint functionality

* Policies updates for unsupported endpoint functionality

* 27 Policies updates for unsupported endpoint functionality

* Policy updates for unsupported endpoint functionality

* Functionality fixes added.

* create LA's with az logic cmd, remove api conneciton from json files

* rename logic apps for testing

* linked group fixes added.

* linked group fixes added.

* linked group fixes added.

* multiple fixes added .

* Replaced code to fix .

* add az cli extension installion to script

* Replaced code to fix Unsupported destination message

* fix workflow json files

* revert json changes

* spelling mistake

* Unit tests modified

* Bugs fixed

* formatting change

* tokenized vh auth

* corrected policy

* updated elinks

* removed incorrect tag

* corrected tag

* updated linked hearing group

* updated linked hearing group

* updated linked hearing group unit test

* updated  unit test

* updated  unit tests

* updated  unit tests

* updated hearing unit tests

* Added hearing unit test change

* hearing unit test change

* Delete hearing unit test change added

* corrected space introduced by formatter

* removed space

* Revert "Hmis 1065 dev" (#593)

* get api connections, replace connections on json files

* revert

* fix subscription variables

* update replace file location and logic location

* syntax fix

* syntax fixing

* change target path in replacetokens task

* change replacetokens task

* add setOutput infront of sub id vars in workflow json

* reference task in variables to replace

* fix api connection ids and syntax errors

* add tags

* fix tags

* try change to tags

* try change to tags

* try change to tags

* import env long name var

* tags

* add tags

* correct publisher la json name

* create logic app template and loop through LA names

* add logic app parameters, rename logic app files

* rename logic app step

* move looping of logic apps to bash script in template task

* fix syntax

* fix bash syntax

* fix bash syntax maybe

* change logic app template to use pscore

* syntext pscore fix

* fix

* convert object param into json, then convert back from json

* experiment

* fix

* fix

* change la list to object

* attempt to fix

* attempt to fix

* path fix

* path fix

* syntax fix

* fix

* quote fix

* quote fix

* quote fix 2

* change la object

* formatting

* logicapps default value

* double to single quotes

* syntax

* syntax2

* single quotes for paths

* clean script

* correct syntax

* print test

* replace \ for \

* replace \ for \

* replace \ for \

* replace \ for \

* replace \ for \

* tags

* tags

* la name

* switch to az logic workflow update

* switch back to az logic workflow create

* Add tags directly

* remove arm templates

* changes added vh by user

Co-authored-by: Manoj Ravipati <[email protected]>
Co-authored-by: Ravipati89 <[email protected]>
Co-authored-by: Adam Todd <[email protected]>
Co-authored-by: Milan Jotic <[email protected]>
Co-authored-by: Christopher Pateman <[email protected]>
Co-authored-by: adamtodd0 <[email protected]>

Co-authored-by: Manoj Ravipati <[email protected]>
Co-authored-by: Ravipati89 <[email protected]>
Co-authored-by: Adam Todd <[email protected]>
Co-authored-by: Milan Jotic <[email protected]>
Co-authored-by: Christopher Pateman <[email protected]>
Co-authored-by: adamtodd0 <[email protected]>

* HMIS-1085 - correct testing name

* Removed resource endpoints

* Removed resource endpoints & unit tests

* HMIS-1081 Deleted acceptance and functional tests for resource user and location APIs which have been deleted from HMI API APIM

* HMIS-1081 Deleted input files associated with acceptance and functional tests for resource user and location APIs which have been deleted from HMI API APIM

* added non supported functionality

* Revision number updated

* Revision number updated for all env

* open_api_spec_content_value  changed from hmis-1081 to master on line7

Co-authored-by: Manoj Ravipati <[email protected]>
Co-authored-by: Ravipati89 <[email protected]>
Co-authored-by: Adam Todd <[email protected]>
Co-authored-by: Milan Jotic <[email protected]>
Co-authored-by: Christopher Pateman <[email protected]>
Co-authored-by: adamtodd0 <[email protected]>
Co-authored-by: chris-pateman <[email protected]>
Co-authored-by: ShufenZ <[email protected]>
Co-authored-by: Shufen Zhang <[email protected]>

* added unsupported functionality

* removed emulator for valid destinations

* removed emulator for valid destination

Co-authored-by: ShufenZ <[email protected]>
Co-authored-by: Milan Jotic <[email protected]>
Co-authored-by: Manoj Ravipati <[email protected]>
Co-authored-by: Ravipati89 <[email protected]>
Co-authored-by: chris-pateman <[email protected]>
Co-authored-by: Shufen Zhang <[email protected]>
Co-authored-by: Adam Todd <[email protected]>
Co-authored-by: Christopher Pateman <[email protected]>
Co-authored-by: adamtodd0 <[email protected]>
  • Loading branch information
10 people authored Aug 5, 2022
1 parent 742ea66 commit 219d88f
Show file tree
Hide file tree
Showing 53 changed files with 1,177 additions and 893 deletions.
126 changes: 70 additions & 56 deletions infrastructure/template/api-op-add-participant-policy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,61 @@
<base />
<choose>
<when condition="@(context.Request.Headers.GetValueOrDefault("Destination-System","") == "VH")">
<choose>
<when condition="@(context.Variables.GetValueOrDefault("vhAuthToken","") == "")">
<send-request ignore-error="false" timeout="20" response-variable-name="vhClientResponse" mode="new">
<set-url>https://#{keyVaultHost}#/secrets/vh-client-app-client/?api-version=7.0</set-url>
<set-method>GET</set-method>
<authentication-managed-identity resource="https://vault.azure.net" />
</send-request>
<set-variable name="vhClient" value="@{
<choose>
<when condition="@(context.Variables.GetValueOrDefault("vhAuthToken","") == "")">
<send-request ignore-error="false" timeout="20" response-variable-name="vhClientResponse" mode="new">
<set-url>https://#{keyVaultHost}#/secrets/vh-client-app-client/?api-version=7.0</set-url>
<set-method>GET</set-method>
<authentication-managed-identity resource="https://vault.azure.net" />
</send-request>
<set-variable name="vhClient" value="@{
var secret = ((IResponse)context.Variables["vhClientResponse"]).Body.As<JObject>();
return secret["value"].ToString();
}" />
<send-request ignore-error="false" timeout="20" response-variable-name="vhSecretResponse" mode="new">
<set-url>https://#{keyVaultHost}#/secrets/vh-client-app-secret/?api-version=7.0</set-url>
<set-method>GET</set-method>
<authentication-managed-identity resource="https://vault.azure.net" />
</send-request>
<set-variable name="vhSecret" value="@{
}" />
<send-request ignore-error="false" timeout="20" response-variable-name="vhSecretResponse" mode="new">
<set-url>https://#{keyVaultHost}#/secrets/vh-client-app-secret/?api-version=7.0</set-url>
<set-method>GET</set-method>
<authentication-managed-identity resource="https://vault.azure.net" />
</send-request>
<set-variable name="vhSecret" value="@{
var secret = ((IResponse)context.Variables["vhSecretResponse"]).Body.As<JObject>();
return secret["value"].ToString();
}" />
<send-request ignore-error="true" timeout="20" response-variable-name="vhBearerToken" mode="new">
<set-url>https://login.microsoftonline.com/fb6e0e22-0da3-4c35-972a-9d61eb256508/oauth2/token</set-url>
<set-method>POST</set-method>
<set-header name="Content-Type" exists-action="override">
<value>application/x-www-form-urlencoded</value>
</set-header>
<set-body>@{
return "client_id=" + (string)context.Variables["vhClient"] + "&client_secret=" + (string)context.Variables["vhSecret"] + "&grant_type=client_credentials&resource=https://vh-bookings-api-test1.azurewebsites.net";}</set-body>
</send-request>
<cache-store-value key="vhAuth" value="@("Bearer " + (String)((IResponse)context.Variables["vhBearerToken"]).Body.As<JObject>()["access_token"])" duration="2700" />
<cache-lookup-value key="vhAuth" variable-name="vhAuthToken" default-value=""/>
</when>
</choose>
<set-header name="Authorization" exists-action="override">
<value>@((String)context.Variables["vhAuthToken"])</value>
</set-header>
<rewrite-uri template="/{hearingId}/participants" copy-unmatched-params="true" />
<set-backend-service base-url="https://vh-bookings-api-test1.azurewebsites.net/hearings" />
}" />
<send-request ignore-error="true" timeout="20" response-variable-name="vhBearerToken" mode="new">
<set-url>#{vhOauthUrl}#</set-url>
<set-method>POST</set-method>
<set-header name="Content-Type" exists-action="override">
<value>application/x-www-form-urlencoded</value>
</set-header>
<set-body>@{
return "client_id=" + (string)context.Variables["vhClient"] + "&client_secret=" + (string)context.Variables["vhSecret"] + "&grant_type=client_credentials&resource=#{vhHost}#";}</set-body>
</send-request>
<cache-store-value key="vhAuth" value="@("Bearer " + (String)((IResponse)context.Variables["vhBearerToken"]).Body.As<JObject>()["access_token"])" duration="2700" />
<cache-lookup-value key="vhAuth" variable-name="vhAuthToken" default-value="" />
</when>
</choose>
<set-header name="Authorization" exists-action="override">
<value>@((String)context.Variables["vhAuthToken"])</value>
</set-header>
<rewrite-uri template="/{hearingId}/participants" copy-unmatched-params="true" />
<set-backend-service base-url="#{vhHost}#/hearings" />
</when>
<when condition="@(context.Request.Headers.GetValueOrDefault("Destination-System","") == "MOCK")">
<set-backend-service base-url="https://vh-bookings-api-test1.azurewebsites.net/hearings" />
<mock-response status-code="201" content-type="application/json" />
</when>
<when condition="@(context.Request.Headers.GetValueOrDefault("Destination-System","") == "EMULATOR")">
<rewrite-uri template="/" copy-unmatched-params="true" />
<set-backend-service base-url="http://#{emulatorHost}#/hearings/create-video-hearing/" />
</when>
<otherwise>
<return-response>
<set-status code="400" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("message", context.Request.Headers.GetValueOrDefault("Destination-System","") + " destination doesn't support this functionality")
).ToString();
}</set-body>
</return-response>
</otherwise>
</choose>
</inbound>
<backend>
Expand All @@ -67,7 +75,7 @@
</set-header>
<set-body>@{
return new JObject(
new JProperty("message", "Successfully authenticated by HMI, however target system failed to autheticate. Please try again.")
new JProperty("message", "Successfully authenticated by HMI, however target system failed to authenticate. Please try again.")
).ToString();
}
</set-body>
Expand All @@ -90,17 +98,20 @@
</when>
<when condition="@(context.Response.StatusCode == 500)">
<send-request ignore-error="true" timeout="20" response-variable-name="snowAuth" mode="new">
<set-url>https://#{keyVaultHost}#/secrets/hmi-servicenow-auth?api-version=7.0</set-url>
<set-method>GET</set-method>
<authentication-managed-identity resource="https://vault.azure.net" />
</send-request>
<send-request ignore-error="false" timeout="20" response-variable-name="serviceNow" mode="new">
<set-url>https://#{snowHost}#/api/now/table/incident?sysparm_fields=number</set-url>
<set-method>POST</set-method>
<set-header name="Authorization" exists-action="override">
<value>@("Basic " + ((IResponse)context.Variables["snowAuth"]).Body.As<JObject>()["value"].ToString())</value>
</set-header>
<set-body>@{
<set-url>https://#{keyVaultHost}#/secrets/hmi-servicenow-auth?api-version=7.0</set-url>
<set-method>GET</set-method>
<authentication-managed-identity resource="https://vault.azure.net" />
</send-request>
<send-request ignore-error="false" timeout="20" response-variable-name="serviceNow" mode="new">
<set-url>https://#{snowHost}#/api/now/table/incident?sysparm_fields=number</set-url>
<set-method>POST</set-method>
<set-header name="Authorization" exists-action="override">
<value>
@("Basic " + ((IResponse)context.Variables["snowAuth"]).Body.As
<JObject>()["value"].ToString())
</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("assignment_group", "56b756774fbd368057db0b318110c7bd"),
new JProperty("caller_id", "1475a0491b743414f0dc85e4464bcb7a"),
Expand All @@ -115,17 +126,20 @@
new JProperty("urgency", "3")
).ToString();
}</set-body>
</send-request>
<return-response>
</send-request>
<return-response>
<set-status code="502" />
<set-header name="Content-Type">
<value>application/json</value>
</set-header>
<set-body>@{
<set-body>
@{
return new JObject(
new JProperty("message", "Problem occurred with Backend Service. Please try again. [SNOW:" + ((IResponse)context.Variables["serviceNow"]).Body.As<JObject>()["result"]["number"].ToString() + "][HMI:" + context.Request.Headers.GetValueOrDefault("transactionIdHMCTS","") + "]")
new JProperty("message", "Problem occurred with Backend Service. Please try again. [SNOW:" + ((IResponse)context.Variables["serviceNow"]).Body.As
<JObject>()["result"]["number"].ToString() + "][HMI:" + context.Request.Headers.GetValueOrDefault("transactionIdHMCTS","") + "]")
).ToString();
}</set-body>
}
</set-body>
</return-response>
</when>
</choose>
Expand Down
25 changes: 13 additions & 12 deletions infrastructure/template/api-op-create-hearing-sched-policy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<inbound>
<base />
<choose>
<when condition="@(context.Request.Headers.GetValueOrDefault("Destination-System","") == "EMULATOR")">
<rewrite-uri template="/retrieve-schedule" copy-unmatched-params="true" />
<set-backend-service base-url="http://#{emulatorHost}#/schedules/" />
</when>
<when condition="@(context.Request.Headers.GetValueOrDefault("Destination-System","") == "SNL")">
<choose>
<when condition="@(context.Variables.GetValueOrDefault("snlAuthToken","") == "")">
Expand Down Expand Up @@ -57,17 +53,22 @@
<set-header name="Ocp-Apim-Subscription-Key" exists-action="delete" />
<set-backend-service base-url="https://#{sAndLHost}#/rest/hmcts/resources/assignJohs" />
</when>
<when condition="@(context.Request.Headers.GetValueOrDefault("Destination-System","") == "CFT")">
<rewrite-uri template="/retrieve-schedule" copy-unmatched-params="true" />
<set-backend-service base-url="http://#{emulatorHost}#/schedules/" />
</when>
<when condition="@(context.Request.Headers.GetValueOrDefault("Destination-System","") == "CRIME")">
<rewrite-uri template="/retrieve-schedule" copy-unmatched-params="true" />
<set-backend-service base-url="http://#{emulatorHost}#/schedules/" />
</when>
<when condition="@(context.Request.Headers.GetValueOrDefault("Destination-System","") == "MOCK")">
<mock-response status-code="201" content-type="application/json" />
</when>
<otherwise>
<return-response>
<set-status code="400" />
<set-header name="Content-Type" exists-action="override">
<value>application/json</value>
</set-header>
<set-body>@{
return new JObject(
new JProperty("message", context.Request.Headers.GetValueOrDefault("Destination-System","") + " destination doesn't support this functionality")
).ToString();
}</set-body>
</return-response>
</otherwise>
</choose>
</inbound>
<backend>
Expand Down
Loading

0 comments on commit 219d88f

Please sign in to comment.