Add API extension "security-groups-shared-filtering"
Add API extension "security-groups-shared-filtering". This extension adds the "shared" field to security groups and allows users to filter security groups based on the "shared" field. Related-Bug: #1942615 Change-Id: Idba0af5a6ee1a2a8c02db51be197988d23412f0f
This commit is contained in:
parent
f9b428667b
commit
916326df38
@ -1365,6 +1365,13 @@ router:external-query:
|
||||
in: query
|
||||
required: false
|
||||
type: boolean
|
||||
security_group-shared-query:
|
||||
description: |
|
||||
Filter the security group list result based on if the security group is
|
||||
shared to the requestor's project.
|
||||
in: query
|
||||
required: false
|
||||
type: boolean
|
||||
security_group-sort_key:
|
||||
description: |
|
||||
Sorts by a security group attribute. You can specify multiple pairs of
|
||||
@ -6155,6 +6162,12 @@ security_group-id:
|
||||
in: body
|
||||
required: true
|
||||
type: string
|
||||
security_group-shared-response:
|
||||
description: |
|
||||
Indicates whether this security group is shared to the requestor's project.
|
||||
in: body
|
||||
required: true
|
||||
type: boolean
|
||||
security_group_id:
|
||||
description: |
|
||||
The security group UUID to associate with this
|
||||
|
@ -48,6 +48,7 @@
|
||||
"revision_number": 1,
|
||||
"tags": ["tag1,tag2"],
|
||||
"tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
|
||||
"stateful": true
|
||||
"stateful": true,
|
||||
"shared": false
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,7 @@
|
||||
"revision_number": 4,
|
||||
"tags": ["tag1,tag2"],
|
||||
"tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
|
||||
"stateful": true
|
||||
"stateful": true,
|
||||
"shared": false
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
"name": "mysecgroup",
|
||||
"description": "my security group",
|
||||
"tags": ["tag1,tag2"],
|
||||
"stateful": true
|
||||
"stateful": true,
|
||||
"shared": false
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,8 @@
|
||||
"updated_at": "2018-03-19T19:16:56Z",
|
||||
"tags": ["tag1,tag2"],
|
||||
"tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550",
|
||||
"stateful": true
|
||||
"stateful": true,
|
||||
"shared": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -29,6 +29,13 @@ or stateless security groups for ``ports``. The existing security groups
|
||||
will all be considered as stateful. Update of the ``stateful`` attribute is
|
||||
allowed when there is no port associated with the security group.
|
||||
|
||||
Shared filtering extension
|
||||
==========================
|
||||
|
||||
The ``security-groups-shared-filtering`` extension adds the ``shared`` field
|
||||
to security groups and allows users to filter security groups based on the
|
||||
``shared`` field.
|
||||
|
||||
List security groups
|
||||
====================
|
||||
|
||||
@ -62,6 +69,7 @@ Request
|
||||
- description: description-query
|
||||
- sort_dir: sort_dir
|
||||
- sort_key: security_group-sort_key
|
||||
- shared: security_group-shared-query
|
||||
- tags: tags-query
|
||||
- tags-any: tags-any-query
|
||||
- not-tags: not-tags-query
|
||||
@ -85,6 +93,7 @@ Response Parameters
|
||||
- security_group_rules: security_group_rules
|
||||
- tags: tags
|
||||
- stateful: stateful_enabled
|
||||
- shared: security_group-shared-response
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
@ -141,6 +150,7 @@ Response Parameters
|
||||
- security_group_rules: security_group_rules
|
||||
- tags: tags
|
||||
- stateful: stateful_enabled
|
||||
- shared: security_group-shared-response
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
@ -193,6 +203,7 @@ Response Parameters
|
||||
- security_group_rules: security_group_rules
|
||||
- tags: tags
|
||||
- stateful: stateful_enabled
|
||||
- shared: security_group-shared-response
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
@ -244,6 +255,7 @@ Response Parameters
|
||||
- security_group_rules: security_group_rules
|
||||
- tags: tags
|
||||
- stateful: stateful_enabled
|
||||
- shared: security_group-shared-response
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
|
@ -119,6 +119,7 @@ from neutron_lib.api.definitions import routerservicetype
|
||||
from neutron_lib.api.definitions import security_groups_normalized_cidr
|
||||
from neutron_lib.api.definitions import security_groups_port_filtering
|
||||
from neutron_lib.api.definitions import security_groups_remote_address_group
|
||||
from neutron_lib.api.definitions import security_groups_shared_filtering
|
||||
from neutron_lib.api.definitions import segment
|
||||
from neutron_lib.api.definitions import segments_peer_subnet_host_routes
|
||||
from neutron_lib.api.definitions import servicetype
|
||||
@ -255,6 +256,7 @@ _ALL_API_DEFINITIONS = {
|
||||
security_groups_normalized_cidr,
|
||||
security_groups_port_filtering,
|
||||
security_groups_remote_address_group,
|
||||
security_groups_shared_filtering,
|
||||
segment,
|
||||
segments_peer_subnet_host_routes,
|
||||
servicetype,
|
||||
|
@ -0,0 +1,66 @@
|
||||
# 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 import converters
|
||||
from neutron_lib import constants
|
||||
|
||||
|
||||
# The alias of the extension.
|
||||
ALIAS = 'security-groups-shared-filtering'
|
||||
|
||||
IS_SHIM_EXTENSION = False
|
||||
|
||||
IS_STANDARD_ATTR_EXTENSION = False
|
||||
|
||||
# The name of the extension.
|
||||
NAME = 'Security group filtering on the shared field'
|
||||
|
||||
# The description of the extension.
|
||||
DESCRIPTION = "Support filtering security groups on the shared field"
|
||||
|
||||
# A timestamp of when the extension was introduced.
|
||||
UPDATED_TIMESTAMP = "2021-10-05T09:00:00-00:00"
|
||||
|
||||
# The resource attribute map for the extension.
|
||||
RESOURCE_ATTRIBUTE_MAP = {
|
||||
'security_groups': {
|
||||
constants.SHARED: {
|
||||
'allow_post': False,
|
||||
'allow_put': False,
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'is_visible': True,
|
||||
'is_filter': True,
|
||||
'required_by_policy': True,
|
||||
'enforce_policy': True,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# The subresource attribute map for the extension.
|
||||
SUB_RESOURCE_ATTRIBUTE_MAP = {
|
||||
}
|
||||
|
||||
# The action map.
|
||||
ACTION_MAP = {
|
||||
}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = ['rbac-security-groups']
|
||||
|
||||
# The list of optional extensions.
|
||||
OPTIONAL_EXTENSIONS = [
|
||||
]
|
@ -0,0 +1,23 @@
|
||||
# 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 security_groups_shared_filtering
|
||||
from neutron_lib import constants
|
||||
from neutron_lib.tests.unit.api.definitions import base
|
||||
|
||||
|
||||
class SecurityGroupsSharedFilteringDefinitionTestCase(
|
||||
base.DefinitionBaseTestCase):
|
||||
|
||||
extension_module = security_groups_shared_filtering
|
||||
extension_resources = ('security_groups',)
|
||||
extension_attributes = (constants.SHARED,)
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add API extension ``security-groups-shared-filtering``. This extension
|
||||
adds the ``shared`` field to security groups and allows users to filter
|
||||
security groups based on the ``shared`` field.
|
Loading…
x
Reference in New Issue
Block a user