Search in sources :

Example 1 with ProjectsResponse

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

the class KeystoneProvisioningTarget method getProjectID.

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

Aggregations

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