Search in sources :

Example 1 with LoadRoleResponse

use of com.tremolosecurity.unison.openstack.model.LoadRoleResponse in project OpenUnison by TremoloSecurity.

the class KeystoneProvisioningTarget method getRoleID.

private String getRoleID(String token, HttpCon con, String name) throws Exception {
    StringBuffer b = new StringBuffer();
    b.append(this.url).append("/roles?name=").append(URLEncoder.encode(name, "UTF-8"));
    String json = this.callWS(token, con, b.toString());
    Gson gson = new Gson();
    LoadRoleResponse resp = gson.fromJson(json, LoadRoleResponse.class);
    if (resp.getRoles().isEmpty()) {
        return null;
    } else {
        return resp.getRoles().get(0).getId();
    }
}
Also used : Gson(com.google.gson.Gson) LoadRoleResponse(com.tremolosecurity.unison.openstack.model.LoadRoleResponse)

Aggregations

Gson (com.google.gson.Gson)1 LoadRoleResponse (com.tremolosecurity.unison.openstack.model.LoadRoleResponse)1