def delete_endpoint(self, endpoint_id):
     try:
         ret = self.driver.delete_endpoint(endpoint_id)
         self.get_endpoint.invalidate(self, endpoint_id)
         return ret
     except exception.NotFound:
         raise exception.EndpointNotFound(endpoint_id=endpoint_id)
Beispiel #2
0
 def get_endpoint(self, endpoint_id):
     session = self.get_session()
     endpoint_ref = session.query(Endpoint)
     endpoint_ref = endpoint_ref.filter_by(id=endpoint_id).first()
     if not endpoint_ref:
         raise exception.EndpointNotFound(endpoint_id=endpoint_id)
     return endpoint_ref.to_dict()
Beispiel #3
0
 def delete_endpoint(self, endpoint_id, initiator=None):
     try:
         ret = self.driver.delete_endpoint(endpoint_id)
         notifications.Audit.deleted(self._ENDPOINT, endpoint_id, initiator)
         self.get_endpoint.invalidate(self, endpoint_id)
         return ret
     except exception.NotFound:
         raise exception.EndpointNotFound(endpoint_id=endpoint_id)
Beispiel #4
0
 def delete_endpoint(self, endpoint_id):
     session = self.get_session()
     endpoint_ref = session.query(Endpoint)
     endpoint_ref = endpoint_ref.filter_by(id=endpoint_id).first()
     if not endpoint_ref:
         raise exception.EndpointNotFound(endpoint_id=endpoint_id)
     with session.begin():
         session.delete(endpoint_ref)
         session.flush()
    def delete_endpoint(self, context, endpoint_id):
        """Delete up to three v3 endpoint refs based on a legacy ref ID."""
        self.assert_admin(context)

        deleted_at_least_one = False
        for endpoint in self.catalog_api.list_endpoints():
            if endpoint['legacy_endpoint_id'] == endpoint_id:
                self.catalog_api.delete_endpoint(endpoint['id'])
                deleted_at_least_one = True

        if not deleted_at_least_one:
            raise exception.EndpointNotFound(endpoint_id=endpoint_id)
Beispiel #6
0
    def delete_endpoint(self, request, endpoint_id):
        """Delete up to three v3 endpoint refs based on a legacy ref ID."""
        self.assert_admin(request.context_dict)
        initiator = notifications._get_request_audit_info(request.context_dict)

        deleted_at_least_one = False
        for endpoint in self.catalog_api.list_endpoints():
            if endpoint['legacy_endpoint_id'] == endpoint_id:
                self.catalog_api.delete_endpoint(endpoint['id'], initiator)
                deleted_at_least_one = True

        if not deleted_at_least_one:
            raise exception.EndpointNotFound(endpoint_id=endpoint_id)
Beispiel #7
0
 def get_endpoint(self, endpoint_id):
     try:
         return self.driver.get_endpoint(endpoint_id)
     except exception.NotFound:
         raise exception.EndpointNotFound(endpoint_id=endpoint_id)
Beispiel #8
0
 def _get_endpoint(self, session, endpoint_id):
     try:
         return session.query(Endpoint).filter_by(id=endpoint_id).one()
     except sql.NotFound:
         raise exception.EndpointNotFound(endpoint_id=endpoint_id)
Beispiel #9
0
 def get_endpoint(self, endpoint_id):
     for endpoint in self._list_endpoints():
         if endpoint['id'] == endpoint_id:
             return endpoint
     raise exception.EndpointNotFound(endpoint_id=endpoint_id)
Beispiel #10
0
 def delete_endpoint(self, endpoint_id):
     session = self.get_session()
     with session.begin():
         if not session.query(Endpoint).filter_by(id=endpoint_id).delete():
             raise exception.EndpointNotFound(endpoint_id=endpoint_id)
         session.flush()
Beispiel #11
0
 def delete_endpoint(self, context, endpoint_id):
     try:
         return self.driver.delete_endpoint(endpoint_id)
     except exception.NotFound:
         raise exception.EndpointNotFound(endpoint_id=endpoint_id)