PortalAdminController up
[portal.git] / portal-BE / src / main / java / org / onap / portal / restTemplates / AAFTemplate.java
1 package org.onap.portal.restTemplates;
2
3 import org.onap.portal.utils.EPCommonSystemProperties;
4 import org.onap.portalsdk.core.util.SystemProperties;
5 import org.springframework.http.HttpEntity;
6 import org.springframework.http.HttpMethod;
7 import org.springframework.http.ResponseEntity;
8 import org.springframework.stereotype.Component;
9 import org.springframework.web.client.RestTemplate;
10
11 @Component
12 public class AAFTemplate {
13
14     private final RestTemplate template = new RestTemplate();
15
16     public ResponseEntity<String> addPortalAdminInAAF(HttpEntity<String> addUserRole){
17         return template.exchange(
18             SystemProperties.getProperty(
19                 EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
20                 + "userRole",
21             HttpMethod.POST, addUserRole, String.class);
22     }
23
24     public void deletePortalAdminFromAAF(final String name, final String extRole, final HttpEntity<String> addUserRole){
25         template.exchange(
26             SystemProperties.getProperty(
27                 EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_URL)
28                 + "userRole/" + name + "/" + extRole,
29             HttpMethod.DELETE, addUserRole, String.class);
30     }
31 }