-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into reaqta_connector
- Loading branch information
Showing
6 changed files
with
40 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import datetime | ||
import json | ||
from stix_shifter_utils.modules.base.stix_transmission.base_sync_connector import BaseSyncConnector | ||
from .api_client import APIClient | ||
from stix_shifter_utils.utils.error_response import ErrorResponder | ||
from stix_shifter_utils.utils import logger | ||
|
||
|
||
class Connector(BaseSyncConnector): | ||
|
||
def __init__(self, connection, configuration): | ||
self.api_client = APIClient(connection, configuration) | ||
self.logger = logger.set_logger(__name__) | ||
self.connector = __name__.split('.')[1] | ||
|
||
def ping_connection(self): | ||
response = self.api_client.ping_data_source() | ||
response_code = response.get('code') | ||
response_txt = response.get('message') | ||
return_obj = dict() | ||
return_obj['success'] = False | ||
|
||
if len(response) > 0 and response_code == 200: | ||
return_obj['success'] = True | ||
else: | ||
ErrorResponder.fill_error(return_obj, response, ['message'], error=response_txt, connector=self.connector) | ||
return return_obj | ||
|
||
def create_results_connection(self, query, offset, length): | ||
return_obj = dict() | ||
response = self.api_client.run_search(query, start=offset, rows=length) | ||
response_code = response.get('code') | ||
response_txt = response.get('message') | ||
if response_code == 200: | ||
return_obj['success'] = True | ||
return_obj['data'] = response.get('result') | ||
else: | ||
ErrorResponder.fill_error(return_obj, response, ['message'], error=response_txt, connector=self.connector) | ||
return return_obj |
10 changes: 0 additions & 10 deletions
10
stix_shifter_modules/mysql/stix_transmission/delete_connector.py
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
stix_shifter_modules/mysql/stix_transmission/ping_connector.py
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
stix_shifter_modules/mysql/stix_transmission/results_connector.py
This file was deleted.
Oops, something went wrong.
Empty file.