Skip to content

Commit 7e2558a

Browse files
authored
Implement Alerts 2.0.0.Final trigger features (#54)
1 parent 1748ed4 commit 7e2558a

3 files changed

Lines changed: 294 additions & 61 deletions

File tree

hawkular/alerts/common.py

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
"""
2+
Copyright 2015-2017 Red Hat, Inc. and/or its affiliates
3+
and other contributors.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
"""
117
from hawkular.client import ApiObject, HawkularBaseClient
218
from hawkular.alerts.triggers import AlertsTriggerClient
319

@@ -7,9 +23,19 @@ class Status(ApiObject):
723
]
824

925
def isup(self):
26+
"""
27+
Returns if the alerting service is ready to accept requests.
28+
29+
:return: bool True if available
30+
"""
1031
return self.status == 'STARTED'
1132

1233
def isdistributed(self):
34+
"""
35+
Is the Alerting Service running in distributed mode or standalone.
36+
37+
:return: bool True if distributed
38+
"""
1339
return self.distributed == 'true'
1440

1541
class HawkularAlertsClient(HawkularBaseClient):
@@ -52,13 +78,12 @@ def __init__(self, **opts):
5278

5379
self.triggers = AlertsTriggerClient(self)
5480

55-
# def triggers(self):
56-
# """
57-
# Returns triggers methods
58-
# """
59-
# return AlertsTriggerClient(self)
60-
6181
def status(self):
82+
"""
83+
Get the status of Alerting Service
84+
85+
:return: Status object
86+
"""
6287
orig_dict = self._get(self._service_url('status'))
6388
orig_dict['implementation_version'] = orig_dict.pop('Implementation-Version')
6489
orig_dict['built_from_git_sha1'] = orig_dict.pop('Built-From-Git-SHA1')

0 commit comments

Comments
 (0)