Esempio n. 1
0
 def create_endpoint(self, endpoint_id, endpoint_ref):
     try:
         return self.driver.create_endpoint(endpoint_id, endpoint_ref)
     except exception.NotFound:
         service_id = endpoint_ref.get('service_id')
         raise exception.ServiceNotFound(service_id=service_id)
 def _get_service(self, session, service_id):
     ref = session.query(Service).get(service_id)
     if not ref:
         raise exception.ServiceNotFound(service_id=service_id)
     return ref
Esempio n. 3
0
 def delete_service(self, service_id):
     try:
         return self.driver.delete_service(service_id)
     except exception.NotFound:
         raise exception.ServiceNotFound(service_id=service_id)
Esempio n. 4
0
 def get_service(self, service_id):
     for service in self._list_services(hints=None):
         if service['id'] == service_id:
             return service
     raise exception.ServiceNotFound(service_id=service_id)
Esempio n. 5
0
 def get_service(self, context, service_id):
     try:
         return self.driver.get_service(service_id)
     except exception.NotFound:
         raise exception.ServiceNotFound(service_id=service_id)
Esempio n. 6
0
 def _get_service(self, session, service_id):
     try:
         return session.query(Service).filter_by(id=service_id).one()
     except sql.NotFound:
         raise exception.ServiceNotFound(service_id=service_id)
Esempio n. 7
0
 def get_service(self, service_id):
     session = self.get_session()
     service_ref = session.query(Service).filter_by(id=service_id).first()
     if not service_ref:
         raise exception.ServiceNotFound(service_id=service_id)
     return service_ref.to_dict()