xautomata-hive 3.16.6__tar.gz → 3.17.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.
- {xautomata_hive-3.16.6/xautomata_hive.egg-info → xautomata_hive-3.17.0}/PKG-INFO +1 -1
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/api.py +16 -9
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/cost_tags.py +48 -0
- xautomata_hive-3.17.0/hive/version.py +1 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0/xautomata_hive.egg-info}/PKG-INFO +1 -1
- xautomata_hive-3.16.6/hive/version.py +0 -1
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/LICENSE +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/README.md +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/__init__.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/__init__.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/acl_docs.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/acl_overrides.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/analytics.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/anomalies.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/calendars.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/contacts.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/cost_tagging.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/cost_tree_nodes.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/cost_tree_resources.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/cost_views.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/customers.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/dashboards.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/dispatchers.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/downtimes.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/external_tickets.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/features.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/firmware_updates.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/google.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/groups.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/jobs.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/last_status.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/login.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/messages.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/metric_ingest.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/metric_types.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/metrics.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/microsoft.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/notification_provider_types.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/notification_providers.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/objects.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/opening_reasons.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/probe_types.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/probes.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/probes_log_ingest.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/profile_topics.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/reason_for_closure.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/retention_rules.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/schedules.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/services.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/sites.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/terms_and_conditions.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/tree_hierarchy.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/ts_cost_azure_raw.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/ts_cost_management.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/ts_metric_status.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/ts_metric_value.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/ts_ntop_flows.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/ts_service_status.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/ts_service_value.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/users.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/users_notifications.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/virtual_domains.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/webhooks.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/widget_groups.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/widgets.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/decorators.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/exceptions.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/infrastrucure_keys.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/tools.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/setup.cfg +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/setup.py +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/xautomata_hive.egg-info/SOURCES.txt +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/xautomata_hive.egg-info/dependency_links.txt +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/xautomata_hive.egg-info/requires.txt +0 -0
- {xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/xautomata_hive.egg-info/top_level.txt +0 -0
@@ -12,11 +12,13 @@ from hive.infrastrucure_keys import Keys
|
|
12
12
|
import warnings
|
13
13
|
import gc
|
14
14
|
import functools
|
15
|
-
|
15
|
+
import logging
|
16
16
|
|
17
17
|
FORCE_STATUS = [429, 500, 502, 503, 504]
|
18
18
|
# METHODS = ["HEAD", "GET", "OPTIONS", "POST"]
|
19
19
|
|
20
|
+
logger = logging.getLogger('hive')
|
21
|
+
|
20
22
|
|
21
23
|
def get_session(timeout=150, total=5, backoff_factor=5):
|
22
24
|
"""
|
@@ -50,6 +52,7 @@ class ApiManager:
|
|
50
52
|
_timeout_retry = 1 # di default non si fanno retry sui timeout
|
51
53
|
_timeout_sleep_time = 120 # tempo di attesa tra un retry e quello successivo in caso di timeout
|
52
54
|
_silence_warning = False # da implementare
|
55
|
+
num_items = None # serve per quando si mette la count a True, di default vale 0
|
53
56
|
|
54
57
|
def __init__(self, root, user, password, ssl_verify: bool = True):
|
55
58
|
|
@@ -73,6 +76,7 @@ class ApiManager:
|
|
73
76
|
response = get_session(self._timeout, self._timeout_get_session_retry, self._timeout_get_session_backoff_factor).post(f'{self.root}/login/access-token', auth_date, verify=self._SSL_verify)
|
74
77
|
response.raise_for_status()
|
75
78
|
self.token = json.loads(response.content.decode('utf-8'))['access_token']
|
79
|
+
logger.debug('authenticated')
|
76
80
|
|
77
81
|
def openapi(self):
|
78
82
|
"""metodo che restituisce gli schema degli end point"""
|
@@ -157,20 +161,23 @@ class ApiManager:
|
|
157
161
|
@timeout_retry(max_tries=self._timeout_retry, sleep_time=self._timeout_sleep_time)
|
158
162
|
@ratelimiter
|
159
163
|
def run_request(_mode, _url, _headers, _payload, _params, **_kwargs):
|
164
|
+
self.num_items = None # inizializzo a 0 il valore della count, cosi che non possa leggere il numero sbagliato dopo una richiesta non corretta
|
165
|
+
|
166
|
+
logger.debug(f'request url: {_url}')
|
167
|
+
logger.debug(f'request params (skip and limit may differ from your setting due pagination): {_params}')
|
168
|
+
logger.debug(f'request payload: {_payload}')
|
169
|
+
|
160
170
|
response = get_session(self._timeout, self._timeout_get_session_retry, self._timeout_get_session_backoff_factor).request(_mode, url=_url, json=_payload, params=_params, headers=_headers, verify=self._SSL_verify, **_kwargs)
|
161
171
|
if response.status_code == 401: raise UnauthorizedException
|
162
172
|
if response.status_code != 200 and response.status_code != 504: # 504 non e' gestito dalle API per cui la responce non sarebbe json serializable
|
163
|
-
|
164
|
-
print('-' * 50)
|
165
|
-
print('error message:')
|
166
|
-
print(response.json())
|
167
|
-
print('-' * 50)
|
168
|
-
print()
|
173
|
+
logger.error(response.json())
|
169
174
|
response.raise_for_status()
|
170
175
|
|
171
176
|
if response.status_code == 200 and _params.get('count', False):
|
172
|
-
num_items = response.headers.get('x-num-items',
|
173
|
-
|
177
|
+
self.num_items = response.headers.get('x-num-items', None)
|
178
|
+
|
179
|
+
logger.debug(f'responce: {response.json()}')
|
180
|
+
logger.debug(f'header: {response.headers}')
|
174
181
|
|
175
182
|
return response.json()
|
176
183
|
|
@@ -74,6 +74,54 @@ class CostTags(ApiManager):
|
|
74
74
|
payload, **kwargs)
|
75
75
|
return response
|
76
76
|
|
77
|
+
def cost_tags_query(self, warm_start: bool = False,
|
78
|
+
single_page: bool = False, page_size: int = 5000,
|
79
|
+
kwargs: dict = None, **params) -> list:
|
80
|
+
"""Read Cost Tags
|
81
|
+
|
82
|
+
Args:
|
83
|
+
warm_start (bool, optional): salva la risposta in un file e se viene richiamata la stessa funzione con gli stessi argomenti restituisce il contenuto del file. Default to False.
|
84
|
+
single_page (bool, optional): se False la risposta viene ottenuta a step per non appesantire le API. Default to False.
|
85
|
+
page_size (int, optional): Numero di oggetti per pagina se single_page == False. Default to 5000.
|
86
|
+
kwargs (dict, optional): additional parameters for execute. Default to None.
|
87
|
+
**params: additional parameters for the API.
|
88
|
+
|
89
|
+
Keyword Args:
|
90
|
+
date_start (string required): additional filter - parameter
|
91
|
+
date_end (string required): additional filter - parameter
|
92
|
+
select_operation (None required): additional filter - parameter
|
93
|
+
selected_tags (string required): additional filter - parameter
|
94
|
+
unselect_operation (None optional): additional filter - parameter
|
95
|
+
unselected_tags (string optional): additional filter - parameter
|
96
|
+
sort_by (string optional): Stringa separata da virgole di campi su cui ordinare. Si indica uno o piu campi della risposta e si puo chiedere di ottenere i valori di quei campi in ordine ascendente o discendente. Esempio "Customer:Desc". Default to "". - parameter
|
97
|
+
null_fields (string optional): additional filter - parameter
|
98
|
+
skip (integer optional): numero di oggetti che si vogliono saltare nella risposta. Default to 0. - parameter
|
99
|
+
limit (integer optional): numero di oggetti massimi che si vogliono ottenere. Default to 1_000_000. - parameter
|
100
|
+
like (boolean optional): Se True, eventuali filtri richiesti dalla API vengono presi come porzioni di testo, se False il matching sul campo dei filtri deve essere esatto. Default to True. - parameter
|
101
|
+
join (boolean optional): Se join = true, ogni riga restituita conterra' chiavi aggiuntive che fanno riferimento ad altre entita', con cui la riga ha relazioni 1:1. Default to False - parameter
|
102
|
+
count (boolean optional): Se True nel header della risposta e' presente la dimensione massima a db della chiamata fatta, sconsigliabile perche raddoppia il tempo per chiamata. Default to False. - parameter
|
103
|
+
|
104
|
+
Returns: list"""
|
105
|
+
if kwargs is None:
|
106
|
+
kwargs = dict()
|
107
|
+
official_params_list = ['date_start', 'date_end',
|
108
|
+
'select_operation', 'selected_tags', 'unselect_operation',
|
109
|
+
'unselected_tags', 'sort_by', 'null_fields', 'skip', 'limit',
|
110
|
+
'like', 'join', 'count']
|
111
|
+
params.get('date_start'), params.get('date_end'), params.get(
|
112
|
+
'select_operation'), params.get('selected_tags'), params.get(
|
113
|
+
'unselect_operation'), params.get('unselected_tags'), params.get(
|
114
|
+
'sort_by'), params.get('null_fields'), params.get('skip'
|
115
|
+
), params.get('limit'), params.get('like'), params.get('join'
|
116
|
+
), params.get('count')
|
117
|
+
if not self._silence_warning:
|
118
|
+
warning_wrong_parameters(self.cost_tags_query.__name__, params,
|
119
|
+
official_params_list)
|
120
|
+
response = self.execute('GET', path=f'/cost_tags/query/',
|
121
|
+
single_page=single_page, page_size=page_size, warm_start=
|
122
|
+
warm_start, params=params, **kwargs)
|
123
|
+
return response
|
124
|
+
|
77
125
|
def cost_tag(self, uuid: str, warm_start: bool = False,
|
78
126
|
kwargs: dict = None, **params) -> list:
|
79
127
|
"""Read Cost Tag
|
@@ -0,0 +1 @@
|
|
1
|
+
version = '3.17.0'
|
@@ -1 +0,0 @@
|
|
1
|
-
version = '3.16.6'
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/hive/cookbook/notification_provider_types.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{xautomata_hive-3.16.6 → xautomata_hive-3.17.0}/xautomata_hive.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|