Skip to content

Commit d4a6d73

Browse files
author
Alex Pogue
committed
Implement list_all for conditions
1 parent 526e567 commit d4a6d73

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

newrelic_api/alert_conditions.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ def list(self, policy_id, page=None):
7171
params=self.build_param_string(filters)
7272
)
7373

74+
def list_all(self, policy_id):
75+
condition_list = []
76+
cur_page_num = 1
77+
next_page_definition = 'placeholder'
78+
while next_page_definition is not None:
79+
cur_page = self.list(policy_id, page=cur_page_num)
80+
condition_list = condition_list + cur_page['conditions']
81+
82+
next_page_definition = cur_page.get('pages', {}).get('next', None)
83+
cur_page_num = cur_page_num + 1
84+
85+
return { 'conditions': condition_list }
86+
7487
def update(
7588
self, alert_condition_id, policy_id,
7689
type=None,

0 commit comments

Comments
 (0)