Merge "identity: Add support for project endpoints"

This commit is contained in:
Zuul 2024-12-16 19:52:01 +00:00 committed by Gerrit Code Review
commit 3312b90b0f
3 changed files with 32 additions and 1 deletions

View File

@ -42,7 +42,7 @@ Endpoint Operations
.. autoclass:: openstack.identity.v3._proxy.Proxy
:noindex:
:members: create_endpoint, update_endpoint, delete_endpoint, get_endpoint,
find_endpoint, endpoints
find_endpoint, endpoints, project_endpoints
Group Operations
^^^^^^^^^^^^^^^^

View File

@ -414,6 +414,23 @@ class Proxy(proxy.Proxy):
"""
return self._update(_endpoint.Endpoint, endpoint, **attrs)
def project_endpoints(self, project, **query):
"""Retrieve a generator of endpoints which are associated with the
project.
:param project: Either the project ID or an instance of
:class:`~openstack.identity.v3.project.Project`
:param kwargs query: Optional query parameters to be sent to limit
the resources being returned.
:returns: A generator of endpoint instances.
:rtype: :class:`~openstack.identity.v3.endpoint.ProjectEndpoint`
"""
project_id = self._get_resource(_project.Project, project).id
return self._list(
_endpoint.ProjectEndpoint, project_id=project_id, **query
)
# ========== Groups ==========
def create_group(self, **attrs):

View File

@ -57,3 +57,17 @@ class Endpoint(resource.Resource):
service_id = resource.Body('service_id')
#: Fully qualified URL of the service endpoint. *Type: string*
url = resource.Body('url')
class ProjectEndpoint(Endpoint):
base_path = '/OS-EP-FILTER/projects/%(project_id)s/endpoints'
#: The ID for the project from the URI of the resource
project_id = resource.URI('project_id')
# capabilities
allow_create = False
allow_fetch = False
allow_commit = False
allow_delete = False
allow_list = True