예제 #1
0
파일: base.py 프로젝트: 2013Commons/hue
 def update_connection(self, connection):
   """ Update a connection """
   if not connection.connector:
     connection.connector = self.get_connectors()[0].con_forms
   if not connection.framework:
     connection.framework = self.get_framework().con_forms
   connection.updated = int( round(time.time() * 1000) )
   connection_dict = connection.to_dict()
   request_dict = {
     'all': [connection_dict]
   }
   resp = self._root.put('%s/connection/%d/' % (API_VERSION, connection.id), data=json.dumps(request_dict), headers=self.headers)
   if resp['connector']['status'] in SqoopClient.STATUS_BAD or resp['framework']['status'] in SqoopClient.STATUS_BAD:
     raise SqoopConnectionException.from_dict(resp)
   return connection
예제 #2
0
파일: base.py 프로젝트: ndres/hue
 def update_connection(self, connection):
   """ Update a connection """
   if not connection.connector:
     connection.connector = self.get_connectors()[0].con_forms
   if not connection.framework:
     connection.framework = self.get_framework().con_forms
   connection.updated = int( round(time.time() * 1000) )
   connection_dict = connection.to_dict()
   request_dict = {
     'all': [connection_dict]
   }
   resp = self._root.put('%s/connection/%d/' % (API_VERSION, connection.id), data=json.dumps(request_dict), headers=self.headers)
   if resp['connector']['status'] in SqoopClient.STATUS_BAD or resp['framework']['status'] in SqoopClient.STATUS_BAD:
     raise SqoopConnectionException.from_dict(resp)
   return connection
예제 #3
0
파일: base.py 프로젝트: 2013Commons/hue
 def create_connection(self, connection):
   if not connection.connector:
     connection.connector = self.get_connectors()[0].con_forms
   if not connection.framework:
     connection.framework = self.get_framework().con_forms
   connection.creation_date = int( round(time.time() * 1000) )
   connection.update_date = connection.creation_date
   connection_dict = connection.to_dict()
   request_dict = {
     'all': [connection_dict]
   }
   resp = self._root.post('%s/connection/' % API_VERSION, data=json.dumps(request_dict), headers=self.headers)
   if 'id' not in resp:
     raise SqoopConnectionException.from_dict(resp)
   connection.id = resp['id']
   return connection
예제 #4
0
파일: base.py 프로젝트: ndres/hue
 def create_connection(self, connection):
   if not connection.connector:
     connection.connector = self.get_connectors()[0].con_forms
   if not connection.framework:
     connection.framework = self.get_framework().con_forms
   connection.created = int( round(time.time() * 1000) )
   connection.updated = connection.created
   connection_dict = connection.to_dict()
   request_dict = {
     'all': [connection_dict]
   }
   resp = self._root.post('%s/connection/' % API_VERSION, data=json.dumps(request_dict), headers=self.headers)
   if 'id' not in resp:
     raise SqoopConnectionException.from_dict(resp)
   connection.id = resp['id']
   return connection