diff --git a/doc/source/user/proxies/identity_v3.rst b/doc/source/user/proxies/identity_v3.rst index 64a87f5b6..5e9001212 100644 --- a/doc/source/user/proxies/identity_v3.rst +++ b/doc/source/user/proxies/identity_v3.rst @@ -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 ^^^^^^^^^^^^^^^^ diff --git a/openstack/identity/v3/_proxy.py b/openstack/identity/v3/_proxy.py index 860d994e3..ef8531e0c 100644 --- a/openstack/identity/v3/_proxy.py +++ b/openstack/identity/v3/_proxy.py @@ -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): diff --git a/openstack/identity/v3/endpoint.py b/openstack/identity/v3/endpoint.py index bc58135c2..0fb3fca9d 100644 --- a/openstack/identity/v3/endpoint.py +++ b/openstack/identity/v3/endpoint.py @@ -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