Skip to content

Commit 0b652b8

Browse files
Merge remote-tracking branch 'upstream/master' into CPS-43-logger-improvements
2 parents d669d97 + 97fb781 commit 0b652b8

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

connect/models/schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ def make_object(self, data):
502502
class TierAccountsSchema(Schema):
503503
customer = fields.Nested(TierAccountSchema)
504504
tier1 = fields.Nested(TierAccountSchema)
505-
tier2 = fields.Nested(TierAccountSchema)
505+
tier2 = fields.Nested(TierAccountSchema, allow_none=True)
506506

507507
@post_load
508508
def make_object(self, data):

connect/models/tier_accounts.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# This file is part of the Ingram Micro Cloud Blue Connect SDK.
44
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.
55

6+
from typing import Optional
7+
68
from .base import BaseModel
79
from .tier_account import TierAccount
810
from .schemas import TierAccountsSchema
@@ -19,5 +21,5 @@ class TierAccounts(BaseModel):
1921
tier1 = None # type: TierAccount
2022
""" (:py:class:`.TierAccount`) Level 1 TierAccount Object. """
2123

22-
tier2 = None # type: TierAccount
23-
""" (:py:class:`.TierAccount`) Level 2 TierAccount Object. """
24+
tier2 = None # type: Optional[TierAccount]
25+
""" (:py:class:`.TierAccount` | None) Level 2 TierAccount Object. """

connect/resources/tier_config_automation.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,31 @@ class TierConfigAutomation(AutomationEngine):
3838
model_class = TierConfigRequest
3939
logger = logging.getLogger('Tier.logger')
4040

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

0 commit comments

Comments
 (0)