[openstack-dev] Specifying Tenant-ID in Openstack REST API URLs and Quatum 2.0 APIs

Zane Bitter zbitter at redhat.com
Mon Nov 12 15:19:38 UTC 2012


On 11/11/12 21:41, Steve Baker wrote:
> On 11/10/2012 03:09 PM, Dolph Mathews wrote:
>> I don't think anyone is suggesting to completely remove tenant ID's
>> from URLs across OpenStack; I think Juergen Brendel summarized it
>> really well: "From a purely RESTful standpoint, no tenant ID is needed
>> as long as the URI remains unique to the resource."
>
> We're still designing v1 of the Heat REST API so we have a chance of
> getting it right the first time. I'd like to use this thread to get some
> advice.
>
> We've just switched our stack ID from an incrementing integer to a UUID.
> Each stack also has a user assigned name which is unique within the tenant.
>
> Currently our list and show URLs are:
> /{tenant_id}/stacks
> /{tenant_id}/stacks/{name}/{id}
>
> Now that we use UUIDs we can do the following for show:
> /{tenant_id}/stacks/{uuid}
>
> However this thread suggests we need just enough in the URI to make it
> uniquely map to content, which would make our list and show:
> /{tenant_id}/stacks
> /stacks/{uuid}

Currently:
   /{tenant_id}/stacks/{name}
redirects to:
   /{tenant_id}/stacks/{name}/{uuid}

One option would be to change it so that e.g.
   /tenants/{tenant_id}/stacks/{name}
redirects to:
   /stacks/{uuid}

That does solve one problem - namely that it's nicer to work with stacks 
by name, but client libraries in OpenStack have traditionally referenced 
such things only by ID so it's good to be able to find the stack in a 
single step starting with only the UUID.

However it would mean that "GET /stacks" would either need a query 
parameter to specify the tenant id or it would have to redirect to 
"/tenants/{tenant_id}/stacks". As noted below, it also means we'd miss 
out on being able to look up the endpoint complete with tenant_id from 
the Keystone service catalog.

Thoughts?

- Zane.

>
> This would make the client more complex. Right now the endpoint from
> Keystone has the tenant ID, so all REST URLs just append to that. It
> seems more error-prone to leave it up to the client to know when to
> prepend the tenant ID.
>
> As a nice to have feature, our CLI should also be able to do operations
> on a stack name as well as a uuid. Looking at quantum (whose REST API is
> completely absent from api.openstack.org btw ;) their client maps from
> name->uuid by:
> - check to see if the identifier matches a uuid pattern, and if not
> - uuid = GET /{tenant_id}/stacks?name={identifier}&fields=id
> - /{tenant_id}/stacks/{uuid}...
>
> cheers
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>




More information about the OpenStack-dev mailing list