[api][neutron] tagging support when creating a resource
Hi API-SIG, neutron and tagging-related folks, This email ask opinions on tagging when creating a resource. We received a feature request to support tagging when creating a resource [1]. Neutron supports bulk creation of resources but the current tagging API recommended by the API-SIG does not define tagging when creating a resource. As a result, if we want to create 100 ports with specific tags, we need 1 (bulk creation) +100 (taggins per resource) API calls. It sounds nice to me to support tagging when creating a resource to address the above problem. What in my mind is to specify 'tags' attribute in a body of POST request like: {'port': {'name': 'foo', 'network_id': <network-id>, 'tags': ['red', 'blue'] } } I don't know the reason why the current API-SIG recommended tagging API does not support this model. The current tagging API defines "tags" as a subresource. Is there any reason this model was adopted? Best Regards, Akihiro Motoki (irc: amotoki) [1] https://bugs.launchpad.net/neutron/+bug/1815933 [RFE] Allow bulk-tagging of resources [2] https://specs.openstack.org/openstack/api-wg/guidelines/tags.html
On 02/25/2019 08:36 AM, Akihiro Motoki wrote:
Hi API-SIG, neutron and tagging-related folks,
This email ask opinions on tagging when creating a resource.
We received a feature request to support tagging when creating a resource [1]. Neutron supports bulk creation of resources but the current tagging API recommended by the API-SIG does not define tagging when creating a resource. As a result, if we want to create 100 ports with specific tags, we need 1 (bulk creation) +100 (taggins per resource) API calls.
It sounds nice to me to support tagging when creating a resource to address the above problem. What in my mind is to specify 'tags' attribute in a body of POST request like:
{'port': {'name': 'foo', 'network_id': <network-id>, 'tags': ['red', 'blue'] } }
I don't know the reason why the current API-SIG recommended tagging API does not support this model. The current tagging API defines "tags" as a subresource.
I think you're asking why the API working group's guidelines on tags don't have an example of setting one or more tags for some resource at the same time as the resource's creation? Probably just a simple oversight, frankly. The Compute API @ version 2.52 allows setting tags on a server instance (the main HTTP resource) on creation using exactly the same format that you describe above: https://developer.openstack.org/api-ref/compute/?expanded=create-server-deta... Best, -jay
On Feb 25, 2019, at 7:36 AM, Akihiro Motoki <amotoki@gmail.com> wrote:
It sounds nice to me to support tagging when creating a resource to address the above problem. What in my mind is to specify 'tags' attribute in a body of POST request like:
{'port': {'name': 'foo', 'network_id': <network-id>, 'tags': ['red', 'blue'] } }
I don't know the reason why the current API-SIG recommended tagging API does not support this model. The current tagging API defines "tags" as a subresource. Is there any reason this model was adopted?
Tags are strings attached to resources, so there really should be no difference when creating a resource with tags than when creating a resource with a name. The part of the guideline for modifying tags assumes that the resource already exists. We could certainly add additional wording that clarifies that resources can be created with tags; there certainly isn’t anything in the current guideline that says they can’t. -- Ed Leafe
Ed, Jay, Thanks for the responses. We wanted to make sure we weren't breaking any community wide API guidelines Regards Miguel On Mon, Feb 25, 2019 at 11:26 AM Ed Leafe <ed@leafe.com> wrote:
On Feb 25, 2019, at 7:36 AM, Akihiro Motoki <amotoki@gmail.com> wrote:
It sounds nice to me to support tagging when creating a resource to
What in my mind is to specify 'tags' attribute in a body of POST request
address the above problem. like:
{'port': {'name': 'foo', 'network_id': <network-id>, 'tags': ['red', 'blue'] } }
I don't know the reason why the current API-SIG recommended tagging API
does
not support this model. The current tagging API defines "tags" as a subresource. Is there any reason this model was adopted?
Tags are strings attached to resources, so there really should be no difference when creating a resource with tags than when creating a resource with a name. The part of the guideline for modifying tags assumes that the resource already exists.
We could certainly add additional wording that clarifies that resources can be created with tags; there certainly isn’t anything in the current guideline that says they can’t.
-- Ed Leafe
On Tue, Feb 26, 2019 at 2:25 AM Ed Leafe <ed@leafe.com> wrote:
On Feb 25, 2019, at 7:36 AM, Akihiro Motoki <amotoki@gmail.com> wrote:
It sounds nice to me to support tagging when creating a resource to
What in my mind is to specify 'tags' attribute in a body of POST request
address the above problem. like:
{'port': {'name': 'foo', 'network_id': <network-id>, 'tags': ['red', 'blue'] } }
I don't know the reason why the current API-SIG recommended tagging API
does
not support this model. The current tagging API defines "tags" as a subresource. Is there any reason this model was adopted?
Tags are strings attached to resources, so there really should be no difference when creating a resource with tags than when creating a resource with a name. The part of the guideline for modifying tags assumes that the resource already exists.
We could certainly add additional wording that clarifies that resources can be created with tags; there certainly isn’t anything in the current guideline that says they can’t.
Thanks Ed and Jay. As Miguel mentioned, we the neutron team would like to align the community-wide guideline. I agree that we can add some additional notes in the API-SIG docs. In addition, we can also use the similar syntax in PUT/PATCH operation to update existing tags of a resource. This would simplify the implementation of SDKs (from my experience of implementing the tag support in OpenStackSDK). {'port': {'tags': ['red', 'blue'] } } Best Regards, Akihiro Motoki
-- Ed Leafe
On Mar 1, 2019, at 7:56 AM, Akihiro Motoki <amotoki@gmail.com> wrote:
Thanks Ed and Jay. As Miguel mentioned, we the neutron team would like to align the community-wide guideline. I agree that we can add some additional notes in the API-SIG docs.
The proposed addition to the guidelines has been posted for review: https://review.openstack.org/#/c/642497/ -- Ed Leafe
participants (4)
-
Akihiro Motoki
-
Ed Leafe
-
Jay Pipes
-
Miguel Lavalle