-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TFP-5952 kalle tilgang sammenligne med abac, logg
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
.../src/main/java/no/nav/foreldrepenger/produksjonsstyring/behandlingenhet/RutingKlient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package no.nav.foreldrepenger.produksjonsstyring.behandlingenhet; | ||
|
||
import jakarta.enterprise.context.Dependent; | ||
import jakarta.validation.Valid; | ||
import jakarta.ws.rs.core.UriBuilder; | ||
|
||
import no.nav.vedtak.felles.integrasjon.rest.*; | ||
|
||
import java.net.URI; | ||
import java.util.Set; | ||
|
||
@Dependent | ||
@RestClientConfig(tokenConfig = TokenFlow.AZUREAD_CC, application = FpApplication.FPTILGANG) | ||
public class RutingKlient { | ||
|
||
private final URI rutingUri; | ||
private final RestClient klient; | ||
private final RestConfig restConfig; | ||
|
||
public RutingKlient() { | ||
this.klient = RestClient.client(); | ||
this.restConfig = RestConfig.forClient(this.getClass()); | ||
this.rutingUri = UriBuilder.fromUri(restConfig.fpContextPath()) | ||
.path("/api/ruting/egenskaper") | ||
.build(); | ||
} | ||
|
||
public Set<RutingResultat> finnRutingEgenskaper(Set<String> aktørIdenter) { | ||
var request = new RutingRequest(aktørIdenter); | ||
var rrequest = RestRequest.newPOSTJson(request, rutingUri, restConfig); | ||
return klient.sendReturnOptional(rrequest, RutingRespons.class).map(RutingRespons::resultater).orElseGet(Set::of); | ||
} | ||
|
||
|
||
public record RutingRequest(@Valid Set<String> aktørIdenter) { } | ||
|
||
public record RutingRespons(Set<RutingResultat> resultater) { } | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...rc/main/java/no/nav/foreldrepenger/produksjonsstyring/behandlingenhet/RutingResultat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package no.nav.foreldrepenger.produksjonsstyring.behandlingenhet; | ||
|
||
public enum RutingResultat { | ||
STRENGTFORTROLIG, | ||
SKJERMING, | ||
UTLAND | ||
} |