Skip to content

Commit 610a33b

Browse files
azure-sdkChenxiJiang333berndverst
authored
[AutoRelease] t2-durabletask-2025-04-16-69057(can only be merged by SDK owner) (#40537)
* code and test * update testcases * Update sdk/durabletask/azure-mgmt-durabletask/CHANGELOG.md Update release date --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Bernd Verst <[email protected]>
1 parent 66499e1 commit 610a33b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2584
-123
lines changed

sdk/durabletask/azure-mgmt-durabletask/CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Release History
22

3+
## 1.0.0b2 (2025-04-24)
4+
5+
### Features Added
6+
7+
- Client `DurableTaskMgmtClient` added operation group `retention_policies`
8+
- Added enum `PurgeableOrchestrationState`
9+
- Added model `RetentionPolicy`
10+
- Added model `RetentionPolicyDetails`
11+
- Added model `RetentionPolicyProperties`
12+
- Added operation group `RetentionPoliciesOperations`
13+
314
## 1.0.0b1 (2025-03-25)
415

516
### Other Changes

sdk/durabletask/azure-mgmt-durabletask/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Durabletask Management Client Library.
4-
This package has been tested with Python 3.8+.
4+
This package has been tested with Python 3.9+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.8+ is required to use this package.
15+
- Python 3.9+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
@@ -24,7 +24,7 @@ pip install azure-identity
2424

2525
### Authentication
2626

27-
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables.
2828

2929
- `AZURE_CLIENT_ID` for Azure client ID.
3030
- `AZURE_TENANT_ID` for Azure tenant ID.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"commit": "7b8c7b5a83ea874d6edf8f01d44bd923a664f31e",
2+
"commit": "5edf0e869b189cadbf815ff0ce60f75b86a08c33",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"typespec_src": "specification/durabletask/DurableTask.Management",
5-
"@azure-tools/typespec-python": "0.39.1"
5+
"@azure-tools/typespec-python": "0.42.3"
66
}

sdk/durabletask/azure-mgmt-durabletask/apiview-properties.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"azure.mgmt.durabletask.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay",
99
"azure.mgmt.durabletask.models.Resource": "Azure.ResourceManager.CommonTypes.Resource",
1010
"azure.mgmt.durabletask.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource",
11+
"azure.mgmt.durabletask.models.RetentionPolicy": "Microsoft.DurableTask.RetentionPolicy",
12+
"azure.mgmt.durabletask.models.RetentionPolicyDetails": "Microsoft.DurableTask.RetentionPolicyDetails",
13+
"azure.mgmt.durabletask.models.RetentionPolicyProperties": "Microsoft.DurableTask.RetentionPolicyProperties",
1114
"azure.mgmt.durabletask.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
1215
"azure.mgmt.durabletask.models.Scheduler": "Microsoft.DurableTask.Scheduler",
1316
"azure.mgmt.durabletask.models.SchedulerProperties": "Microsoft.DurableTask.SchedulerProperties",
@@ -23,6 +26,7 @@
2326
"azure.mgmt.durabletask.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType",
2427
"azure.mgmt.durabletask.models.ProvisioningState": "Microsoft.DurableTask.ProvisioningState",
2528
"azure.mgmt.durabletask.models.RedundancyState": "Microsoft.DurableTask.RedundancyState",
29+
"azure.mgmt.durabletask.models.PurgeableOrchestrationState": "Microsoft.DurableTask.PurgeableOrchestrationState",
2630
"azure.mgmt.durabletask.DurableTaskMgmtClient.operations.list": "Azure.ResourceManager.Operations.list",
2731
"azure.mgmt.durabletask.DurableTaskMgmtClient.schedulers.get": "Microsoft.DurableTask.Schedulers.get",
2832
"azure.mgmt.durabletask.DurableTaskMgmtClient.schedulers.begin_create_or_update": "Microsoft.DurableTask.Schedulers.createOrUpdate",
@@ -33,6 +37,11 @@
3337
"azure.mgmt.durabletask.DurableTaskMgmtClient.task_hubs.get": "Microsoft.DurableTask.TaskHubs.get",
3438
"azure.mgmt.durabletask.DurableTaskMgmtClient.task_hubs.begin_create_or_update": "Microsoft.DurableTask.TaskHubs.createOrUpdate",
3539
"azure.mgmt.durabletask.DurableTaskMgmtClient.task_hubs.begin_delete": "Microsoft.DurableTask.TaskHubs.delete",
36-
"azure.mgmt.durabletask.DurableTaskMgmtClient.task_hubs.list_by_scheduler": "Microsoft.DurableTask.TaskHubs.listByScheduler"
40+
"azure.mgmt.durabletask.DurableTaskMgmtClient.task_hubs.list_by_scheduler": "Microsoft.DurableTask.TaskHubs.listByScheduler",
41+
"azure.mgmt.durabletask.DurableTaskMgmtClient.retention_policies.get": "Microsoft.DurableTask.RetentionPolicies.get",
42+
"azure.mgmt.durabletask.DurableTaskMgmtClient.retention_policies.begin_create_or_replace": "Microsoft.DurableTask.RetentionPolicies.createOrReplace",
43+
"azure.mgmt.durabletask.DurableTaskMgmtClient.retention_policies.begin_update": "Microsoft.DurableTask.RetentionPolicies.update",
44+
"azure.mgmt.durabletask.DurableTaskMgmtClient.retention_policies.begin_delete": "Microsoft.DurableTask.RetentionPolicies.delete",
45+
"azure.mgmt.durabletask.DurableTaskMgmtClient.retention_policies.list_by_scheduler": "Microsoft.DurableTask.RetentionPolicies.listByScheduler"
3746
}
3847
}

sdk/durabletask/azure-mgmt-durabletask/azure/mgmt/durabletask/_client.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from ._configuration import DurableTaskMgmtClientConfiguration
1919
from ._serialization import Deserializer, Serializer
20-
from .operations import Operations, SchedulersOperations, TaskHubsOperations
20+
from .operations import Operations, RetentionPoliciesOperations, SchedulersOperations, TaskHubsOperations
2121

2222
if TYPE_CHECKING:
2323
from azure.core.credentials import TokenCredential
@@ -32,14 +32,16 @@ class DurableTaskMgmtClient:
3232
:vartype schedulers: azure.mgmt.durabletask.operations.SchedulersOperations
3333
:ivar task_hubs: TaskHubsOperations operations
3434
:vartype task_hubs: azure.mgmt.durabletask.operations.TaskHubsOperations
35+
:ivar retention_policies: RetentionPoliciesOperations operations
36+
:vartype retention_policies: azure.mgmt.durabletask.operations.RetentionPoliciesOperations
3537
:param credential: Credential used to authenticate requests to the service. Required.
3638
:type credential: ~azure.core.credentials.TokenCredential
3739
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3840
:type subscription_id: str
3941
:param base_url: Service host. Default value is "https://management.azure.com".
4042
:type base_url: str
4143
:keyword api_version: The API version to use for this operation. Default value is
42-
"2024-10-01-preview". Note that overriding this default value may result in unsupported
44+
"2025-04-01-preview". Note that overriding this default value may result in unsupported
4345
behavior.
4446
:paramtype api_version: str
4547
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -83,6 +85,9 @@ def __init__(
8385
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
8486
self.schedulers = SchedulersOperations(self._client, self._config, self._serialize, self._deserialize)
8587
self.task_hubs = TaskHubsOperations(self._client, self._config, self._serialize, self._deserialize)
88+
self.retention_policies = RetentionPoliciesOperations(
89+
self._client, self._config, self._serialize, self._deserialize
90+
)
8691

8792
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
8893
"""Runs the network request through the client's chained policies.

sdk/durabletask/azure-mgmt-durabletask/azure/mgmt/durabletask/_configuration.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DurableTaskMgmtClientConfiguration: # pylint: disable=too-many-instance-a
3030
:param base_url: Service host. Default value is "https://management.azure.com".
3131
:type base_url: str
3232
:keyword api_version: The API version to use for this operation. Default value is
33-
"2024-10-01-preview". Note that overriding this default value may result in unsupported
33+
"2025-04-01-preview". Note that overriding this default value may result in unsupported
3434
behavior.
3535
:paramtype api_version: str
3636
"""
@@ -42,7 +42,7 @@ def __init__(
4242
base_url: str = "https://management.azure.com",
4343
**kwargs: Any
4444
) -> None:
45-
api_version: str = kwargs.pop("api_version", "2024-10-01-preview")
45+
api_version: str = kwargs.pop("api_version", "2025-04-01-preview")
4646

4747
if credential is None:
4848
raise ValueError("Parameter 'credential' must not be None.")

sdk/durabletask/azure-mgmt-durabletask/azure/mgmt/durabletask/_model_base.py

+12-15
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# coding=utf-8
33
# --------------------------------------------------------------------------
44
# Copyright (c) Microsoft Corporation. All rights reserved.
5-
# Licensed under the MIT License. See License.txt in the project root for
6-
# license information.
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# Code generated by Microsoft (R) Python Code Generator.
7+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
78
# --------------------------------------------------------------------------
89
# pylint: disable=protected-access, broad-except
910

@@ -21,18 +22,14 @@
2122
from datetime import datetime, date, time, timedelta, timezone
2223
from json import JSONEncoder
2324
import xml.etree.ElementTree as ET
25+
from collections.abc import MutableMapping
2426
from typing_extensions import Self
2527
import isodate
2628
from azure.core.exceptions import DeserializationError
2729
from azure.core import CaseInsensitiveEnumMeta
2830
from azure.core.pipeline import PipelineResponse
2931
from azure.core.serialization import _Null
3032

31-
if sys.version_info >= (3, 9):
32-
from collections.abc import MutableMapping
33-
else:
34-
from typing import MutableMapping
35-
3633
_LOGGER = logging.getLogger(__name__)
3734

3835
__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"]
@@ -347,7 +344,7 @@ def _get_model(module_name: str, model_name: str):
347344
_UNSET = object()
348345

349346

350-
class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object
347+
class _MyMutableMapping(MutableMapping[str, typing.Any]):
351348
def __init__(self, data: typing.Dict[str, typing.Any]) -> None:
352349
self._data = data
353350

@@ -407,13 +404,13 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any:
407404
return default
408405

409406
@typing.overload
410-
def pop(self, key: str) -> typing.Any: ...
407+
def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ
411408

412409
@typing.overload
413-
def pop(self, key: str, default: _T) -> _T: ...
410+
def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs
414411

415412
@typing.overload
416-
def pop(self, key: str, default: typing.Any) -> typing.Any: ...
413+
def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs
417414

418415
def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
419416
"""
@@ -443,7 +440,7 @@ def clear(self) -> None:
443440
"""
444441
self._data.clear()
445442

446-
def update(self, *args: typing.Any, **kwargs: typing.Any) -> None:
443+
def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ
447444
"""
448445
Updates D from mapping/iterable E and F.
449446
:param any args: Either a mapping object or an iterable of key-value pairs.
@@ -454,7 +451,7 @@ def update(self, *args: typing.Any, **kwargs: typing.Any) -> None:
454451
def setdefault(self, key: str, default: None = None) -> None: ...
455452

456453
@typing.overload
457-
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ...
454+
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs
458455

459456
def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
460457
"""
@@ -644,7 +641,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self:
644641
cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items())
645642
cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}")
646643

647-
return super().__new__(cls) # pylint: disable=no-value-for-parameter
644+
return super().__new__(cls)
648645

649646
def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None:
650647
for base in cls.__bases__:
@@ -680,7 +677,7 @@ def _deserialize(cls, data, exist_discriminators):
680677
discriminator_value = data.find(xml_name).text # pyright: ignore
681678
else:
682679
discriminator_value = data.get(discriminator._rest_name)
683-
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore
680+
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member
684681
return mapped_cls._deserialize(data, exist_discriminators)
685682

686683
def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]:

sdk/durabletask/azure-mgmt-durabletask/azure/mgmt/durabletask/_patch.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# ------------------------------------
2-
# Copyright (c) Microsoft Corporation.
3-
# Licensed under the MIT License.
4-
# ------------------------------------
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# --------------------------------------------------------------------------
56
"""Customize generated code here.
67
78
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize

sdk/durabletask/azure-mgmt-durabletask/azure/mgmt/durabletask/_serialization.py

+4-22
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
11
# pylint: disable=line-too-long,useless-suppression,too-many-lines
2+
# coding=utf-8
23
# --------------------------------------------------------------------------
3-
#
44
# Copyright (c) Microsoft Corporation. All rights reserved.
5-
#
6-
# The MIT License (MIT)
7-
#
8-
# Permission is hereby granted, free of charge, to any person obtaining a copy
9-
# of this software and associated documentation files (the ""Software""), to
10-
# deal in the Software without restriction, including without limitation the
11-
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12-
# sell copies of the Software, and to permit persons to whom the Software is
13-
# furnished to do so, subject to the following conditions:
14-
#
15-
# The above copyright notice and this permission notice shall be included in
16-
# all copies or substantial portions of the Software.
17-
#
18-
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24-
# IN THE SOFTWARE.
25-
#
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# Code generated by Microsoft (R) Python Code Generator.
7+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
268
# --------------------------------------------------------------------------
279

2810
# pyright: reportUnnecessaryTypeIgnoreComment=false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# Code generated by Microsoft (R) Python Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------
7+
import functools
8+
9+
10+
def api_version_validation(**kwargs):
11+
params_added_on = kwargs.pop("params_added_on", {})
12+
method_added_on = kwargs.pop("method_added_on", "")
13+
14+
def decorator(func):
15+
@functools.wraps(func)
16+
def wrapper(*args, **kwargs):
17+
try:
18+
# this assumes the client has an _api_version attribute
19+
client = args[0]
20+
client_api_version = client._config.api_version # pylint: disable=protected-access
21+
except AttributeError:
22+
return func(*args, **kwargs)
23+
24+
if method_added_on > client_api_version:
25+
raise ValueError(
26+
f"'{func.__name__}' is not available in API version "
27+
f"{client_api_version}. Pass service API version {method_added_on} or newer to your client."
28+
)
29+
30+
unsupported = {
31+
parameter: api_version
32+
for api_version, parameters in params_added_on.items()
33+
for parameter in parameters
34+
if parameter in kwargs and api_version > client_api_version
35+
}
36+
if unsupported:
37+
raise ValueError(
38+
"".join(
39+
[
40+
f"'{param}' is not available in API version {client_api_version}. "
41+
f"Use service API version {version} or newer.\n"
42+
for param, version in unsupported.items()
43+
]
44+
)
45+
)
46+
return func(*args, **kwargs)
47+
48+
return wrapper
49+
50+
return decorator

sdk/durabletask/azure-mgmt-durabletask/azure/mgmt/durabletask/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "1.0.0b1"
9+
VERSION = "1.0.0b2"

sdk/durabletask/azure-mgmt-durabletask/azure/mgmt/durabletask/aio/_client.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from .._serialization import Deserializer, Serializer
1919
from ._configuration import DurableTaskMgmtClientConfiguration
20-
from .operations import Operations, SchedulersOperations, TaskHubsOperations
20+
from .operations import Operations, RetentionPoliciesOperations, SchedulersOperations, TaskHubsOperations
2121

2222
if TYPE_CHECKING:
2323
from azure.core.credentials_async import AsyncTokenCredential
@@ -32,14 +32,16 @@ class DurableTaskMgmtClient:
3232
:vartype schedulers: azure.mgmt.durabletask.aio.operations.SchedulersOperations
3333
:ivar task_hubs: TaskHubsOperations operations
3434
:vartype task_hubs: azure.mgmt.durabletask.aio.operations.TaskHubsOperations
35+
:ivar retention_policies: RetentionPoliciesOperations operations
36+
:vartype retention_policies: azure.mgmt.durabletask.aio.operations.RetentionPoliciesOperations
3537
:param credential: Credential used to authenticate requests to the service. Required.
3638
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
3739
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3840
:type subscription_id: str
3941
:param base_url: Service host. Default value is "https://management.azure.com".
4042
:type base_url: str
4143
:keyword api_version: The API version to use for this operation. Default value is
42-
"2024-10-01-preview". Note that overriding this default value may result in unsupported
44+
"2025-04-01-preview". Note that overriding this default value may result in unsupported
4345
behavior.
4446
:paramtype api_version: str
4547
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
@@ -83,6 +85,9 @@ def __init__(
8385
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
8486
self.schedulers = SchedulersOperations(self._client, self._config, self._serialize, self._deserialize)
8587
self.task_hubs = TaskHubsOperations(self._client, self._config, self._serialize, self._deserialize)
88+
self.retention_policies = RetentionPoliciesOperations(
89+
self._client, self._config, self._serialize, self._deserialize
90+
)
8691

8792
def send_request(
8893
self, request: HttpRequest, *, stream: bool = False, **kwargs: Any

0 commit comments

Comments
 (0)