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)
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()
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)
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)
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)
def get_endpoint(self, endpoint_id): try: return self.driver.get_endpoint(endpoint_id) except exception.NotFound: raise exception.EndpointNotFound(endpoint_id=endpoint_id)
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)
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)
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()
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)