diff options
author | Kristofer Hallin <kristofer@sunet.se> | 2022-04-07 14:12:35 +0200 |
---|---|---|
committer | Kristofer Hallin <kristofer@sunet.se> | 2022-04-07 14:12:35 +0200 |
commit | 208089fa95e63d6e29e7a1d86726bfec804de211 (patch) | |
tree | d5ed8e7de790940ade6b46dcb48e126d7357733d /src/db/index.py | |
parent | 9d72acbb816c6040b608c63f18b8dbb169ceb2c3 (diff) |
Moved everything database related to db/.
Diffstat (limited to 'src/db/index.py')
-rw-r--r-- | src/db/index.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/db/index.py b/src/db/index.py new file mode 100644 index 0000000..688ceeb --- /dev/null +++ b/src/db/index.py @@ -0,0 +1,61 @@ +from pydantic import BaseSettings + + +class CouchIindex(BaseSettings): + domain: dict = { + "index": { + "fields": [ + "domain", + ] + }, + "name": "domain-json-index", + "type": "json" + } + ip: dict = { + "index": { + "fields": [ + "domain", + "ip" + ] + }, + "name": "ip-json-index", + "type": "json" + } + port: dict = { + "index": { + "fields": [ + "domain", + "port" + ] + }, + "name": "port-json-index", + "type": "json" + } + asn: dict = { + "index": { + "fields": [ + "domain", + "asn" + ] + }, + "name": "asn-json-index", + "type": "json" + } + asn_country_code: dict = { + "index": { + "fields": [ + "domain", + "asn_country_code" + ] + }, + "name": "asn-country-code-json-index", + "type": "json" + } + + +def as_list(): + index_list = list() + for item in CouchIindex().dict(): + index_list.append(CouchIindex().dict()[item]) + + return index_list |