[openstack-dev] Specifying Tenant-ID in Openstack REST API URLs and Quatum 2.0 APIs
Steve Baker
sbaker at redhat.com
Sun Nov 11 20:41:59 UTC 2012
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}
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20121112/87790b2a/attachment.html>
More information about the OpenStack-dev
mailing list