Skip to content

Commit 6a57993

Browse files
[ACS JobRouter] Enum discriminators for polymorphic base classes (Azure#33149)
* change discriminator type for polymorphic base classes + fix mypy issues * regen code with 'stream' kwarg removed * update assets.json * more mypy fixes - suppress mypy in samples * manually update generated operations to return the (Async)ItemPaged[TEntity]
1 parent da947a9 commit 6a57993

32 files changed

+1813
-366
lines changed

sdk/communication/azure-communication-jobrouter/CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,27 @@
5555
- Removed property `assignment_id`
5656
- `CompleteJobOptions`
5757
- Removed property `assignment_id`
58+
- `JobMatchingMode`
59+
- Property `kind` - Changed from `str` to `JobMatchingModeKind`
60+
- Affected derived classes: `QueueAndMatchMode`, `ScheduleAndSuspendMode`, `SuspendMode`
61+
- `RouterRule`
62+
- Property `kind` - Changed from `str` to `RouterRuleKind`
63+
- Affected derived classes: `DirectMapRouterRule`, `ExpressionRouterRule`, `FunctionRouterRule`, `StaticRouterRule`, `WebhookRouterRule`
64+
- `DistributionMode`
65+
- Property `kind` - Changed from `str` to `DistributionModeKind`
66+
- Affected derived classes: `RoundRobinMode`, `LongestIdleMode`, `BestWorkerMode`
67+
- `ExceptionTrigger`
68+
- Property `kind` - Changed from `str` to `ExceptionTriggerKind`
69+
- Affected derived classes: `QueueLengthExceptionTrigger`, `WaitTimeExceptionTrigger`
70+
- `ExceptionAction`
71+
- Property `kind` - Changed from `str` to `ExceptionActionKind`
72+
- Affected derived classes: `CancelExceptionAction`, `ManualReclassifyExceptionAction`, `ReclassifyExceptionAction`
73+
- `QueueSelectorAttachment`
74+
- Property `kind` - Changed from `str` to `QueueSelectorAttachmentKind`
75+
- Affected derived classes: `ConditionalQueueSelectorAttachment`, `PassThroughQueueSelectorAttachment`, `RuleEngineQueueSelectorAttachment`, `StaticQueueSelectorAttachment`, `WeightedAllocationQueueSelectorAttachment`
76+
- `WorkerSelectorAttachment`
77+
- Property `kind` - Changed from `str` to `WorkerSelectorAttachmentKind`
78+
- Affected derived classes: `ConditionalWorkerSelectorAttachment`, `PassThroughWorkerSelectorAttachment`, `RuleEngineWorkerSelectorAttachment`, `StaticWorkerSelectorAttachment`, `WeightedAllocationWorkerSelectorAttachment`
5879

5980
#### Renames
6081
- `ChannelConfiguration` -> `RouterChannel`

sdk/communication/azure-communication-jobrouter/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/communication/azure-communication-jobrouter",
5-
"Tag": "python/communication/azure-communication-jobrouter_40b4f337cd"
5+
"Tag": "python/communication/azure-communication-jobrouter_19ef87bca3"
66
}

sdk/communication/azure-communication-jobrouter/azure/communication/jobrouter/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._client import JobRouterAdministrationClient
10-
from ._client import JobRouterClient
9+
from ._patch import JobRouterAdministrationClient
10+
from ._patch import JobRouterClient
1111
from ._version import VERSION
1212

1313
__version__ = VERSION

sdk/communication/azure-communication-jobrouter/azure/communication/jobrouter/_operations/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._operations import JobRouterAdministrationClientOperationsMixin
10-
from ._operations import JobRouterClientOperationsMixin
9+
from ._patch import JobRouterAdministrationClientOperationsMixin
10+
from ._patch import JobRouterClientOperationsMixin
1111

1212
from ._patch import __all__ as _patch_all
1313
from ._patch import * # pylint: disable=unused-wildcard-import

sdk/communication/azure-communication-jobrouter/azure/communication/jobrouter/_operations/_operations.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from io import IOBase
1111
import json
1212
import sys
13-
from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload
13+
from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload
1414
import urllib.parse
1515

1616
from azure.core import MatchConditions
@@ -1286,7 +1286,7 @@ def get_distribution_policy(self, distribution_policy_id: str, **kwargs: Any) ->
12861286
return deserialized # type: ignore
12871287

12881288
@distributed_trace
1289-
def list_distribution_policies(self, **kwargs: Any) -> Iterable["_models.DistributionPolicy"]:
1289+
def list_distribution_policies(self, **kwargs: Any) -> ItemPaged["_models.DistributionPolicy"]:
12901290
"""Retrieves existing distribution policies.
12911291
12921292
Retrieves existing distribution policies.
@@ -1383,8 +1383,6 @@ def delete_distribution_policy( # pylint: disable=inconsistent-return-statement
13831383
13841384
:param distribution_policy_id: The unique identifier of the policy. Required.
13851385
:type distribution_policy_id: str
1386-
:keyword bool stream: Whether to stream the response of this operation. Defaults to False. You
1387-
will have to context manage the returned stream.
13881386
:return: None
13891387
:rtype: None
13901388
:raises ~azure.core.exceptions.HttpResponseError:
@@ -1725,7 +1723,7 @@ def get_classification_policy(self, classification_policy_id: str, **kwargs: Any
17251723
return deserialized # type: ignore
17261724

17271725
@distributed_trace
1728-
def list_classification_policies(self, **kwargs: Any) -> Iterable["_models.ClassificationPolicy"]:
1726+
def list_classification_policies(self, **kwargs: Any) -> ItemPaged["_models.ClassificationPolicy"]:
17291727
"""Retrieves existing classification policies.
17301728
17311729
Retrieves existing classification policies.
@@ -1823,8 +1821,6 @@ def delete_classification_policy( # pylint: disable=inconsistent-return-stateme
18231821
18241822
:param classification_policy_id: Unique identifier of this policy. Required.
18251823
:type classification_policy_id: str
1826-
:keyword bool stream: Whether to stream the response of this operation. Defaults to False. You
1827-
will have to context manage the returned stream.
18281824
:return: None
18291825
:rtype: None
18301826
:raises ~azure.core.exceptions.HttpResponseError:
@@ -2165,7 +2161,7 @@ def get_exception_policy(self, exception_policy_id: str, **kwargs: Any) -> _mode
21652161
return deserialized # type: ignore
21662162

21672163
@distributed_trace
2168-
def list_exception_policies(self, **kwargs: Any) -> Iterable["_models.ExceptionPolicy"]:
2164+
def list_exception_policies(self, **kwargs: Any) -> ItemPaged["_models.ExceptionPolicy"]:
21692165
"""Retrieves existing exception policies.
21702166
21712167
Retrieves existing exception policies.
@@ -2262,8 +2258,6 @@ def delete_exception_policy( # pylint: disable=inconsistent-return-statements
22622258
22632259
:param exception_policy_id: The Id of the exception policy. Required.
22642260
:type exception_policy_id: str
2265-
:keyword bool stream: Whether to stream the response of this operation. Defaults to False. You
2266-
will have to context manage the returned stream.
22672261
:return: None
22682262
:rtype: None
22692263
:raises ~azure.core.exceptions.HttpResponseError:
@@ -2604,7 +2598,7 @@ def get_queue(self, queue_id: str, **kwargs: Any) -> _models.RouterQueue:
26042598
return deserialized # type: ignore
26052599

26062600
@distributed_trace
2607-
def list_queues(self, **kwargs: Any) -> Iterable["_models.RouterQueue"]:
2601+
def list_queues(self, **kwargs: Any) -> ItemPaged["_models.RouterQueue"]:
26082602
"""Retrieves existing queues.
26092603
26102604
Retrieves existing queues.
@@ -2699,8 +2693,6 @@ def delete_queue(self, queue_id: str, **kwargs: Any) -> None: # pylint: disable
26992693
27002694
:param queue_id: The Id of this queue. Required.
27012695
:type queue_id: str
2702-
:keyword bool stream: Whether to stream the response of this operation. Defaults to False. You
2703-
will have to context manage the returned stream.
27042696
:return: None
27052697
:rtype: None
27062698
:raises ~azure.core.exceptions.HttpResponseError:
@@ -3050,8 +3042,6 @@ def delete_job(self, job_id: str, **kwargs: Any) -> None: # pylint: disable=inc
30503042
30513043
:param job_id: The id of the job. Required.
30523044
:type job_id: str
3053-
:keyword bool stream: Whether to stream the response of this operation. Defaults to False. You
3054-
will have to context manage the returned stream.
30553045
:return: None
30563046
:rtype: None
30573047
:raises ~azure.core.exceptions.HttpResponseError:
@@ -3578,7 +3568,7 @@ def list_jobs(
35783568
scheduled_before: Optional[datetime.datetime] = None,
35793569
scheduled_after: Optional[datetime.datetime] = None,
35803570
**kwargs: Any
3581-
) -> Iterable["_models.RouterJob"]:
3571+
) -> ItemPaged["_models.RouterJob"]:
35823572
"""Retrieves list of jobs based on filter parameters.
35833573
35843574
Retrieves list of jobs based on filter parameters.
@@ -4489,8 +4479,6 @@ def delete_worker(self, worker_id: str, **kwargs: Any) -> None: # pylint: disab
44894479
44904480
:param worker_id: Id of the worker. Required.
44914481
:type worker_id: str
4492-
:keyword bool stream: Whether to stream the response of this operation. Defaults to False. You
4493-
will have to context manage the returned stream.
44944482
:return: None
44954483
:rtype: None
44964484
:raises ~azure.core.exceptions.HttpResponseError:
@@ -4544,7 +4532,7 @@ def list_workers(
45444532
queue_id: Optional[str] = None,
45454533
has_capacity: Optional[bool] = None,
45464534
**kwargs: Any
4547-
) -> Iterable["_models.RouterWorker"]:
4535+
) -> ItemPaged["_models.RouterWorker"]:
45484536
"""Retrieves existing workers.
45494537
45504538
Retrieves existing workers.

0 commit comments

Comments
 (0)