xautomata-hive 3.20.2__py3-none-any.whl → 3.22.0__py3-none-any.whl
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.
- hive/api.py +10 -5
- hive/cookbook/calendars.py +27 -0
- hive/cookbook/cost_tree_nodes.py +1 -34
- hive/cookbook/cost_tree_resources.py +17 -80
- hive/cookbook/customers.py +72 -53
- hive/cookbook/groups.py +2 -96
- hive/cookbook/last_object_status.py +1 -1
- hive/cookbook/last_status.py +1 -1
- hive/cookbook/metric_types.py +1 -50
- hive/cookbook/metrics.py +1 -50
- hive/cookbook/objects.py +1 -47
- hive/cookbook/probes.py +1 -29
- hive/cookbook/services.py +214 -6
- hive/cookbook/sites.py +1 -58
- hive/cookbook/webhooks.py +17 -3
- hive/decorators.py +32 -6
- hive/version.py +1 -1
- {xautomata_hive-3.20.2.dist-info → xautomata_hive-3.22.0.dist-info}/METADATA +9 -2
- {xautomata_hive-3.20.2.dist-info → xautomata_hive-3.22.0.dist-info}/RECORD +22 -22
- {xautomata_hive-3.20.2.dist-info → xautomata_hive-3.22.0.dist-info}/WHEEL +1 -1
- {xautomata_hive-3.20.2.dist-info → xautomata_hive-3.22.0.dist-info}/LICENSE +0 -0
- {xautomata_hive-3.20.2.dist-info → xautomata_hive-3.22.0.dist-info}/top_level.txt +0 -0
hive/cookbook/metrics.py
CHANGED
@@ -6,7 +6,7 @@ class Metrics(ApiManager):
|
|
6
6
|
|
7
7
|
def metrics(self, warm_start: bool = False, single_page: bool = False,
|
8
8
|
page_size: int = 5000, kwargs: dict = None, **params) -> list:
|
9
|
-
"""Read Metrics
|
9
|
+
"""Read Metrics V2
|
10
10
|
|
11
11
|
Args:
|
12
12
|
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.
|
@@ -86,55 +86,6 @@ class Metrics(ApiManager):
|
|
86
86
|
**kwargs)
|
87
87
|
return response
|
88
88
|
|
89
|
-
def metrics_v2(self, warm_start: bool = False,
|
90
|
-
single_page: bool = False, page_size: int = 5000,
|
91
|
-
kwargs: dict = None, **params) -> list:
|
92
|
-
"""Read Metrics V2
|
93
|
-
|
94
|
-
Args:
|
95
|
-
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.
|
96
|
-
single_page (bool, optional): se False la risposta viene ottenuta a step per non appesantire le API. Default to False.
|
97
|
-
page_size (int, optional): Numero di oggetti per pagina se single_page == False. Default to 5000.
|
98
|
-
kwargs (dict, optional): additional parameters for execute. Default to None.
|
99
|
-
**params: additional parameters for the API.
|
100
|
-
|
101
|
-
Keyword Args:
|
102
|
-
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
|
103
|
-
null_fields (string optional): additional filter - parameter
|
104
|
-
uuid_metric_type (string optional): additional filter - parameter
|
105
|
-
name (string optional): additional filter - parameter
|
106
|
-
description (string optional): additional filter - parameter
|
107
|
-
feedback_for_operator (string optional): additional filter - parameter
|
108
|
-
profile (string optional): additional filter - parameter
|
109
|
-
status (string optional): additional filter - parameter
|
110
|
-
extract_severity (boolean optional): Se True nella risposta e' anche presente la severita, Default to False. - parameter
|
111
|
-
skip (integer optional): numero di oggetti che si vogliono saltare nella risposta. Default to 0. - parameter
|
112
|
-
limit (integer optional): numero di oggetti massimi che si vogliono ottenere. Default to 1_000_000. - parameter
|
113
|
-
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
|
114
|
-
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
|
115
|
-
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
|
116
|
-
|
117
|
-
Returns: list"""
|
118
|
-
if kwargs is None:
|
119
|
-
kwargs = dict()
|
120
|
-
official_params_list = ['sort_by', 'null_fields',
|
121
|
-
'uuid_metric_type', 'name', 'description',
|
122
|
-
'feedback_for_operator', 'profile', 'status',
|
123
|
-
'extract_severity', 'skip', 'limit', 'like', 'join', 'count']
|
124
|
-
params.get('sort_by'), params.get('null_fields'), params.get(
|
125
|
-
'uuid_metric_type'), params.get('name'), params.get('description'
|
126
|
-
), params.get('feedback_for_operator'), params.get('profile'
|
127
|
-
), params.get('status'), params.get('extract_severity'
|
128
|
-
), params.get('skip'), params.get('limit'), params.get('like'
|
129
|
-
), params.get('join'), params.get('count')
|
130
|
-
if not self._silence_warning:
|
131
|
-
warning_wrong_parameters(self.metrics_v2.__name__, params,
|
132
|
-
official_params_list)
|
133
|
-
response = self.execute('GET', path=f'/metrics/v2/', single_page=
|
134
|
-
single_page, page_size=page_size, warm_start=warm_start, params
|
135
|
-
=params, **kwargs)
|
136
|
-
return response
|
137
|
-
|
138
89
|
def metric(self, uuid: str, warm_start: bool = False,
|
139
90
|
kwargs: dict = None, **params) -> list:
|
140
91
|
"""Read Metric
|
hive/cookbook/objects.py
CHANGED
@@ -6,7 +6,7 @@ class Objects(ApiManager):
|
|
6
6
|
|
7
7
|
def objects(self, warm_start: bool = False, single_page: bool = False,
|
8
8
|
page_size: int = 5000, kwargs: dict = None, **params) -> list:
|
9
|
-
"""Read Objects
|
9
|
+
"""Read Objects V2
|
10
10
|
|
11
11
|
Args:
|
12
12
|
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.
|
@@ -83,52 +83,6 @@ class Objects(ApiManager):
|
|
83
83
|
**kwargs)
|
84
84
|
return response
|
85
85
|
|
86
|
-
def objects_v2(self, warm_start: bool = False,
|
87
|
-
single_page: bool = False, page_size: int = 5000,
|
88
|
-
kwargs: dict = None, **params) -> list:
|
89
|
-
"""Read Objects V2
|
90
|
-
|
91
|
-
Args:
|
92
|
-
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.
|
93
|
-
single_page (bool, optional): se False la risposta viene ottenuta a step per non appesantire le API. Default to False.
|
94
|
-
page_size (int, optional): Numero di oggetti per pagina se single_page == False. Default to 5000.
|
95
|
-
kwargs (dict, optional): additional parameters for execute. Default to None.
|
96
|
-
**params: additional parameters for the API.
|
97
|
-
|
98
|
-
Keyword Args:
|
99
|
-
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
|
100
|
-
null_fields (string optional): additional filter - parameter
|
101
|
-
name (string optional): additional filter - parameter
|
102
|
-
description (string optional): additional filter - parameter
|
103
|
-
feedback_for_operator (string optional): additional filter - parameter
|
104
|
-
profile (string optional): additional filter - parameter
|
105
|
-
status (string optional): additional filter - parameter
|
106
|
-
extract_severity (boolean optional): Se True nella risposta e' anche presente la severita, Default to False. - parameter
|
107
|
-
skip (integer optional): numero di oggetti che si vogliono saltare nella risposta. Default to 0. - parameter
|
108
|
-
limit (integer optional): numero di oggetti massimi che si vogliono ottenere. Default to 1_000_000. - parameter
|
109
|
-
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
|
110
|
-
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
|
111
|
-
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
|
112
|
-
|
113
|
-
Returns: list"""
|
114
|
-
if kwargs is None:
|
115
|
-
kwargs = dict()
|
116
|
-
official_params_list = ['sort_by', 'null_fields', 'name',
|
117
|
-
'description', 'feedback_for_operator', 'profile', 'status',
|
118
|
-
'extract_severity', 'skip', 'limit', 'like', 'join', 'count']
|
119
|
-
params.get('sort_by'), params.get('null_fields'), params.get('name'
|
120
|
-
), params.get('description'), params.get('feedback_for_operator'
|
121
|
-
), params.get('profile'), params.get('status'), params.get(
|
122
|
-
'extract_severity'), params.get('skip'), params.get('limit'
|
123
|
-
), params.get('like'), params.get('join'), params.get('count')
|
124
|
-
if not self._silence_warning:
|
125
|
-
warning_wrong_parameters(self.objects_v2.__name__, params,
|
126
|
-
official_params_list)
|
127
|
-
response = self.execute('GET', path=f'/objects/v2/', single_page=
|
128
|
-
single_page, page_size=page_size, warm_start=warm_start, params
|
129
|
-
=params, **kwargs)
|
130
|
-
return response
|
131
|
-
|
132
86
|
def object(self, uuid: str, warm_start: bool = False, kwargs: dict = None
|
133
87
|
) -> list:
|
134
88
|
"""Read Object
|
hive/cookbook/probes.py
CHANGED
@@ -91,7 +91,7 @@ class Probes(ApiManager):
|
|
91
91
|
|
92
92
|
def probe(self, uuid: str, warm_start: bool = False,
|
93
93
|
kwargs: dict = None, **params) -> list:
|
94
|
-
"""Read Probe
|
94
|
+
"""Read Probe V2
|
95
95
|
|
96
96
|
Args:
|
97
97
|
uuid (str, required): uuid
|
@@ -168,34 +168,6 @@ class Probes(ApiManager):
|
|
168
168
|
response = self.execute('DELETE', path=f'/probes/{uuid}', **kwargs)
|
169
169
|
return response
|
170
170
|
|
171
|
-
def probes_v2(self, uuid: str, warm_start: bool = False,
|
172
|
-
kwargs: dict = None, **params) -> list:
|
173
|
-
"""Read Probe V2
|
174
|
-
|
175
|
-
Args:
|
176
|
-
uuid (str, required): uuid
|
177
|
-
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.
|
178
|
-
kwargs (dict, optional): additional parameters for execute. Default to None.
|
179
|
-
**params: additional parameters for the API.
|
180
|
-
|
181
|
-
Keyword Args:
|
182
|
-
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
|
183
|
-
extract_severity (boolean optional): Se True nella risposta e' anche presente la severita, Default to False. - parameter
|
184
|
-
|
185
|
-
Returns: list"""
|
186
|
-
if kwargs is None:
|
187
|
-
kwargs = dict()
|
188
|
-
kwargs, params = handling_single_page_methods(kwargs=kwargs, params
|
189
|
-
=params)
|
190
|
-
official_params_list = ['join', 'extract_severity']
|
191
|
-
params.get('join'), params.get('extract_severity')
|
192
|
-
if not self._silence_warning:
|
193
|
-
warning_wrong_parameters(self.probes_v2.__name__, params,
|
194
|
-
official_params_list)
|
195
|
-
response = self.execute('GET', path=f'/probes/{uuid}/v2/',
|
196
|
-
warm_start=warm_start, params=params, **kwargs)
|
197
|
-
return response
|
198
|
-
|
199
171
|
def probes_agent_put(self, uuid: str, kwargs: dict = None, **payload
|
200
172
|
) -> list:
|
201
173
|
"""Agent Update Probe
|
hive/cookbook/services.py
CHANGED
@@ -386,7 +386,7 @@ class Services(ApiManager):
|
|
386
386
|
def services_query(self, warm_start: bool = False,
|
387
387
|
single_page: bool = False, page_size: int = 5000,
|
388
388
|
kwargs: dict = None, **params) -> list:
|
389
|
-
"""
|
389
|
+
"""Service Query
|
390
390
|
|
391
391
|
Args:
|
392
392
|
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.
|
@@ -432,6 +432,7 @@ class Services(ApiManager):
|
|
432
432
|
service_description (string optional): additional filter - parameter
|
433
433
|
service_status (string optional): additional filter - parameter
|
434
434
|
service_automata_domain (string optional): additional filter - parameter
|
435
|
+
service_uuid_customer (string optional): additional filter - parameter
|
435
436
|
skip (integer optional): numero di oggetti che si vogliono saltare nella risposta. Default to 0. - parameter
|
436
437
|
limit (integer optional): numero di oggetti massimi che si vogliono ottenere. Default to 1_000_000. - parameter
|
437
438
|
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
|
@@ -452,8 +453,8 @@ class Services(ApiManager):
|
|
452
453
|
'metric_status', 'metric_profile', 'service_uuid_parent',
|
453
454
|
'uuid_service', 'service_profile', 'service_name',
|
454
455
|
'service_description', 'service_status',
|
455
|
-
'service_automata_domain', '
|
456
|
-
]
|
456
|
+
'service_automata_domain', 'service_uuid_customer', 'skip',
|
457
|
+
'limit', 'like', 'join', 'count']
|
457
458
|
params.get('sort_by'), params.get('null_fields'), params.get(
|
458
459
|
'uuid_customer'), params.get('customer_code'), params.get(
|
459
460
|
'customer_status'), params.get('uuid_site'), params.get('site_code'
|
@@ -471,8 +472,9 @@ class Services(ApiManager):
|
|
471
472
|
), params.get('uuid_service'), params.get('service_profile'
|
472
473
|
), params.get('service_name'), params.get('service_description'
|
473
474
|
), params.get('service_status'), params.get(
|
474
|
-
'service_automata_domain'), params.get('
|
475
|
-
), params.get('
|
475
|
+
'service_automata_domain'), params.get('service_uuid_customer'
|
476
|
+
), params.get('skip'), params.get('limit'), params.get('like'
|
477
|
+
), params.get('join'), params.get('count')
|
476
478
|
if not self._silence_warning:
|
477
479
|
warning_wrong_parameters(self.services_query.__name__, params,
|
478
480
|
official_params_list)
|
@@ -484,7 +486,7 @@ class Services(ApiManager):
|
|
484
486
|
def services_query_bulk(self, payload: dict = False,
|
485
487
|
warm_start: bool = False, single_page: bool = False,
|
486
488
|
page_size: int = 5000, kwargs: dict = None, **params) -> list:
|
487
|
-
"""
|
489
|
+
"""Service Query Lists
|
488
490
|
|
489
491
|
Args:
|
490
492
|
payload (dict, optional): additional parameters for the API.
|
@@ -539,6 +541,7 @@ class Services(ApiManager):
|
|
539
541
|
"service_name": "array", optional
|
540
542
|
"service_description": "array", optional
|
541
543
|
"service_status": "array", optional
|
544
|
+
"service_uuid_customer": "array", optional
|
542
545
|
}
|
543
546
|
|
544
547
|
Returns: list"""
|
@@ -557,6 +560,211 @@ class Services(ApiManager):
|
|
557
560
|
warm_start, params=params, payload=payload, **kwargs)
|
558
561
|
return response
|
559
562
|
|
563
|
+
def services_v2_query(self, warm_start: bool = False,
|
564
|
+
single_page: bool = False, page_size: int = 5000,
|
565
|
+
kwargs: dict = None, **params) -> list:
|
566
|
+
"""Service Query V2
|
567
|
+
|
568
|
+
Args:
|
569
|
+
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.
|
570
|
+
single_page (bool, optional): se False la risposta viene ottenuta a step per non appesantire le API. Default to False.
|
571
|
+
page_size (int, optional): Numero di oggetti per pagina se single_page == False. Default to 5000.
|
572
|
+
kwargs (dict, optional): additional parameters for execute. Default to None.
|
573
|
+
**params: additional parameters for the API.
|
574
|
+
|
575
|
+
Keyword Args:
|
576
|
+
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
|
577
|
+
null_fields (string optional): additional filter - parameter
|
578
|
+
uuid_customer (string optional): additional filter - parameter
|
579
|
+
customer_code (string optional): additional filter - parameter
|
580
|
+
customer_status (string optional): additional filter - parameter
|
581
|
+
uuid_site (string optional): additional filter - parameter
|
582
|
+
site_code (string optional): additional filter - parameter
|
583
|
+
site_description (string optional): additional filter - parameter
|
584
|
+
site_address (string optional): additional filter - parameter
|
585
|
+
site_zip_code (string optional): additional filter - parameter
|
586
|
+
site_city (string optional): additional filter - parameter
|
587
|
+
site_country (string optional): additional filter - parameter
|
588
|
+
site_state_province (string optional): additional filter - parameter
|
589
|
+
site_status (string optional): additional filter - parameter
|
590
|
+
uuid_group (string optional): additional filter - parameter
|
591
|
+
group_name (string optional): additional filter - parameter
|
592
|
+
group_status (string optional): additional filter - parameter
|
593
|
+
group_type (string optional): additional filter - parameter
|
594
|
+
uuid_object (string optional): additional filter - parameter
|
595
|
+
object_name (string optional): additional filter - parameter
|
596
|
+
object_status (string optional): additional filter - parameter
|
597
|
+
object_profile (string optional): additional filter - parameter
|
598
|
+
uuid_metric_type (string optional): additional filter - parameter
|
599
|
+
metric_type_name (string optional): additional filter - parameter
|
600
|
+
metric_type_status (string optional): additional filter - parameter
|
601
|
+
uuid_metric (string optional): additional filter - parameter
|
602
|
+
metric_name (string optional): additional filter - parameter
|
603
|
+
metric_status (string optional): additional filter - parameter
|
604
|
+
metric_profile (string optional): additional filter - parameter
|
605
|
+
service_uuid_parent (string optional): additional filter - parameter
|
606
|
+
uuid_service (string optional): additional filter - parameter
|
607
|
+
service_profile (string optional): additional filter - parameter
|
608
|
+
service_name (string optional): additional filter - parameter
|
609
|
+
service_description (string optional): additional filter - parameter
|
610
|
+
service_status (string optional): additional filter - parameter
|
611
|
+
service_automata_domain (string optional): additional filter - parameter
|
612
|
+
service_uuid_customer (string optional): additional filter - parameter
|
613
|
+
skip (integer optional): numero di oggetti che si vogliono saltare nella risposta. Default to 0. - parameter
|
614
|
+
limit (integer optional): numero di oggetti massimi che si vogliono ottenere. Default to 1_000_000. - parameter
|
615
|
+
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
|
616
|
+
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
|
617
|
+
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
|
618
|
+
|
619
|
+
Returns: list"""
|
620
|
+
if kwargs is None:
|
621
|
+
kwargs = dict()
|
622
|
+
official_params_list = ['sort_by', 'null_fields', 'uuid_customer',
|
623
|
+
'customer_code', 'customer_status', 'uuid_site', 'site_code',
|
624
|
+
'site_description', 'site_address', 'site_zip_code',
|
625
|
+
'site_city', 'site_country', 'site_state_province',
|
626
|
+
'site_status', 'uuid_group', 'group_name', 'group_status',
|
627
|
+
'group_type', 'uuid_object', 'object_name', 'object_status',
|
628
|
+
'object_profile', 'uuid_metric_type', 'metric_type_name',
|
629
|
+
'metric_type_status', 'uuid_metric', 'metric_name',
|
630
|
+
'metric_status', 'metric_profile', 'service_uuid_parent',
|
631
|
+
'uuid_service', 'service_profile', 'service_name',
|
632
|
+
'service_description', 'service_status',
|
633
|
+
'service_automata_domain', 'service_uuid_customer', 'skip',
|
634
|
+
'limit', 'like', 'join', 'count']
|
635
|
+
params.get('sort_by'), params.get('null_fields'), params.get(
|
636
|
+
'uuid_customer'), params.get('customer_code'), params.get(
|
637
|
+
'customer_status'), params.get('uuid_site'), params.get('site_code'
|
638
|
+
), params.get('site_description'), params.get('site_address'
|
639
|
+
), params.get('site_zip_code'), params.get('site_city'
|
640
|
+
), params.get('site_country'), params.get('site_state_province'
|
641
|
+
), params.get('site_status'), params.get('uuid_group'), params.get(
|
642
|
+
'group_name'), params.get('group_status'), params.get('group_type'
|
643
|
+
), params.get('uuid_object'), params.get('object_name'
|
644
|
+
), params.get('object_status'), params.get('object_profile'
|
645
|
+
), params.get('uuid_metric_type'), params.get('metric_type_name'
|
646
|
+
), params.get('metric_type_status'), params.get('uuid_metric'
|
647
|
+
), params.get('metric_name'), params.get('metric_status'
|
648
|
+
), params.get('metric_profile'), params.get('service_uuid_parent'
|
649
|
+
), params.get('uuid_service'), params.get('service_profile'
|
650
|
+
), params.get('service_name'), params.get('service_description'
|
651
|
+
), params.get('service_status'), params.get(
|
652
|
+
'service_automata_domain'), params.get('service_uuid_customer'
|
653
|
+
), params.get('skip'), params.get('limit'), params.get('like'
|
654
|
+
), params.get('join'), params.get('count')
|
655
|
+
if not self._silence_warning:
|
656
|
+
warning_wrong_parameters(self.services_v2_query.__name__,
|
657
|
+
params, official_params_list)
|
658
|
+
response = self.execute('GET', path=f'/services/query/v2',
|
659
|
+
single_page=single_page, page_size=page_size, warm_start=
|
660
|
+
warm_start, params=params, **kwargs)
|
661
|
+
return response
|
662
|
+
|
663
|
+
def services_v2_query_bulk(self, payload: dict = False,
|
664
|
+
warm_start: bool = False, single_page: bool = False,
|
665
|
+
page_size: int = 5000, kwargs: dict = None, **params) -> list:
|
666
|
+
"""Service Query Lists V2
|
667
|
+
|
668
|
+
Args:
|
669
|
+
payload (dict, optional): additional parameters for the API.
|
670
|
+
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.
|
671
|
+
single_page (bool, optional): se False la risposta viene ottenuta a step per non appesantire le API. Default to False.
|
672
|
+
page_size (int, optional): Numero di oggetti per pagina se single_page == False. Default to 5000.
|
673
|
+
kwargs (dict, optional): additional parameters for execute. Default to None.
|
674
|
+
**params: additional parameters for the API.
|
675
|
+
|
676
|
+
Keyword Args:
|
677
|
+
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
|
678
|
+
null_fields (string optional): additional filter - parameter
|
679
|
+
skip (integer optional): numero di oggetti che si vogliono saltare nella risposta. Default to 0. - parameter
|
680
|
+
limit (integer optional): numero di oggetti massimi che si vogliono ottenere. Default to 1_000_000. - parameter
|
681
|
+
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
|
682
|
+
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
|
683
|
+
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
|
684
|
+
|
685
|
+
Examples:
|
686
|
+
payload =
|
687
|
+
{
|
688
|
+
"uuid_customer": "array", optional
|
689
|
+
"customer_code": "array", optional
|
690
|
+
"customer_status": "array", optional
|
691
|
+
"uuid_site": "array", optional
|
692
|
+
"site_code": "array", optional
|
693
|
+
"site_description": "array", optional
|
694
|
+
"site_address": "array", optional
|
695
|
+
"site_zip_code": "array", optional
|
696
|
+
"site_city": "array", optional
|
697
|
+
"site_country": "array", optional
|
698
|
+
"site_state_province": "array", optional
|
699
|
+
"site_status": "array", optional
|
700
|
+
"uuid_group": "array", optional
|
701
|
+
"group_name": "array", optional
|
702
|
+
"group_status": "array", optional
|
703
|
+
"group_type": "array", optional
|
704
|
+
"uuid_object": "array", optional
|
705
|
+
"object_name": "array", optional
|
706
|
+
"object_status": "array", optional
|
707
|
+
"object_profile": "array", optional
|
708
|
+
"uuid_metric_type": "array", optional
|
709
|
+
"metric_type_name": "array", optional
|
710
|
+
"metric_type_status": "array", optional
|
711
|
+
"uuid_metric": "array", optional
|
712
|
+
"metric_name": "array", optional
|
713
|
+
"metric_status": "array", optional
|
714
|
+
"metric_profile": "array", optional
|
715
|
+
"service_uuid_parent": "array", optional
|
716
|
+
"uuid_service": "array", optional
|
717
|
+
"service_profile": "array", optional
|
718
|
+
"service_name": "array", optional
|
719
|
+
"service_description": "array", optional
|
720
|
+
"service_status": "array", optional
|
721
|
+
"service_uuid_customer": "array", optional
|
722
|
+
}
|
723
|
+
|
724
|
+
Returns: list"""
|
725
|
+
if kwargs is None:
|
726
|
+
kwargs = dict()
|
727
|
+
official_params_list = ['sort_by', 'null_fields', 'skip', 'limit',
|
728
|
+
'like', 'join', 'count']
|
729
|
+
params.get('sort_by'), params.get('null_fields'), params.get('skip'
|
730
|
+
), params.get('limit'), params.get('like'), params.get('join'
|
731
|
+
), params.get('count')
|
732
|
+
if not self._silence_warning:
|
733
|
+
warning_wrong_parameters(self.services_v2_query_bulk.__name__,
|
734
|
+
params, official_params_list)
|
735
|
+
response = self.execute('POST', path=f'/services/query/v2',
|
736
|
+
single_page=single_page, page_size=page_size, warm_start=
|
737
|
+
warm_start, params=params, payload=payload, **kwargs)
|
738
|
+
return response
|
739
|
+
|
740
|
+
def services_check_rules_create(self, params: dict = False,
|
741
|
+
kwargs: dict = None, **payload) -> list:
|
742
|
+
"""Check Service Rules
|
743
|
+
|
744
|
+
Args:
|
745
|
+
params (dict, optional): additional parameters for the API.
|
746
|
+
kwargs (dict, optional): additional parameters for execute. Default to None.
|
747
|
+
**payload: additional parameters for the API.
|
748
|
+
|
749
|
+
Keyword Args:
|
750
|
+
uuid_group (string optional): additional filter - parameter
|
751
|
+
uuid_object (string optional): additional filter - parameter
|
752
|
+
uuid_metric (string optional): additional filter - parameter
|
753
|
+
services_rules (array required): additional filter - payload
|
754
|
+
default_service (None required): additional filter - payload
|
755
|
+
|
756
|
+
Returns: list"""
|
757
|
+
if kwargs is None:
|
758
|
+
kwargs = dict()
|
759
|
+
official_payload_list = ['services_rules', 'default_service']
|
760
|
+
payload.get('services_rules'), payload.get('default_service')
|
761
|
+
if not self._silence_warning:
|
762
|
+
warning_wrong_parameters(self.services_check_rules_create.
|
763
|
+
__name__, payload, official_payload_list)
|
764
|
+
response = self.execute('POST', path=f'/services/check_rules/',
|
765
|
+
params=params, payload=payload, **kwargs)
|
766
|
+
return response
|
767
|
+
|
560
768
|
def services_bulk(self, payload: list, warm_start: bool = False,
|
561
769
|
single_page: bool = False, page_size: int = 50, kwargs: dict = None,
|
562
770
|
**params) -> list:
|
hive/cookbook/sites.py
CHANGED
@@ -6,7 +6,7 @@ class Sites(ApiManager):
|
|
6
6
|
|
7
7
|
def sites(self, warm_start: bool = False, single_page: bool = False,
|
8
8
|
page_size: int = 5000, kwargs: dict = None, **params) -> list:
|
9
|
-
"""Read Sites
|
9
|
+
"""Read Sites V2
|
10
10
|
|
11
11
|
Args:
|
12
12
|
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.
|
@@ -102,63 +102,6 @@ class Sites(ApiManager):
|
|
102
102
|
payload=payload, **kwargs)
|
103
103
|
return response
|
104
104
|
|
105
|
-
def sites_v2(self, warm_start: bool = False, single_page: bool = False,
|
106
|
-
page_size: int = 5000, kwargs: dict = None, **params) -> list:
|
107
|
-
"""Read Sites V2
|
108
|
-
|
109
|
-
Args:
|
110
|
-
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.
|
111
|
-
single_page (bool, optional): se False la risposta viene ottenuta a step per non appesantire le API. Default to False.
|
112
|
-
page_size (int, optional): Numero di oggetti per pagina se single_page == False. Default to 5000.
|
113
|
-
kwargs (dict, optional): additional parameters for execute. Default to None.
|
114
|
-
**params: additional parameters for the API.
|
115
|
-
|
116
|
-
Keyword Args:
|
117
|
-
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
|
118
|
-
null_fields (string optional): additional filter - parameter
|
119
|
-
uuid_customer (string optional): additional filter - parameter
|
120
|
-
type (string optional): additional filter - parameter
|
121
|
-
code (string optional): additional filter - parameter
|
122
|
-
description (string optional): additional filter - parameter
|
123
|
-
address (string optional): additional filter - parameter
|
124
|
-
zip_code (string optional): additional filter - parameter
|
125
|
-
city (string optional): additional filter - parameter
|
126
|
-
country (string optional): additional filter - parameter
|
127
|
-
notes (string optional): additional filter - parameter
|
128
|
-
state_province (string optional): additional filter - parameter
|
129
|
-
status (string optional): additional filter - parameter
|
130
|
-
filter_group_types (string optional): additional filter - parameter
|
131
|
-
extract_severity (boolean optional): Se True nella risposta e' anche presente la severita, Default to False. - parameter
|
132
|
-
skip (integer optional): numero di oggetti che si vogliono saltare nella risposta. Default to 0. - parameter
|
133
|
-
limit (integer optional): numero di oggetti massimi che si vogliono ottenere. Default to 1_000_000. - parameter
|
134
|
-
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
|
135
|
-
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
|
136
|
-
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
|
137
|
-
|
138
|
-
Returns: list"""
|
139
|
-
if kwargs is None:
|
140
|
-
kwargs = dict()
|
141
|
-
official_params_list = ['sort_by', 'null_fields', 'uuid_customer',
|
142
|
-
'type', 'code', 'description', 'address', 'zip_code', 'city',
|
143
|
-
'country', 'notes', 'state_province', 'status',
|
144
|
-
'filter_group_types', 'extract_severity', 'skip', 'limit',
|
145
|
-
'like', 'join', 'count']
|
146
|
-
params.get('sort_by'), params.get('null_fields'), params.get(
|
147
|
-
'uuid_customer'), params.get('type'), params.get('code'
|
148
|
-
), params.get('description'), params.get('address'), params.get(
|
149
|
-
'zip_code'), params.get('city'), params.get('country'), params.get(
|
150
|
-
'notes'), params.get('state_province'), params.get('status'
|
151
|
-
), params.get('filter_group_types'), params.get('extract_severity'
|
152
|
-
), params.get('skip'), params.get('limit'), params.get('like'
|
153
|
-
), params.get('join'), params.get('count')
|
154
|
-
if not self._silence_warning:
|
155
|
-
warning_wrong_parameters(self.sites_v2.__name__, params,
|
156
|
-
official_params_list)
|
157
|
-
response = self.execute('GET', path=f'/sites/v2/', single_page=
|
158
|
-
single_page, page_size=page_size, warm_start=warm_start, params
|
159
|
-
=params, **kwargs)
|
160
|
-
return response
|
161
|
-
|
162
105
|
def site(self, uuid: str, warm_start: bool = False, kwargs: dict = None,
|
163
106
|
**params) -> list:
|
164
107
|
"""Read Site
|
hive/cookbook/webhooks.py
CHANGED
@@ -114,17 +114,31 @@ class Webhooks(ApiManager):
|
|
114
114
|
payload, **kwargs)
|
115
115
|
return response
|
116
116
|
|
117
|
-
def webhooks_create_webhook_type(self, webhook_type: str,
|
118
|
-
kwargs: dict = None
|
117
|
+
def webhooks_create_webhook_type(self, payload: list, webhook_type: str,
|
118
|
+
single_page: bool = False, page_size: int = 50, kwargs: dict = None,
|
119
|
+
**params) -> list:
|
119
120
|
"""Post Webhook
|
120
121
|
|
121
122
|
Args:
|
123
|
+
payload (list[dict], optional): List dict to create.
|
122
124
|
webhook_type (str, required): webhook_type
|
125
|
+
single_page (bool, optional): se False la risposta viene ottenuta a step per non appesantire le API. Default to False.
|
126
|
+
page_size (int, optional): Numero di oggetti per pagina se single_page == False. Default to 50.
|
123
127
|
kwargs (dict, optional): additional parameters for execute. Default to None.
|
128
|
+
**params: additional parameters for the API.
|
129
|
+
|
130
|
+
Keyword Args:
|
131
|
+
xa-auth-token (string required): additional filter - parameter
|
124
132
|
|
125
133
|
Returns: list"""
|
126
134
|
if kwargs is None:
|
127
135
|
kwargs = dict()
|
136
|
+
official_params_list = ['xa-auth-token']
|
137
|
+
params.get('xa-auth-token')
|
138
|
+
if not self._silence_warning:
|
139
|
+
warning_wrong_parameters(self.webhooks_create.__name__, params,
|
140
|
+
official_params_list)
|
128
141
|
response = self.execute('POST', path=f'/webhooks/{webhook_type}',
|
129
|
-
|
142
|
+
single_page=single_page, page_size=page_size, params=params,
|
143
|
+
payload=payload, **kwargs)
|
130
144
|
return response
|
hive/decorators.py
CHANGED
@@ -131,29 +131,55 @@ def timeout_retry(func=None, max_tries: int = 2, sleep_time: int = 60):
|
|
131
131
|
|
132
132
|
|
133
133
|
def paginate(single_page: bool, page_size: int, skip: int, limit: int, bulk: bool):
|
134
|
+
"""Questa funzione è un decorator che abilita la paginazione per una funzione.
|
135
|
+
|
136
|
+
Args:
|
137
|
+
single_page: se True, restituisce solo una singola "pagina" di risultati.
|
138
|
+
page_size: dimensione della pagina (numero massimo di elementi per chiamata).
|
139
|
+
skip: numero di elementi da saltare all'inizio.
|
140
|
+
limit: numero massimo di elementi da restituire.
|
141
|
+
bulk: se True, gestisce il payload in modalità "bulk", suddividendolo in chunk.
|
142
|
+
"""
|
134
143
|
def attributes(func):
|
144
|
+
# Questo è il decorator interno che avvolge la funzione passata (`func`).
|
135
145
|
@functools.wraps(func)
|
136
146
|
def behaviour(mode, url, headers, payload, params, **kwargs) -> list:
|
137
|
-
|
147
|
+
# `behaviour` è la funzione wrapper che implementa la logica di paginazione.
|
148
|
+
# Accetta i parametri della funzione originale (`func`) e aggiunge il supporto alla paginazione.
|
149
|
+
result = [] # Lista che conterrà i risultati aggregati.
|
138
150
|
|
139
151
|
# se la chiamata è bulk, il payload deve essere un lista e qui viene divisa in chunk e viene chiamata un
|
140
152
|
# chunk per volta, ogni chunk ha la dimensione del page_size
|
141
153
|
if bulk and not single_page: # se la bulk viene richiesta in single_page, ricade nell'uso normale
|
154
|
+
# Divide il payload in chunk della dimensione specificata da `page_size`.
|
142
155
|
c_payload = chunks(payload, page_size)
|
156
|
+
# Per ogni chunk:
|
143
157
|
for c in c_payload:
|
158
|
+
# Chiama la funzione originale (`func`) con il chunk corrente.
|
144
159
|
result_partial = func(mode, url, headers, c, params, **kwargs)
|
160
|
+
# Se il risultato non è una lista, lo converte in una lista.
|
145
161
|
if not isinstance(result_partial, list): result_partial = [result_partial]
|
162
|
+
# Aggiunge i risultati parziali alla lista complessiva `result`.
|
146
163
|
result += result_partial
|
147
164
|
|
148
|
-
else:
|
149
|
-
size = page_size if not single_page else limit
|
150
|
-
params['skip'] = skip
|
151
|
-
params['limit'] = min(size, limit)
|
152
|
-
while True:
|
165
|
+
else: # Se non è in modalità bulk o se è richiesto single_page:
|
166
|
+
size = page_size if not single_page else limit # Determina la dimensione della pagina.
|
167
|
+
params['skip'] = skip # Imposta il valore iniziale di `skip` nei parametri.
|
168
|
+
params['limit'] = min(size, limit) # Imposta il limite massimo per la pagina corrente.
|
169
|
+
while True: # Ciclo per iterare attraverso le pagine.
|
170
|
+
# Chiama la funzione originale (`func`) con i parametri della pagina corrente.
|
153
171
|
result_partial = func(mode, url, headers, payload, params, **kwargs)
|
172
|
+
# Se il risultato non è una lista, lo converte in una lista.
|
154
173
|
if not isinstance(result_partial, list): result_partial = [result_partial]
|
174
|
+
# Aggiunge i risultati parziali alla lista complessiva `result`.
|
155
175
|
result += result_partial
|
176
|
+
# Aggiorna il valore di `skip` per passare alla pagina successiva.
|
156
177
|
params['skip'] = params['skip'] + size
|
178
|
+
# Interrompe il ciclo se:
|
179
|
+
# - Non ci sono più risultati (`result_partial` è vuoto).
|
180
|
+
# - Il numero di risultati è inferiore alla dimensione della pagina.
|
181
|
+
# - Il numero totale di risultati supera il limite specificato.
|
182
|
+
# - È richiesto il single_page.
|
157
183
|
if not result_partial or len(result_partial) < size or len(result) > limit or single_page: break
|
158
184
|
|
159
185
|
# se count è True il result è una lista con dentro una tupla, in questa maniera viene trasmessa solo la tupla
|
hive/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version = '3.
|
1
|
+
version = '3.22.0'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: xautomata-hive
|
3
|
-
Version: 3.
|
3
|
+
Version: 3.22.0
|
4
4
|
Home-page: https://github.com/sherlogic/xautomata-hive.git
|
5
5
|
Author: Enrico Ferro - Andrea Jacassi
|
6
6
|
Author-email:
|
@@ -11,6 +11,13 @@ License-File: LICENSE
|
|
11
11
|
Requires-Dist: urllib3==2.0.4
|
12
12
|
Requires-Dist: requests==2.31.0
|
13
13
|
Requires-Dist: tqdm==4.64.1
|
14
|
+
Dynamic: author
|
15
|
+
Dynamic: description
|
16
|
+
Dynamic: description-content-type
|
17
|
+
Dynamic: home-page
|
18
|
+
Dynamic: license
|
19
|
+
Dynamic: requires-dist
|
20
|
+
Dynamic: requires-python
|
14
21
|
|
15
22
|
# Xautomata API
|
16
23
|
Pacchetto che fornisca una interfaccia semplice per usare le API di Xautomata in python
|