summaryrefslogtreecommitdiffstats
path: root/keystone-client/src/main
diff options
context:
space:
mode:
authorChrisC <cc697w@intl.att.com>2017-01-31 13:57:24 +0100
committerChrisC <cc697w@intl.att.com>2017-01-31 14:55:11 +0100
commit2e984294ac28c6f2ede290c38164c5d536ccaf4a (patch)
tree5eba5a929b7a961c98749fa69e03cfea58e1a724 /keystone-client/src/main
parent86c0f28c8ed469486b64d6422dc53e3a7bcc8adb (diff)
Initial OpenECOMP MSO OpenStack SDK lib commit
Change-Id: Ieaacb2b2c0dcc469669880e73f0cda9fa59a6c5a Signed-off-by: ChrisC <cc697w@intl.att.com>
Diffstat (limited to 'keystone-client/src/main')
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/Keystone.java65
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java71
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java58
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java70
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/api/TenantsResource.java212
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java83
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java85
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java56
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java28
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java73
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java13
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java13
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java24
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java21
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java13
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java44
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java14
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java17
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java15
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java34
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java27
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java24
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java27
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java19
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java13
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java42
-rw-r--r--keystone-client/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java27
27 files changed, 1188 insertions, 0 deletions
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<Endpoints> {
+
+ public List() {
+ super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<Endpoint> {
+
+ 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<Endpoint> {
+
+ public Show(String id) {
+ super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class);
+ }
+
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ 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<Roles> {
+
+ public List() {
+ super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<Role> {
+
+ 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<Void> {
+
+ 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<Services> {
+
+ public List() {
+ super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<Service> {
+
+ 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<Service> {
+
+ public Show(String id) {
+ super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class);
+ }
+
+ }
+
+ public class Delete extends OpenStackRequest<Void> {
+
+ 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<Tenants> {
+
+ public List() {
+ super(client, HttpMethod.GET, "/tenants", null, Tenants.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<Tenant> {
+
+ 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<Tenant> {
+
+ public Show(String id) {
+ super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(id).toString(), null, Tenant.class);
+ }
+
+ }
+
+ public class Update extends OpenStackRequest<Tenant> {
+
+ 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<Void> {
+
+ public Delete(String id) {
+ super(client, HttpMethod.DELETE, new StringBuilder("/tenants/").append(id).toString(), null, Void.class);
+ }
+
+ }
+
+ public class ListUsers extends OpenStackRequest<Users> {
+
+ public ListUsers(String tenantId) {
+ super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/users").toString(), null, Users.class);
+ }
+
+ }
+
+ public class AddUser extends OpenStackRequest<Void> {
+
+ 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<Void> {
+
+ 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<Roles> {
+
+ 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<Metadata> {
+
+ public ShowMetadata(String tenantId) {
+ super(client, HttpMethod.GET, new StringBuilder("/tenants/").append(tenantId).append("/metadata"), null, Metadata.class);
+ }
+
+ }
+
+ public class CreateOrUpdateMetadata extends OpenStackRequest<Metadata> {
+
+ 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<Metadata> {
+
+ 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<Metadata> {
+
+ 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<Metadata> {
+
+ 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<Void> {
+
+ 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<Access> {
+
+ 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<Users> {
+
+ public List() {
+ super(client, HttpMethod.GET, "/users", null, Users.class);
+ }
+
+ }
+
+ public class Create extends OpenStackRequest<User> {
+
+ 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<User> {
+
+ public Show(String id) {
+ super(client, HttpMethod.GET, new StringBuilder("/users/").append(id).toString(), null, User.class);
+ }
+
+ }
+
+ public class Update extends OpenStackRequest<User> {
+
+ 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<Void> {
+
+ 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<String, Access> hashTenantAccess;
+
+ public KeystoneTokenProvider(String endpoint, String username, String password) {
+ this.keystone = new Keystone(endpoint);
+ this.username = username;
+ this.password = password;
+ this.hashTenantAccess = new ConcurrentHashMap<String, Access>();
+ }
+
+ 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<Service> 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<Credential, Credentials> {
+
+ 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<Role, Roles> {
+
+ 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<Role, Roles> {
+
+ public DomainUserRolesResource(OpenStackClient client, String path) {
+ super(client, path, Role.class, Roles.class);
+ }
+
+ public OpenStackRequest<Void> add(String roleId) {
+ return new OpenStackRequest<Void>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class);
+ }
+
+ public OpenStackRequest<Void> remove(String roleId) {
+ return new OpenStackRequest<Void>(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<Domain, Domains> {
+
+ 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<Endpoint, Endpoints> {
+
+ 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<One, Many> {
+
+ protected final OpenStackClient CLIENT;
+
+ protected CharSequence path;
+
+ protected Class<One> oneClass;
+ protected Class<Many> manyClass;
+
+ public GenericResource(OpenStackClient client, CharSequence path, Class<One> oneClass, Class<Many> manyClass) {
+ CLIENT = client;
+ this.path = path;
+ this.oneClass = oneClass;
+ this.manyClass = manyClass;
+ }
+
+ public OpenStackRequest<Many> list() {
+ return new OpenStackRequest<Many>(CLIENT, HttpMethod.GET, path, null, manyClass);
+ }
+
+ public OpenStackRequest<One> create(One one) {
+ return new OpenStackRequest<One>(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass);
+ }
+
+ public OpenStackRequest<One> show(String id) {
+ return new OpenStackRequest<One>(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass);
+ }
+
+ public OpenStackRequest<One> update(String id, One one) {
+ return new OpenStackRequest<One>(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass);
+ }
+
+ public OpenStackRequest<One> delete(String id) {
+ return new OpenStackRequest<One>(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<User, Users> {
+
+ 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<Group, Groups> {
+
+ 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<Policy, Policies> {
+
+ 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<Role, Roles> {
+
+ public ProjectGroupRolesResource(OpenStackClient client, String path) {
+ super(client, path, Role.class, Roles.class);
+ }
+
+ @Override
+ public OpenStackRequest<Role> create(Role one) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public OpenStackRequest<Role> show(String id) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public OpenStackRequest<Role> update(String id, Role one) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public OpenStackRequest<Role> 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<Void> add(String roleId) {
+ return new OpenStackRequest<Void>(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class);
+ }
+
+ public OpenStackRequest<Void> remove(String roleId) {
+ return new OpenStackRequest<Void>(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<Role, Roles> {
+
+ public ProjectUserRolesResource(OpenStackClient client, String path) {
+ super(client, path, Role.class, Roles.class);
+ }
+
+ public OpenStackRequest<Void> add(String roleId) {
+ return new OpenStackRequest<Void>(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class);
+ }
+
+ public OpenStackRequest<Void> remove(String roleId) {
+ return new OpenStackRequest<Void>(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<Project, Projects> {
+
+ public ProjectsResource(OpenStackClient client) {
+ super(client, "/projects", Project.class, Projects.class);
+ }
+
+ public OpenStackRequest<Users> 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<Role, Roles> {
+
+ public RolesResource(OpenStackClient client) {
+ super(client, "/roles", Role.class, Roles.class);
+ }
+
+ public OpenStackRequest<Users> 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<Service, Services> {
+
+ 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<Token> show() {
+ return CLIENT.get("/auth/tokens", Token.class);
+ }
+
+ public class Authenticate extends OpenStackRequest<Token> {
+
+ 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<User, Users> {
+
+ public UsersResource(OpenStackClient client) {
+ super(client, "/users", User.class, Users.class);
+ }
+
+ public OpenStackRequest<Services> groups(String userId) {
+ return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class);
+ }
+
+ public OpenStackRequest<Services> projects(String userId) {
+ return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class);
+ }
+
+ public OpenStackRequest<Services> roles(String userId) {
+ return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class);
+ }
+
+}