brynq-sdk-elastic 1.0.0__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/PKG-INFO +1 -1
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk/elastic/elastic.py +28 -10
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk_elastic.egg-info/PKG-INFO +1 -1
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/setup.py +1 -1
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk/elastic/__init__.py +0 -0
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk_elastic.egg-info/SOURCES.txt +0 -0
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk_elastic.egg-info/dependency_links.txt +0 -0
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk_elastic.egg-info/not-zip-safe +0 -0
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk_elastic.egg-info/requires.txt +0 -0
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk_elastic.egg-info/top_level.txt +0 -0
- {brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/setup.cfg +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import warnings
|
|
1
2
|
import requests
|
|
2
3
|
import json
|
|
3
4
|
import datetime
|
|
@@ -15,17 +16,34 @@ class Elastic:
|
|
|
15
16
|
"""
|
|
16
17
|
try:
|
|
17
18
|
self.verify = False
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
self.client_user = os.getenv('BRYNQ_CUSTOMER_NAME', 'default').lower().replace(' ', '_') if customer_name is None else customer_name.lower().replace(' ', '_')
|
|
19
|
+
elasticsearch_host = os.getenv("ELASTIC_HOST", "localhost")
|
|
20
|
+
elasticsearch_port = os.getenv("ELASTIC_PORT", "9200")
|
|
21
|
+
kibana_port = os.getenv("KIBANA_PORT", "5601")
|
|
22
|
+
elastic_token = os.getenv('ELASTIC_API_KEY', None)
|
|
23
|
+
|
|
24
|
+
# Build the host URLs
|
|
25
|
+
self.elasticsearch_host = f'https://{elasticsearch_host}:{elasticsearch_port}'
|
|
26
|
+
self.kibana_host = f'http://{elasticsearch_host}:{kibana_port}'
|
|
27
|
+
self.elastic_token = elastic_token if elastic_token is not None else api_key
|
|
28
28
|
self.space_name = os.getenv('ELASTIC_SPACE', 'default') if space_name is None else space_name
|
|
29
|
+
self.client_user = os.getenv('BRYNQ_SUBDOMAIN', 'default').lower().replace(' ', '_') if customer_name is None else customer_name.lower().replace(' ', '_')
|
|
30
|
+
|
|
31
|
+
# Check for missing environment variables and show warnings
|
|
32
|
+
if elasticsearch_host == "localhost":
|
|
33
|
+
warnings.warn("Environment variable ELASTIC_HOST is not set. Using default: localhost")
|
|
34
|
+
if elasticsearch_port == "9200":
|
|
35
|
+
warnings.warn("Environment variable ELASTIC_PORT is not set. Using default: 9200")
|
|
36
|
+
if kibana_port == "5601":
|
|
37
|
+
warnings.warn("Environment variable KIBANA_PORT is not set. Using default: 5601")
|
|
38
|
+
if elastic_token is None:
|
|
39
|
+
raise KeyError("Environment variable ELASTIC_API_KEY is not set and no api_key is provided. Please specify either one and try again")
|
|
40
|
+
if self.space_name == 'default':
|
|
41
|
+
warnings.warn("Environment variable ELASTIC_SPACE is not set. Using 'default'")
|
|
42
|
+
if self.client_user == 'default':
|
|
43
|
+
warnings.warn("Environment variable BRYNQ_SUBDOMAIN is not set and customer_name is not specified. Using 'default'")
|
|
44
|
+
|
|
45
|
+
print(f"Elasticsearch running on: {elasticsearch_host}")
|
|
46
|
+
|
|
29
47
|
self.timestamp = int(datetime.datetime.now().timestamp())
|
|
30
48
|
self.elastic_headers = {
|
|
31
49
|
'Content-Type': 'application/json',
|
|
File without changes
|
|
File without changes
|
{brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk_elastic.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{brynq_sdk_elastic-1.0.0 → brynq_sdk_elastic-2.0.0}/brynq_sdk_elastic.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|