Add API extension `tag-creation`
The ``tag-creation`` shim extension API definition enables the creation of multiple tags for a single resource using a ``POST`` request. The value of the tags is passed as an argument of the call. Related-Bug: #2073836 Change-Id: I8b7ac688f7aed64995b3c244b0a3662aa81313bc
This commit is contained in:
6
api-ref/source/v2/samples/tag/tag-create-request.json
Normal file
6
api-ref/source/v2/samples/tag/tag-create-request.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"tags": [
|
||||||
|
"red",
|
||||||
|
"blue"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -17,6 +17,32 @@ standard attributes. This includes networks, ports, subnets, subnet pools,
|
|||||||
floating IPs, routers, security groups, security group rules, QoS policies and
|
floating IPs, routers, security groups, security group rules, QoS policies and
|
||||||
trunks.
|
trunks.
|
||||||
|
|
||||||
|
Create tags
|
||||||
|
===========
|
||||||
|
|
||||||
|
.. rest_method:: POST /v2.0/{resource_type}/{resource_id}/tags
|
||||||
|
|
||||||
|
Creates multiple tags for a resource.
|
||||||
|
|
||||||
|
Normal response codes: 200
|
||||||
|
|
||||||
|
Error response codes: 400, 401, 403
|
||||||
|
|
||||||
|
Request
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. rest_parameters:: parameters.yaml
|
||||||
|
|
||||||
|
- resource_type: resource_type
|
||||||
|
- resource_id: resource_id
|
||||||
|
- tags: tags
|
||||||
|
|
||||||
|
Request Example
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. literalinclude:: samples/tag/tag-create-request.json
|
||||||
|
:language: javascript
|
||||||
|
|
||||||
Replace all tags
|
Replace all tags
|
||||||
================
|
================
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ from neutron_lib.api.definitions import subnet_service_types
|
|||||||
from neutron_lib.api.definitions import subnetpool
|
from neutron_lib.api.definitions import subnetpool
|
||||||
from neutron_lib.api.definitions import subnetpool_prefix_ops
|
from neutron_lib.api.definitions import subnetpool_prefix_ops
|
||||||
from neutron_lib.api.definitions import taas
|
from neutron_lib.api.definitions import taas
|
||||||
|
from neutron_lib.api.definitions import tag_creation
|
||||||
from neutron_lib.api.definitions import tag_ports_during_bulk_creation
|
from neutron_lib.api.definitions import tag_ports_during_bulk_creation
|
||||||
from neutron_lib.api.definitions import tap_mirror
|
from neutron_lib.api.definitions import tap_mirror
|
||||||
from neutron_lib.api.definitions import trunk
|
from neutron_lib.api.definitions import trunk
|
||||||
@@ -311,6 +312,7 @@ _ALL_API_DEFINITIONS = {
|
|||||||
subnetpool,
|
subnetpool,
|
||||||
subnetpool_prefix_ops,
|
subnetpool_prefix_ops,
|
||||||
taas,
|
taas,
|
||||||
|
tag_creation,
|
||||||
tag_ports_during_bulk_creation,
|
tag_ports_during_bulk_creation,
|
||||||
tap_mirror,
|
tap_mirror,
|
||||||
trunk,
|
trunk,
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ KNOWN_EXTENSIONS = (
|
|||||||
'subnet-segmentid-enforce',
|
'subnet-segmentid-enforce',
|
||||||
'subnet-segmentid-writable',
|
'subnet-segmentid-writable',
|
||||||
'tag',
|
'tag',
|
||||||
|
'tag-creation',
|
||||||
'trunk',
|
'trunk',
|
||||||
'trunk-details',
|
'trunk-details',
|
||||||
# Add here list of extensions with pointers to the project repo, e.g.
|
# Add here list of extensions with pointers to the project repo, e.g.
|
||||||
|
|||||||
28
neutron_lib/api/definitions/tag_creation.py
Normal file
28
neutron_lib/api/definitions/tag_creation.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Copyright 2024 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
ALIAS = 'tag-creation'
|
||||||
|
IS_SHIM_EXTENSION = True
|
||||||
|
IS_STANDARD_ATTR_EXTENSION = False
|
||||||
|
NAME = 'Tag creation extension'
|
||||||
|
DESCRIPTION = 'Allow to create multiple tags for a resource'
|
||||||
|
UPDATED_TIMESTAMP = '2024-23-07T10:00:00-00:00'
|
||||||
|
RESOURCE_ATTRIBUTE_MAP = {}
|
||||||
|
SUB_RESOURCE_ATTRIBUTE_MAP = {}
|
||||||
|
ACTION_MAP = {}
|
||||||
|
REQUIRED_EXTENSIONS = []
|
||||||
|
OPTIONAL_EXTENSIONS = []
|
||||||
|
ACTION_STATUS = {}
|
||||||
21
neutron_lib/tests/unit/api/definitions/test_tag_creation.py
Normal file
21
neutron_lib/tests/unit/api/definitions/test_tag_creation.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Copyright 2024 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
from neutron_lib.api.definitions import tag_creation
|
||||||
|
from neutron_lib.tests.unit.api.definitions import base
|
||||||
|
|
||||||
|
|
||||||
|
class TagCreationDefinitionTestCase(base.DefinitionBaseTestCase):
|
||||||
|
extension_module = tag_creation
|
||||||
5
releasenotes/notes/tag-creation-1ba476d17e3de502.yaml
Normal file
5
releasenotes/notes/tag-creation-1ba476d17e3de502.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- The ``tag-creation`` shim extension API definition enables the creation
|
||||||
|
of multiple tags for a single resource using a ``POST`` request. The value
|
||||||
|
of the tags is passed as an argument of the call.
|
||||||
Reference in New Issue
Block a user