Skip to content

Commit a76127f

Browse files
Added default filters to TCRs.
1 parent e071bda commit a76127f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

connect/resources/tier_config_automation.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,31 @@ class TierConfigAutomation(AutomationEngine):
3636
resource = 'tier/config-requests'
3737
model_class = TierConfigRequest
3838

39+
def filters(self, status='pending', **kwargs):
40+
""" Returns the default set of filters for Tier Config request, plus any others that you
41+
might specify. The allowed filters are:
42+
43+
- type
44+
- status
45+
- id
46+
- configuration__id
47+
- configuration__tier_level
48+
- configuration__account__id
49+
- configuration__product__id
50+
- assignee__id
51+
- unassigned (bool)
52+
- configuration__account__external_uid
53+
54+
:param str status: Status of the requests. Default: ``'pending'``.
55+
:param dict[str,Any] kwargs: Additional filters to add to the default ones.
56+
:return: The set of filters for this resource.
57+
:rtype: dict[str,Any]
58+
"""
59+
filters = super(TierConfigAutomation, self).filters(status=status, **kwargs)
60+
if self.config.products:
61+
filters['asset.product.id__in'] = ','.join(self.config.products)
62+
return filters
63+
3964
@function_log
4065
def dispatch(self, request):
4166
# type: (TierConfigRequest) -> str

0 commit comments

Comments
 (0)