This class is designed for interacting with the primary MongoDB
| 20 | |
| 21 | |
| 22 | class MongoConnector(MongoConnectorBase): |
| 23 | """ |
| 24 | This class is designed for interacting with the primary MongoDB |
| 25 | """ |
| 26 | |
| 27 | mongo_config_file = "connector.config" |
| 28 | m_connection = None |
| 29 | _logger = None |
| 30 | |
| 31 | def _log(self): |
| 32 | """ |
| 33 | Get the log |
| 34 | """ |
| 35 | return logging.getLogger(__name__) |
| 36 | |
| 37 | def __init__(self, config_file="", log_level=None): |
| 38 | """ |
| 39 | Initialize the instance |
| 40 | """ |
| 41 | self._logger = self._log() |
| 42 | |
| 43 | if log_level is not None: |
| 44 | self._logger.setLevel(log_level) |
| 45 | |
| 46 | if config_file != "": |
| 47 | self.mongo_config_file = config_file |
| 48 | |
| 49 | m_base = MongoConnectorBase(config_file, "MongoDB", log_level) |
| 50 | self.m_connection = m_base.m_connection |
| 51 | |
| 52 | def get_akamai_ips_connection(self): |
| 53 | """Returns a connection to the akamai_ips collection in MongoDB""" |
| 54 | return self.m_connection.akamai_ips |
| 55 | |
| 56 | def get_all_dns_connection(self): |
| 57 | """Returns a connection to the all_dns collection in MongoDB""" |
| 58 | return self.m_connection.all_dns |
| 59 | |
| 60 | def get_all_ips_connection(self): |
| 61 | """Returns a connection to the all_ips collection in MongoDB""" |
| 62 | return self.m_connection.all_ips |
| 63 | |
| 64 | def get_aws_ips_connection(self): |
| 65 | """Returns a connection to the aws_ips collection in MongoDB""" |
| 66 | return self.m_connection.aws_ips |
| 67 | |
| 68 | def get_azure_ips_connection(self): |
| 69 | """Returns a connection to the zure_ips collection in MongoDB""" |
| 70 | return self.m_connection.azure_ips |
| 71 | |
| 72 | def get_censys_connection(self): |
| 73 | """Returns a connection to the censys collection in MongoDB""" |
| 74 | return self.m_connection.censys |
| 75 | |
| 76 | def get_cert_graphs_connection(self): |
| 77 | """Returns a connection to the cert_graphs collection in MongoDB""" |
| 78 | return self.m_connection.cert_graphs |
| 79 |
nothing calls this directly
no outgoing calls
no test coverage detected