-public class A1Client {
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- public String getBaseUrl(final String nearRtRicUrl) {
- return nearRtRicUrl + "/A1-P/v1";
- }
-
- public Flux<String> getAllPolicyTypes(String nearRtRicUrl) {
- logger.debug("getAllPolicyTypes nearRtRicUrl = {}", nearRtRicUrl);
- AsyncRestClient client = new AsyncRestClient(getBaseUrl(nearRtRicUrl));
- Mono<String> response = client.get("/policytypes");
- return response.flatMapMany(this::createPolicyTypesFlux);
- }
-
- public Flux<String> getPoliciesForType(String nearRtRicUrl, String policyTypeId) {
- logger.debug("getPoliciesForType nearRtRicUrl = {}, policyTypeId = {}", nearRtRicUrl, policyTypeId);
- AsyncRestClient client = new AsyncRestClient(getBaseUrl(nearRtRicUrl));
- Mono<String> response = client.get("/policies");
- return response.flatMapMany(policiesString -> createPoliciesFlux(policiesString, policyTypeId));
- }