From 2e984294ac28c6f2ede290c38164c5d536ccaf4a Mon Sep 17 00:00:00 2001 From: ChrisC Date: Tue, 31 Jan 2017 13:57:24 +0100 Subject: Initial OpenECOMP MSO OpenStack SDK lib commit Change-Id: Ieaacb2b2c0dcc469669880e73f0cda9fa59a6c5a Signed-off-by: ChrisC --- .../com/woorea/openstack/keystone/Keystone.java | 65 +++++++ .../openstack/keystone/api/EndpointsResource.java | 71 +++++++ .../openstack/keystone/api/RolesResource.java | 58 ++++++ .../openstack/keystone/api/ServicesResource.java | 70 +++++++ .../openstack/keystone/api/TenantsResource.java | 212 +++++++++++++++++++++ .../openstack/keystone/api/TokensResource.java | 83 ++++++++ .../openstack/keystone/api/UsersResource.java | 85 +++++++++ .../keystone/utils/KeystoneTokenProvider.java | 56 ++++++ .../openstack/keystone/utils/KeystoneUtils.java | 28 +++ .../com/woorea/openstack/keystone/v3/Keystone.java | 73 +++++++ .../keystone/v3/api/CredentialsResources.java | 13 ++ .../keystone/v3/api/DomainGroupRolesResource.java | 13 ++ .../keystone/v3/api/DomainUserRolesResource.java | 24 +++ .../openstack/keystone/v3/api/DomainsResource.java | 21 ++ .../keystone/v3/api/EndpointsResource.java | 13 ++ .../openstack/keystone/v3/api/GenericResource.java | 44 +++++ .../keystone/v3/api/GroupUsersResource.java | 14 ++ .../openstack/keystone/v3/api/GroupsResource.java | 17 ++ .../keystone/v3/api/PoliciesResource.java | 15 ++ .../keystone/v3/api/ProjectGroupRolesResource.java | 34 ++++ .../keystone/v3/api/ProjectRolesResource.java | 27 +++ .../keystone/v3/api/ProjectUserRolesResource.java | 24 +++ .../keystone/v3/api/ProjectsResource.java | 27 +++ .../openstack/keystone/v3/api/RolesResource.java | 19 ++ .../keystone/v3/api/ServicesResource.java | 13 ++ .../openstack/keystone/v3/api/TokensResource.java | 42 ++++ .../openstack/keystone/v3/api/UsersResource.java | 27 +++ 27 files changed, 1188 insertions(+) create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java create mode 100644 keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java (limited to 'keystone-client/src') diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java new file mode 100644 index 0000000..38d42f0 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java @@ -0,0 +1,65 @@ +package com.woorea.openstack.keystone; + +import com.woorea.openstack.keystone.api.EndpointsResource; +import com.woorea.openstack.keystone.api.RolesResource; +import com.woorea.openstack.keystone.api.ServicesResource; +import com.woorea.openstack.keystone.api.TenantsResource; +import com.woorea.openstack.keystone.api.TokensResource; +import com.woorea.openstack.keystone.api.UsersResource; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; + +public class Keystone extends OpenStackClient { + + private final TokensResource TOKENS; + + private final TenantsResource TENANTS; + + private final UsersResource USERS; + + private final RolesResource ROLES; + + private final ServicesResource SERVICES; + + private final EndpointsResource ENDPOINTS; + + public Keystone(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + TOKENS = new TokensResource(this); + TENANTS = new TenantsResource(this); + USERS = new UsersResource(this); + ROLES = new RolesResource(this); + SERVICES = new ServicesResource(this); + ENDPOINTS = new EndpointsResource(this); + } + + public Keystone(String endpoint) { + this(endpoint, null); + } + + public TokensResource tokens() { + return TOKENS; + } + + public TenantsResource tenants() { + return TENANTS; + } + + public UsersResource users() { + return USERS; + } + + public RolesResource roles() { + return ROLES; + } + + public ServicesResource services() { + return SERVICES; + } + + public EndpointsResource endpoints() { + return ENDPOINTS; + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java new file mode 100644 index 0000000..acc128b --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java @@ -0,0 +1,71 @@ +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Endpoint; +import com.woorea.openstack.keystone.model.Endpoints; + +public class EndpointsResource { + + private OpenStackClient client; + + public EndpointsResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Endpoint endpoint) { + return new Create(endpoint); + } + + public Show show(String id) { + return new Show(id); + } + + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class); + } + + } + + public class Create extends OpenStackRequest { + + private Endpoint endpoint; + + public Create(Endpoint endpoint) { + super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class); + this.endpoint = endpoint; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java new file mode 100644 index 0000000..d39dc77 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java @@ -0,0 +1,58 @@ +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class RolesResource { + + private OpenStackClient client; + + public RolesResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Role role) { + return new Create(role); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class); + } + + } + + public class Create extends OpenStackRequest { + + private Role role; + + public Create(Role role) { + super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class); + this.role = role; + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java new file mode 100644 index 0000000..5b18939 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java @@ -0,0 +1,70 @@ +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Service; +import com.woorea.openstack.keystone.model.Services; + +public class ServicesResource { + + private OpenStackClient client; + + public ServicesResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Service service) { + return new Create(service); + } + + public Show show(String id) { + return new Show(id); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class); + } + + } + + public class Create extends OpenStackRequest { + + private Service service; + + public Create(Service service) { + super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class); + this.service = service; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class); + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java new file mode 100644 index 0000000..a073241 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java @@ -0,0 +1,212 @@ +package com.woorea.openstack.keystone.api; + +/* + * Modifications copyright (c) 2017 AT&T Intellectual Property + */ + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Roles; +import com.woorea.openstack.keystone.model.Tenant; +import com.woorea.openstack.keystone.model.Tenants; +import com.woorea.openstack.keystone.model.Users; +import com.woorea.openstack.keystone.model.Metadata; + +public class TenantsResource { + + private OpenStackClient client; + + public TenantsResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(Tenant tenant) { + return new Create(tenant); + } + + public Show show(String id) { + return new Show(id); + } + + public Update update(String id, Tenant tenant) { + return new Update(id, tenant); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public ListUsers listUsers(String tenantId) { + return new ListUsers(tenantId); + } + + public AddUser addUser(String tenantId, String userId, String roleId) { + return new AddUser(tenantId, userId, roleId); + } + + public RemoveUser removeUser(String tenantId, String userId, String roleId) { + return new RemoveUser(tenantId, userId, roleId); + } + + public ListUserRoles listUserRoles(String tenantId, String userId) { + return new ListUserRoles(tenantId, userId); + } + + public ShowMetadata showMetadata(String id) { + return new ShowMetadata(id); + } + + public CreateOrUpdateMetadata createOrUpdateMetadata(String id,Metadata metadata) { + return new CreateOrUpdateMetadata(id,metadata); + } + + public ReplaceMetadata replaceMetadata(String id,Metadata metadata) { + return new ReplaceMetadata(id,metadata); + } + + public ShowMetadataItem showMetadataItem(String id,String key) { + return new ShowMetadataItem(id,key); + } + + public CreateOrUpdateMetadataItem createOrUpdateMetadataItem(String id,String key,Metadata metadata) { + return new CreateOrUpdateMetadataItem(id,key,metadata); + } + + public DeleteMetadataItem deleteMetadataItem(String id, String key) { + return new DeleteMetadataItem(id,key); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/tenants", null, Tenants.class); + } + + } + + public class Create extends OpenStackRequest { + + private Tenant tenant; + + public Create(Tenant tenant) { + super(client, HttpMethod.POST, "/tenants", Entity.json(tenant), Tenant.class); + this.tenant = tenant; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(id).toString(), null, Tenant.class); + } + + } + + public class Update extends OpenStackRequest { + + private Tenant tenant; + + public Update(String id, Tenant tenant) { + super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(id).toString(), Entity.json(tenant), Tenant.class); + this.tenant = tenant; + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(id).toString(), null, Void.class); + } + + } + + public class ListUsers extends OpenStackRequest { + + public ListUsers(String tenantId) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users").toString(), null, Users.class); + } + + } + + public class AddUser extends OpenStackRequest { + + public AddUser(String tenantId, String userId, String roleId) { + super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); + } + + } + + public class RemoveUser extends OpenStackRequest { + + public RemoveUser(String tenantId, String userId, String roleId) { + super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles/OS-KSADM/").append(roleId).toString(), null, Void.class); + } + + } + + public class ListUserRoles extends OpenStackRequest { + + public ListUserRoles(String tenantId, String userId) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users/").append(userId).append("/roles").toString(), null, Roles.class); + } + + } + + /** + * The following APIs support Tenant-level metadata. This is a feature supported + * by the DCP/LCP (i.e. AIC cloud), but not native Openstack. The full API as + * documented by AIC is implemented below. + */ + public class ShowMetadata extends OpenStackRequest { + + public ShowMetadata(String tenantId) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/metadata"), null, Metadata.class); + } + + } + + public class CreateOrUpdateMetadata extends OpenStackRequest { + + public CreateOrUpdateMetadata(String tenantId,Metadata metadata) { + super(client, HttpMethod.POST, new StringBuilder("/tenants/").append(tenantId).append("/metadata"), Entity.json(metadata), Metadata.class); + } + + } + public class ReplaceMetadata extends OpenStackRequest { + + public ReplaceMetadata(String tenantId,Metadata metadata) { + super(client, HttpMethod.PUT, new StringBuilder("/tenants/").append(tenantId).append("/metadata"), Entity.json(metadata), Metadata.class); + } + + } + + public class ShowMetadataItem extends OpenStackRequest { + + public ShowMetadataItem(String tenantId, String key) { + super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/metadata").append(key), null, Metadata.class); + } + + } + public class CreateOrUpdateMetadataItem extends OpenStackRequest { + + public CreateOrUpdateMetadataItem(String tenantId,String key,Metadata metadata) { + super(client, HttpMethod.POST, new StringBuilder("/tenants/").append(tenantId).append("/metadata").append(key), Entity.json(metadata), Metadata.class); + } + + } + public class DeleteMetadataItem extends OpenStackRequest { + + public DeleteMetadataItem(String tenantId,String key) { + super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(tenantId).append("/metadata/").append(key), null, Void.class); + } + + } + } diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java new file mode 100644 index 0000000..4f30313 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java @@ -0,0 +1,83 @@ +package com.woorea.openstack.keystone.api; + +/* + * Modifications copyright (c) 2017 AT&T Intellectual Property + */ + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.model.authentication.AccessKey; +import com.woorea.openstack.keystone.model.authentication.RackspaceAuthentication; +import com.woorea.openstack.keystone.model.authentication.TokenAuthentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class TokensResource { + + private final OpenStackClient CLIENT; + + public TokensResource(OpenStackClient client) { + CLIENT = client; + } + + public Authenticate.Builder authenticate() { + return new Authenticate().new Builder(); + } + + public Authenticate authenticate(Authentication authentication) { + return new Authenticate(authentication); + } + + public class Authenticate extends OpenStackRequest { + + private Authentication authentication; + + public Authenticate() { + + } + + public Authenticate(Authentication authentication) { + super(CLIENT, HttpMethod.POST, "/tokens", Entity.json(authentication), Access.class); + this.authentication = authentication; + } + + public Authenticate withTenantId(String tenantId) { + authentication.setTenantId(tenantId); + return this; + } + + public Authenticate withTenantName(String tenantName) { + authentication.setTenantName(tenantName); + return this; + } + + public class Builder { + + public Authenticate withUsernamePassword(String username, String password) { + Authentication authentication = new UsernamePassword(username, password); + return new Authenticate(authentication); + } + + public Authenticate withToken(String token) { + Authentication authentication = new TokenAuthentication(token); + return new Authenticate(authentication); + } + + public Authenticate withRackspace(String username, String apiKey, String region) { + Authentication authentication = new RackspaceAuthentication(username, apiKey); + return new Authenticate(authentication); + } + + public Authenticate withAccessKey(String accessKey, String secretKey) { + Authentication authentication = new AccessKey(accessKey, secretKey); + return new Authenticate(authentication); + } + + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java new file mode 100644 index 0000000..dbb897c --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java @@ -0,0 +1,85 @@ +package com.woorea.openstack.keystone.api; + + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.User; +import com.woorea.openstack.keystone.model.Users; + +public class UsersResource { + + private OpenStackClient client; + + public UsersResource(OpenStackClient client) { + this.client = client; + } + + public List list() { + return new List(); + } + + public Create create(User user) { + return new Create(user); + } + + public Show show(String id) { + return new Show(id); + } + + public Update update(String id, User user) { + return new Update(id, user); + } + + public Delete delete(String id) { + return new Delete(id); + } + + public class List extends OpenStackRequest { + + public List() { + super(client, HttpMethod.GET, "/users", null, Users.class); + } + + } + + public class Create extends OpenStackRequest { + + private User user; + + public Create(User user) { + super(client, HttpMethod.POST, "/users", Entity.json(user), User.class); + this.user = user; + } + + } + + public class Show extends OpenStackRequest { + + public Show(String id) { + super(client, HttpMethod.GET, new StringBuilder("/users/").append(id).toString(), null, User.class); + } + + } + + public class Update extends OpenStackRequest { + + private User user; + + public Update(String id, User user) { + super(client, HttpMethod.PUT, new StringBuilder("/users/").append(id).toString(), Entity.json(user), User.class); + this.user = user; + } + + } + + public class Delete extends OpenStackRequest { + + public Delete(String id) { + super(client, HttpMethod.DELETE, new StringBuilder("/users/").append(id).toString(), null, Void.class); + } + + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java new file mode 100644 index 0000000..fb5127a --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java @@ -0,0 +1,56 @@ +package com.woorea.openstack.keystone.utils; + +import java.util.concurrent.ConcurrentHashMap; + +import com.woorea.openstack.base.client.OpenStackTokenProvider; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +public class KeystoneTokenProvider { + + protected Keystone keystone; + + protected String username; + + protected String password; + + ConcurrentHashMap hashTenantAccess; + + public KeystoneTokenProvider(String endpoint, String username, String password) { + this.keystone = new Keystone(endpoint); + this.username = username; + this.password = password; + this.hashTenantAccess = new ConcurrentHashMap(); + } + + public Access getAccessByTenant(String tenantName) { + Access access = hashTenantAccess.get(tenantName); + if (access == null) { + access = keystone.tokens().authenticate(new UsernamePassword(username, password)) + .withTenantName(tenantName) + .execute(); + hashTenantAccess.put(tenantName, access); + } + return access; + } + + public void expireAccessByTenant(String tenantName) { + hashTenantAccess.remove(tenantName); + } + + public OpenStackTokenProvider getProviderByTenant(final String tenantName) { + final KeystoneTokenProvider keystoneTokenProvider = this; + return new OpenStackTokenProvider() { + @Override + public String getToken() { + return keystoneTokenProvider.getAccessByTenant(tenantName) + .getToken().getId(); + } + @Override + public void expireToken() { + keystoneTokenProvider.expireAccessByTenant(tenantName); + } + }; + } +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java new file mode 100644 index 0000000..8269597 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java @@ -0,0 +1,28 @@ +package com.woorea.openstack.keystone.utils; + +import java.util.List; + +import com.woorea.openstack.keystone.model.Access.Service; + +public class KeystoneUtils { + + public static String findEndpointURL(List serviceCatalog, String type, String region, String facing) { + for(Service service : serviceCatalog) { + if(type.equals(service.getType())) { + for(Service.Endpoint endpoint : service.getEndpoints()) { + if(region == null || region.equals(endpoint.getRegion())) { + if(endpoint.getPublicURL() != null && facing.equals("public")) { + return endpoint.getPublicURL(); + } else if(endpoint.getInternalURL() != null && facing.equals("internal")) { + return endpoint.getInternalURL(); + } else if(endpoint.getAdminURL() != null && facing.equals("admin")) { + return endpoint.getAdminURL(); + } + } + } + } + } + throw new RuntimeException("endpoint url not found"); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java new file mode 100644 index 0000000..6ff889c --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java @@ -0,0 +1,73 @@ +package com.woorea.openstack.keystone.v3; + +import com.woorea.openstack.keystone.v3.api.DomainsResource; +import com.woorea.openstack.keystone.v3.api.EndpointsResource; +import com.woorea.openstack.keystone.v3.api.RolesResource; +import com.woorea.openstack.keystone.v3.api.ServicesResource; +import com.woorea.openstack.keystone.v3.api.ProjectsResource; +import com.woorea.openstack.keystone.v3.api.TokensResource; +import com.woorea.openstack.keystone.v3.api.UsersResource; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackClientConnector; + +public class Keystone extends OpenStackClient { + + private final TokensResource TOKENS; + + private final DomainsResource DOMAINS; + + private final ProjectsResource PROJECTS; + + private final UsersResource USERS; + + private final RolesResource ROLES; + + private final ServicesResource SERVICES; + + private final EndpointsResource ENDPOINTS; + + public Keystone(String endpoint, OpenStackClientConnector connector) { + super(endpoint, connector); + TOKENS = new TokensResource(this); + DOMAINS = new DomainsResource(this); + PROJECTS = new ProjectsResource(this); + USERS = new UsersResource(this); + ROLES = new RolesResource(this); + SERVICES = new ServicesResource(this); + ENDPOINTS = new EndpointsResource(this); + } + + public Keystone(String endpoint) { + this(endpoint, null); + } + + public TokensResource tokens() { + return TOKENS; + } + + public DomainsResource domains() { + return DOMAINS; + } + + public ProjectsResource projects() { + return PROJECTS; + } + + public UsersResource users() { + return USERS; + } + + public RolesResource roles() { + return ROLES; + } + + public ServicesResource services() { + return SERVICES; + } + + public EndpointsResource endpoints() { + return ENDPOINTS; + } + +} + diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java new file mode 100644 index 0000000..7be2620 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java @@ -0,0 +1,13 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Credential; +import com.woorea.openstack.keystone.v3.model.Credentials; + +public class CredentialsResources extends GenericResource { + + public CredentialsResources(OpenStackClient client) { + super(client, "/credentials", Credential.class, Credentials.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java new file mode 100644 index 0000000..a041ba2 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java @@ -0,0 +1,13 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Role; +import com.woorea.openstack.keystone.v3.model.Roles; + +public class DomainGroupRolesResource extends GenericResource { + + public DomainGroupRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java new file mode 100644 index 0000000..9a6e8e5 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java @@ -0,0 +1,24 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class DomainUserRolesResource extends GenericResource { + + public DomainUserRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + + public OpenStackRequest add(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + } + + public OpenStackRequest remove(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java new file mode 100644 index 0000000..28015ee --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java @@ -0,0 +1,21 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Domain; +import com.woorea.openstack.keystone.v3.model.Domains; + +public class DomainsResource extends GenericResource { + + public DomainsResource(OpenStackClient client) { + super(client, "/domains", Domain.class, Domains.class); + } + + public DomainUserRolesResource userRoles(String domainId, String userId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + } + + public DomainUserRolesResource groupRoles(String domainId, String groupId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString()); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java new file mode 100644 index 0000000..d1db88a --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java @@ -0,0 +1,13 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Endpoint; +import com.woorea.openstack.keystone.v3.model.Endpoints; + +public class EndpointsResource extends GenericResource { + + public EndpointsResource(OpenStackClient client) { + super(client, "/endpoints", Endpoint.class, Endpoints.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java new file mode 100644 index 0000000..117e941 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java @@ -0,0 +1,44 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; + +public class GenericResource { + + protected final OpenStackClient CLIENT; + + protected CharSequence path; + + protected Class oneClass; + protected Class manyClass; + + public GenericResource(OpenStackClient client, CharSequence path, Class oneClass, Class manyClass) { + CLIENT = client; + this.path = path; + this.oneClass = oneClass; + this.manyClass = manyClass; + } + + public OpenStackRequest list() { + return new OpenStackRequest(CLIENT, HttpMethod.GET, path, null, manyClass); + } + + public OpenStackRequest create(One one) { + return new OpenStackRequest(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass); + } + + public OpenStackRequest show(String id) { + return new OpenStackRequest(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + } + + public OpenStackRequest update(String id, One one) { + return new OpenStackRequest(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass); + } + + public OpenStackRequest delete(String id) { + return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(id).toString(), null, oneClass); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java new file mode 100644 index 0000000..60cce41 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java @@ -0,0 +1,14 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.User; +import com.woorea.openstack.keystone.v3.model.Users; + + +public class GroupUsersResource extends GenericResource { + + public GroupUsersResource(OpenStackClient client, String path) { + super(client, path, User.class, Users.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java new file mode 100644 index 0000000..be380cc --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java @@ -0,0 +1,17 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.v3.model.Group; +import com.woorea.openstack.keystone.v3.model.Groups; + +public class GroupsResource extends GenericResource { + + public GroupsResource(OpenStackClient client) { + super(client, "/groups", Group.class, Groups.class); + } + + public DomainUserRolesResource userRoles(String domainId, String userId) { + return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString()); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java new file mode 100644 index 0000000..ba16a46 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java @@ -0,0 +1,15 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; +import com.woorea.openstack.keystone.v3.model.Policies; +import com.woorea.openstack.keystone.v3.model.Policy; + +public class PoliciesResource extends GenericResource { + + public PoliciesResource(OpenStackClient client) { + super(client, "/policies", Policy.class, Policies.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java new file mode 100644 index 0000000..caed8ac --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java @@ -0,0 +1,34 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class ProjectGroupRolesResource extends GenericResource { + + public ProjectGroupRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + + @Override + public OpenStackRequest create(Role one) { + throw new UnsupportedOperationException(); + } + + @Override + public OpenStackRequest show(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public OpenStackRequest update(String id, Role one) { + throw new UnsupportedOperationException(); + } + + @Override + public OpenStackRequest delete(String id) { + throw new UnsupportedOperationException(); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java new file mode 100644 index 0000000..7e7e2fa --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java @@ -0,0 +1,27 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; + +public class ProjectRolesResource { + + private final OpenStackClient CLIENT; + + private final String PATH; + + public ProjectRolesResource(OpenStackClient client, String path) { + this.CLIENT = client; + this.PATH = path; + } + + public OpenStackRequest add(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class); + } + + public OpenStackRequest remove(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java new file mode 100644 index 0000000..9f3dc50 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java @@ -0,0 +1,24 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; + +public class ProjectUserRolesResource extends GenericResource { + + public ProjectUserRolesResource(OpenStackClient client, String path) { + super(client, path, Role.class, Roles.class); + } + + public OpenStackRequest add(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class); + } + + public OpenStackRequest remove(String roleId) { + return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java new file mode 100644 index 0000000..2e9fd9a --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java @@ -0,0 +1,27 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Users; +import com.woorea.openstack.keystone.v3.model.Project; +import com.woorea.openstack.keystone.v3.model.Projects; + +public class ProjectsResource extends GenericResource { + + public ProjectsResource(OpenStackClient client) { + super(client, "/projects", Project.class, Projects.class); + } + + public OpenStackRequest users(String projectId) { + return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class); + } + + public ProjectUserRolesResource userRoles(String projectId, String userId) { + return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString()); + } + + public ProjectUserRolesResource groupRoles(String projectId, String groupId) { + return new ProjectUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString()); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java new file mode 100644 index 0000000..2c28a1b --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java @@ -0,0 +1,19 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.v3.model.Role; +import com.woorea.openstack.keystone.v3.model.Roles; +import com.woorea.openstack.keystone.v3.model.Users; + +public class RolesResource extends GenericResource { + + public RolesResource(OpenStackClient client) { + super(client, "/roles", Role.class, Roles.class); + } + + public OpenStackRequest users(String domainId, String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java new file mode 100644 index 0000000..4742a2f --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java @@ -0,0 +1,13 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.keystone.model.Service; +import com.woorea.openstack.keystone.model.Services; + +public class ServicesResource extends GenericResource { + + public ServicesResource(OpenStackClient client) { + super(client, "/services", Service.class, Services.class); + } + +} diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java new file mode 100644 index 0000000..c2d53b3 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java @@ -0,0 +1,42 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.Entity; +import com.woorea.openstack.base.client.HttpMethod; +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.v3.model.Authentication; +import com.woorea.openstack.keystone.v3.model.Token; + +public class TokensResource { + + private final OpenStackClient CLIENT; + + public TokensResource(OpenStackClient client) { + CLIENT = client; + } + + public Authenticate authenticate(Authentication authentication) { + return new Authenticate(authentication); + } + + public OpenStackRequest show() { + return CLIENT.get("/auth/tokens", Token.class); + } + + public class Authenticate extends OpenStackRequest { + + private Authentication authentication; + + public Authenticate() { + + } + + public Authenticate(Authentication authentication) { + super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class); + this.authentication = authentication; + } + + } + +} + diff --git a/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java new file mode 100644 index 0000000..d6a6d14 --- /dev/null +++ b/keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java @@ -0,0 +1,27 @@ +package com.woorea.openstack.keystone.v3.api; + +import com.woorea.openstack.base.client.OpenStackClient; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.keystone.model.Services; +import com.woorea.openstack.keystone.v3.model.User; +import com.woorea.openstack.keystone.v3.model.Users; + +public class UsersResource extends GenericResource { + + public UsersResource(OpenStackClient client) { + super(client, "/users", User.class, Users.class); + } + + public OpenStackRequest groups(String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class); + } + + public OpenStackRequest projects(String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class); + } + + public OpenStackRequest roles(String userId) { + return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class); + } + +} -- cgit 1.2.3-korg