Skip to content

Commit 27ffb6e

Browse files
committed
DMP-5252 ARM 5.2 upgrade
Made changes to conform to the ARM 5.2 upgrade where auth and api are replacing the www part of hostname and respecitively removed from the rest of the URL
1 parent 2fa32a8 commit 27ffb6e

File tree

3 files changed

+203
-0
lines changed

3 files changed

+203
-0
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
package uk.gov.hmcts.darts.arm.client;
2+
3+
import org.springframework.cloud.openfeign.FeignClient;
4+
import org.springframework.web.bind.annotation.GetMapping;
5+
import org.springframework.web.bind.annotation.PathVariable;
6+
import org.springframework.web.bind.annotation.PostMapping;
7+
import org.springframework.web.bind.annotation.RequestBody;
8+
import org.springframework.web.bind.annotation.RequestHeader;
9+
import uk.gov.hmcts.darts.arm.client.model.UpdateMetadataRequest;
10+
import uk.gov.hmcts.darts.arm.client.model.UpdateMetadataResponse;
11+
import uk.gov.hmcts.darts.arm.client.model.rpo.ArmAsyncSearchResponse;
12+
import uk.gov.hmcts.darts.arm.client.model.rpo.CreateExportBasedOnSearchResultsTableRequest;
13+
import uk.gov.hmcts.darts.arm.client.model.rpo.CreateExportBasedOnSearchResultsTableResponse;
14+
import uk.gov.hmcts.darts.arm.client.model.rpo.EmptyRpoRequest;
15+
import uk.gov.hmcts.darts.arm.client.model.rpo.ExtendedProductionsByMatterResponse;
16+
import uk.gov.hmcts.darts.arm.client.model.rpo.ExtendedSearchesByMatterResponse;
17+
import uk.gov.hmcts.darts.arm.client.model.rpo.IndexesByMatterIdRequest;
18+
import uk.gov.hmcts.darts.arm.client.model.rpo.IndexesByMatterIdResponse;
19+
import uk.gov.hmcts.darts.arm.client.model.rpo.MasterIndexFieldByRecordClassSchemaRequest;
20+
import uk.gov.hmcts.darts.arm.client.model.rpo.MasterIndexFieldByRecordClassSchemaResponse;
21+
import uk.gov.hmcts.darts.arm.client.model.rpo.ProductionOutputFilesRequest;
22+
import uk.gov.hmcts.darts.arm.client.model.rpo.ProductionOutputFilesResponse;
23+
import uk.gov.hmcts.darts.arm.client.model.rpo.ProfileEntitlementResponse;
24+
import uk.gov.hmcts.darts.arm.client.model.rpo.RecordManagementMatterResponse;
25+
import uk.gov.hmcts.darts.arm.client.model.rpo.RemoveProductionRequest;
26+
import uk.gov.hmcts.darts.arm.client.model.rpo.RemoveProductionResponse;
27+
import uk.gov.hmcts.darts.arm.client.model.rpo.SaveBackgroundSearchRequest;
28+
import uk.gov.hmcts.darts.arm.client.model.rpo.SaveBackgroundSearchResponse;
29+
import uk.gov.hmcts.darts.arm.client.model.rpo.StorageAccountRequest;
30+
import uk.gov.hmcts.darts.arm.client.model.rpo.StorageAccountResponse;
31+
32+
import static org.springframework.http.HttpHeaders.AUTHORIZATION;
33+
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
34+
import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE;
35+
36+
@FeignClient(
37+
name = "arm-api-base-client",
38+
url = "${darts.storage.arm-api.version5-2.api.api-base-url}"
39+
)
40+
public interface ArmApiBaseClient {
41+
42+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.update-metadata-path}",
43+
consumes = APPLICATION_JSON_VALUE,
44+
produces = APPLICATION_JSON_VALUE
45+
)
46+
UpdateMetadataResponse updateMetadata(@RequestHeader(AUTHORIZATION) String bearerAuth,
47+
@RequestBody UpdateMetadataRequest updateMetadataRequest);
48+
49+
@GetMapping("${darts.storage.arm-api.version5-2.api.download-data-path}")
50+
@SuppressWarnings({"PMD.UseObjectForClearerAPI"})
51+
feign.Response downloadArmData(@RequestHeader(AUTHORIZATION) String bearerAuth,
52+
@PathVariable("cabinet_id") String cabinetId,
53+
@PathVariable("record_id") String externalRecordId,
54+
@PathVariable("file_id") String externalFileId);
55+
56+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-record-management-matter-path}",
57+
consumes = APPLICATION_JSON_VALUE,
58+
produces = APPLICATION_JSON_VALUE
59+
)
60+
RecordManagementMatterResponse getRecordManagementMatter(@RequestHeader(AUTHORIZATION) String bearerAuth,
61+
@RequestBody EmptyRpoRequest emptyRpoRequest);
62+
63+
64+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-storage-accounts-path}",
65+
consumes = APPLICATION_JSON_VALUE,
66+
produces = APPLICATION_JSON_VALUE
67+
)
68+
StorageAccountResponse getStorageAccounts(@RequestHeader(AUTHORIZATION) String bearerToken,
69+
@RequestBody StorageAccountRequest storageAccountRequest);
70+
71+
72+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-master-index-field-by-record-class-schema-path}",
73+
consumes = APPLICATION_JSON_VALUE,
74+
produces = APPLICATION_JSON_VALUE
75+
)
76+
MasterIndexFieldByRecordClassSchemaResponse getMasterIndexFieldByRecordClassSchema(
77+
@RequestHeader(AUTHORIZATION) String bearerAuth, @RequestBody MasterIndexFieldByRecordClassSchemaRequest masterIndexFieldByRecordClassSchemaRequest);
78+
79+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-profile-entitlements-path}",
80+
consumes = APPLICATION_JSON_VALUE,
81+
produces = APPLICATION_JSON_VALUE
82+
)
83+
ProfileEntitlementResponse getProfileEntitlementResponse(@RequestHeader(AUTHORIZATION) String bearerAuth,
84+
@RequestBody EmptyRpoRequest emptyRpoRequest);
85+
86+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.add-async-search-path}",
87+
consumes = APPLICATION_JSON_VALUE,
88+
produces = APPLICATION_JSON_VALUE
89+
)
90+
ArmAsyncSearchResponse addAsyncSearch(@RequestHeader(AUTHORIZATION) String bearerAuth, @RequestBody String body);
91+
92+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-indexes-by-matter-id-path}",
93+
consumes = APPLICATION_JSON_VALUE,
94+
produces = APPLICATION_JSON_VALUE
95+
)
96+
IndexesByMatterIdResponse getIndexesByMatterId(@RequestHeader(AUTHORIZATION) String bearerToken,
97+
@RequestBody IndexesByMatterIdRequest indexesByMatterIdRequest);
98+
99+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.save-background-search-path}",
100+
consumes = APPLICATION_JSON_VALUE,
101+
produces = APPLICATION_JSON_VALUE
102+
)
103+
SaveBackgroundSearchResponse saveBackgroundSearch(@RequestHeader(AUTHORIZATION) String bearerToken,
104+
@RequestBody SaveBackgroundSearchRequest saveBackgroundSearchRequest);
105+
106+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-extended-searches-by-matter-path}",
107+
consumes = APPLICATION_JSON_VALUE,
108+
produces = APPLICATION_JSON_VALUE
109+
)
110+
ExtendedSearchesByMatterResponse getExtendedSearchesByMatter(@RequestHeader(AUTHORIZATION) String bearerToken,
111+
@RequestBody String body);
112+
113+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-production-output-files-path}",
114+
consumes = APPLICATION_JSON_VALUE,
115+
produces = APPLICATION_JSON_VALUE
116+
)
117+
ProductionOutputFilesResponse getProductionOutputFiles(@RequestHeader(AUTHORIZATION) String bearerToken,
118+
@RequestBody ProductionOutputFilesRequest productionOutputFilesRequest);
119+
120+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.rpo-url.create-export-based-on-search-results-table-path}",
121+
consumes = APPLICATION_JSON_VALUE,
122+
produces = APPLICATION_JSON_VALUE
123+
)
124+
CreateExportBasedOnSearchResultsTableResponse createExportBasedOnSearchResultsTable(
125+
@RequestHeader(AUTHORIZATION) String bearerToken, @RequestBody CreateExportBasedOnSearchResultsTableRequest request);
126+
127+
128+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.rpo-url.remove-production-path}",
129+
consumes = APPLICATION_JSON_VALUE,
130+
produces = APPLICATION_JSON_VALUE
131+
)
132+
RemoveProductionResponse removeProduction(@RequestHeader(AUTHORIZATION) String bearerToken,
133+
@RequestBody RemoveProductionRequest removeProductionRequest);
134+
135+
@PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-extended-productions-by-matter}",
136+
consumes = APPLICATION_JSON_VALUE,
137+
produces = APPLICATION_JSON_VALUE
138+
)
139+
ExtendedProductionsByMatterResponse getExtendedProductionsByMatter(@RequestHeader(AUTHORIZATION) String bearerToken,
140+
@RequestBody String body);
141+
142+
@GetMapping(value = "${darts.storage.arm-api.version5-2.api.download-production-path}",
143+
produces = APPLICATION_OCTET_STREAM_VALUE)
144+
feign.Response downloadProduction(@RequestHeader(AUTHORIZATION) String bearerAuth,
145+
@PathVariable("productionExportFileID") String productionExportFileId);
146+
147+
148+
/**
149+
* Download production that should only be used in lower environments for testing purposes.
150+
*/
151+
@GetMapping(value = "${darts.storage.arm-api.version5-2.api.download-production-path}",
152+
produces = APPLICATION_OCTET_STREAM_VALUE)
153+
feign.Response downloadProduction(@RequestHeader(AUTHORIZATION) String bearerAuth,
154+
@RequestHeader("EOD_IDS") String eodIds,
155+
@PathVariable("productionExportFileID") String productionExportFileId);
156+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package uk.gov.hmcts.darts.arm.client;
2+
3+
import org.springframework.cloud.openfeign.FeignClient;
4+
import org.springframework.web.bind.annotation.PostMapping;
5+
import uk.gov.hmcts.darts.arm.client.model.ArmTokenRequest;
6+
import uk.gov.hmcts.darts.arm.client.model.ArmTokenResponse;
7+
8+
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
9+
10+
@FeignClient(
11+
name = "arm-auth-client",
12+
url = "${darts.storage.arm-api.version5-2.authentication.auth-base-url}"
13+
)
14+
public interface ArmAuthClient {
15+
16+
@PostMapping(value = "${darts.storage.arm-api.version5-2.authentication.token-path}",
17+
consumes = APPLICATION_JSON_VALUE,
18+
produces = APPLICATION_JSON_VALUE)
19+
ArmTokenResponse getToken(ArmTokenRequest armTokenRequest);
20+
21+
}

src/main/resources/application.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,32 @@ darts:
289289
get-extended-productions-by-matter: /api/v1/getExtendedProductionsByMatter
290290
download-production-path: /api/v1/downloadProduction/{productionExportFileID}/false
291291

292+
enable-arm-v5-2-upgrade: ${ENABLE_ARM_V5_2_UPGRADE:false}
293+
294+
version5-2:
295+
authentication:
296+
auth-base-url: ${ARM_AUTH_URL}
297+
token-path: /account/token
298+
api:
299+
api-base-url: ${ARM_API_URL}
300+
available-entitlement-profiles-path: /v1/availableEntitlementProfiles
301+
select-entitlement-profile-path: /v1/selectEntitlementProfile/{profile_id}
302+
update-metadata-path: /v3/UpdateMetadata
303+
download-data-path: /v1/downloadBlob/{cabinet_id}/{record_id}/{file_id}
304+
get-record-management-matter-path: /v1/getRecordManagementMatter
305+
get-storage-accounts-path: /v1/getStorageAccounts
306+
get-indexes-by-matter-id-path: /v1/getIndexesByMatterId
307+
get-master-index-field-by-record-class-schema-path: /v1/getMasterIndexFieldByRecordClassSchema
308+
get-profile-entitlements-path: /v1/getProfileEntitlements
309+
add-async-search-path: /v1/addAsyncSearchRM
310+
save-background-search-path: /v1/SaveBackgroundSearch
311+
create-export-based-on-search-results-table-path: /v1/CreateExportBasedOnSearchResultsTable
312+
get-extended-searches-by-matter-path: /v1/getExtendedSearchesByMatter
313+
get-production-output-files-path: /v1/getProductionOutputFiles
314+
remove-production-path: /v1/removeProduction
315+
get-extended-productions-by-matter: /v1/getExtendedProductionsByMatter
316+
download-production-path: /v1/downloadProduction/{productionExportFileID}/false
317+
292318
dets:
293319
sas-endpoint: ${DETS_SAS_URL_ENDPOINT:}
294320
container-name: darts-migration

0 commit comments

Comments
 (0)