use of com.tremolosecurity.unison.openstack.model.DomainsResponse in project OpenUnison by TremoloSecurity.
the class KeystoneProvisioningTarget method getDomainName.
public String getDomainName(String id) throws ProvisioningException {
HttpCon con = null;
try {
con = this.createClient();
KSToken token = this.getToken(con);
StringBuffer b = new StringBuffer();
b.append(this.url).append("/domains/").append(id);
String json = this.callWS(token.getAuthToken(), con, b.toString());
Gson gson = new Gson();
DomainsResponse resp = gson.fromJson(json, DomainsResponse.class);
if (resp.getDomain() == null) {
return null;
} else {
return resp.getDomain().getName();
}
} catch (Exception e) {
throw new ProvisioningException("Could not work with keystone", e);
} finally {
if (con != null) {
con.getBcm().shutdown();
}
}
}
use of com.tremolosecurity.unison.openstack.model.DomainsResponse in project OpenUnison by TremoloSecurity.
the class KeystoneProvisioningTarget method getDomainID.
public String getDomainID(String token, HttpCon con, String name) throws Exception {
StringBuffer b = new StringBuffer();
b.append(this.url).append("/domains?name=").append(URLEncoder.encode(name, "UTF-8"));
String json = this.callWS(token, con, b.toString());
Gson gson = new Gson();
DomainsResponse resp = gson.fromJson(json, DomainsResponse.class);
if (resp.getDomains().isEmpty()) {
return null;
} else {
return resp.getDomains().get(0).getId();
}
}
Aggregations