Re: Get list of users of a tenant in Openstack with JClouds =1.8

2015-04-15 Thread Ignasi Barrera
Being a method in an extension, it shouldn't be in the UserApi, as some
installation couldn't have that extension available and we need to take
that into account. There are the UserAdminApi and the TenantAdminApi for
the OS-KSADM extension. The former contains generic user operations, and
the latter contains the tenant-scoped ones, that's why I suggested to add
the method there. Does it make sense?

Feel free to send the pull request!

I.

On 14 April 2015 at 23:30, Diego Parrilla Santamaría 
diego.parrilla.santama...@gmail.com wrote:

 Hi Ignasi,

 nice to hear from you again! Yep, we use jclouds in our stackops products
 since mid 2014. What a great stuff you are building dudes!

 You are right, it's part of the  OS-KSADM extension. I have already
 implemented it in jclouds 2.0 and it's working like a breeze: actually it
 was just a bunch of lines of code:

 package org.jclouds.openstack.keystone.v2_0.features;

 ...

/**

 * List users that belong to a specific tenant

 *

 * @return the list of users

 */

@Named(user:listUsersOnTenant)

@GET

@Path(/tenants/{tenantId}/users)

@ResponseParser(ParseUsers.class)

@Transform(ToPagedIterable.class)

@Fallback(EmptyPagedIterableOnNotFoundOr404.class)

PagedIterableUser listUsersOnTenant(@PathParam(tenantId) String
 tenantId);


@Named(user:listUsersOnTenant)

@GET

@Path(/tenants/{tenantId}/users)

@ResponseParser(ParseUsers.class)

@Fallback(EmptyPaginatedCollectionOnNotFoundOr404.class)

PaginatedCollectionUser listUsersOnTenant(@PathParam(tenantId)
 String tenantId,

 PaginationOptions options);


 But it sounds me better in the UserApi class since it returns a list of
 users... but actually I don't care and I can change it right way.

 Let me know if I have to change it to TenantAdminApi and I will send the
 pull request. I hope you are not as much talibans as the Openstack dudes
 are ;-)

 Cheers

  --
 Diego Parrilla
 http://www.stackops.com/*CEO*
 *www.stackops.com http://www.stackops.com/ | *
 diego.parri...@stackops.com | +34 91 005-2164 | skype:diegoparrilla



 On Mon, Apr 13, 2015 at 10:28 AM, Ignasi Barrera n...@apache.org wrote:

 Hi Diego, long time no see!

 The call seems to be part of the OS-KSADM extension [1], right? jclouds
 does not implement it yet, but adding it to the TenantAdminApi [2] would be
 pretty straightforward. Since this addition shouldn't introduce breaking
 changes, there is no problem in adding it to 2.0 and 1.9.x.

 We love pull requests. Wanna try sending us a path [3]?


 HTH!

 I.


 [1] http://developer.openstack.org/api-ref-identity-v2-ext.html
 [2]
 https://github.com/jclouds/jclouds/blob/master/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApi.java
 [3] https://cwiki.apache.org/confluence/display/JCLOUDS/How+to+Contribute

 On 10 April 2015 at 13:48, Diego Parrilla Santamaría 
 diego.parrilla.santama...@gmail.com wrote:

 Hi folks,

 this is an issue we have been struggling with for a while and now it's
 becoming mandatory to find a workaround for how we do it now:

 Our goal is to get what users are in a specific tenant using Keystone
 API. There is a well known call to the API that can return the list of
 users:

 curl -i -X GET http://api.stackops.int:35357/v2.0/tenants/tenant-id/users
 -H User-Agent: python-keystoneclient -H X-Auth-Token: TOKEN

 But we can't find an equivalent call in JClouds. The way we do it now is:
 1) Get the list of users
 2) Check if any user has a role in the tenant. If so, add the user to
 the users in the tenant list.

 The process hits heavily on Keystone and it's fine for a few hundreds of
 tenants, but  now we are facing performance issues when dealing with
 thousands of tenants and users.

 So my question(s) are:
 1) Is this call implemented in JClouds and we don't know how to use it?
 2) Any plans for future implementations in 1.9.x and 2.0?
 3) Are there a good reason for not to have this API call implemented?
 Maybe I'm missing something.
 4) Any chance of having our code implementing this feature in JClouds?

 Cheers!
 Diego

  --
 Diego Parrilla
 http://www.stackops.com/*CEO*
 *www.stackops.com http://www.stackops.com/ | *
 diego.parri...@stackops.com | +34 91 005-2164 | skype:diegoparrilla






Re: Get list of users of a tenant in Openstack with JClouds =1.8

2015-04-13 Thread Ignasi Barrera
Hi Diego, long time no see!

The call seems to be part of the OS-KSADM extension [1], right? jclouds
does not implement it yet, but adding it to the TenantAdminApi [2] would be
pretty straightforward. Since this addition shouldn't introduce breaking
changes, there is no problem in adding it to 2.0 and 1.9.x.

We love pull requests. Wanna try sending us a path [3]?


HTH!

I.


[1] http://developer.openstack.org/api-ref-identity-v2-ext.html
[2]
https://github.com/jclouds/jclouds/blob/master/apis/openstack-keystone/src/main/java/org/jclouds/openstack/keystone/v2_0/extensions/TenantAdminApi.java
[3] https://cwiki.apache.org/confluence/display/JCLOUDS/How+to+Contribute

On 10 April 2015 at 13:48, Diego Parrilla Santamaría 
diego.parrilla.santama...@gmail.com wrote:

 Hi folks,

 this is an issue we have been struggling with for a while and now it's
 becoming mandatory to find a workaround for how we do it now:

 Our goal is to get what users are in a specific tenant using Keystone API.
 There is a well known call to the API that can return the list of users:

 curl -i -X GET http://api.stackops.int:35357/v2.0/tenants/tenant-id/users
 -H User-Agent: python-keystoneclient -H X-Auth-Token: TOKEN

 But we can't find an equivalent call in JClouds. The way we do it now is:
 1) Get the list of users
 2) Check if any user has a role in the tenant. If so, add the user to the
 users in the tenant list.

 The process hits heavily on Keystone and it's fine for a few hundreds of
 tenants, but  now we are facing performance issues when dealing with
 thousands of tenants and users.

 So my question(s) are:
 1) Is this call implemented in JClouds and we don't know how to use it?
 2) Any plans for future implementations in 1.9.x and 2.0?
 3) Are there a good reason for not to have this API call implemented?
 Maybe I'm missing something.
 4) Any chance of having our code implementing this feature in JClouds?

 Cheers!
 Diego

  --
 Diego Parrilla
 http://www.stackops.com/*CEO*
 *www.stackops.com http://www.stackops.com/ | *
 diego.parri...@stackops.com | +34 91 005-2164 | skype:diegoparrilla