Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connect/models/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def make_object(self, data):
class TierAccountsSchema(Schema):
customer = fields.Nested(TierAccountSchema)
tier1 = fields.Nested(TierAccountSchema)
tier2 = fields.Nested(TierAccountSchema)
tier2 = fields.Nested(TierAccountSchema, allow_none=True)

@post_load
def make_object(self, data):
Expand Down
6 changes: 4 additions & 2 deletions connect/models/tier_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# This file is part of the Ingram Micro Cloud Blue Connect SDK.
# Copyright (c) 2019 Ingram Micro. All Rights Reserved.

from typing import Optional

from .base import BaseModel
from .tier_account import TierAccount
from .schemas import TierAccountsSchema
Expand All @@ -19,5 +21,5 @@ class TierAccounts(BaseModel):
tier1 = None # type: TierAccount
""" (:py:class:`.TierAccount`) Level 1 TierAccount Object. """

tier2 = None # type: TierAccount
""" (:py:class:`.TierAccount`) Level 2 TierAccount Object. """
tier2 = None # type: Optional[TierAccount]
""" (:py:class:`.TierAccount` | None) Level 2 TierAccount Object. """
25 changes: 25 additions & 0 deletions connect/resources/tier_config_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ class TierConfigAutomation(AutomationEngine):
resource = 'tier/config-requests'
model_class = TierConfigRequest

def filters(self, status='pending', **kwargs):
""" Returns the default set of filters for Tier Config request, plus any others that you
might specify. The allowed filters are:

- type
- status
- id
- configuration__id
- configuration__tier_level
- configuration__account__id
- configuration__product__id
- assignee__id
- unassigned (bool)
- configuration__account__external_uid

:param str status: Status of the requests. Default: ``'pending'``.
:param dict[str,Any] kwargs: Additional filters to add to the default ones.
:return: The set of filters for this resource.
:rtype: dict[str,Any]
"""
filters = super(TierConfigAutomation, self).filters(status=status, **kwargs)
if self.config.products:
filters['configuration__product__id'] = ','.join(self.config.products)
return filters

@function_log
def dispatch(self, request):
# type: (TierConfigRequest) -> str
Expand Down