Skip to content

Commit 137bc32

Browse files
authored
code and test (#43129)
Co-authored-by: azure-sdk <PythonSdkPipelines>
1 parent 5bfecee commit 137bc32

40 files changed

+3671
-311
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Release History
22

3+
## 1.0.0 (2025-09-25)
4+
5+
### Features Added
6+
7+
- Model `DurableTaskMgmtClient` added parameter `cloud_setting` in method `__init__`
8+
- Added enum `SchedulerSkuName`
9+
310
## 1.0.0b2 (2025-04-24)
411

512
### Features Added
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
include _meta.json
2-
recursive-include tests *.py *.json
3-
recursive-include samples *.py *.md
41
include *.md
5-
include azure/__init__.py
6-
include azure/mgmt/__init__.py
72
include LICENSE
83
include azure/mgmt/durabletask/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
6+
include azure/__init__.py
7+
include azure/mgmt/__init__.py
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2-
"commit": "5edf0e869b189cadbf815ff0ce60f75b86a08c33",
2+
"apiVersion": "2025-11-01",
3+
"commit": "688609bf18c3978794a0c5ca31557c286c623b44",
34
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
45
"typespec_src": "specification/durabletask/DurableTask.Management",
5-
"@azure-tools/typespec-python": "0.42.3"
6+
"emitterVersion": "0.51.2"
67
}

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

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,40 @@
2525
"azure.mgmt.durabletask.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType",
2626
"azure.mgmt.durabletask.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType",
2727
"azure.mgmt.durabletask.models.ProvisioningState": "Microsoft.DurableTask.ProvisioningState",
28+
"azure.mgmt.durabletask.models.SchedulerSkuName": "Microsoft.DurableTask.SchedulerSkuName",
2829
"azure.mgmt.durabletask.models.RedundancyState": "Microsoft.DurableTask.RedundancyState",
2930
"azure.mgmt.durabletask.models.PurgeableOrchestrationState": "Microsoft.DurableTask.PurgeableOrchestrationState",
30-
"azure.mgmt.durabletask.DurableTaskMgmtClient.operations.list": "Azure.ResourceManager.Operations.list",
31-
"azure.mgmt.durabletask.DurableTaskMgmtClient.schedulers.get": "Microsoft.DurableTask.Schedulers.get",
32-
"azure.mgmt.durabletask.DurableTaskMgmtClient.schedulers.begin_create_or_update": "Microsoft.DurableTask.Schedulers.createOrUpdate",
33-
"azure.mgmt.durabletask.DurableTaskMgmtClient.schedulers.begin_update": "Microsoft.DurableTask.Schedulers.update",
34-
"azure.mgmt.durabletask.DurableTaskMgmtClient.schedulers.begin_delete": "Microsoft.DurableTask.Schedulers.delete",
35-
"azure.mgmt.durabletask.DurableTaskMgmtClient.schedulers.list_by_resource_group": "Microsoft.DurableTask.Schedulers.listByResourceGroup",
36-
"azure.mgmt.durabletask.DurableTaskMgmtClient.schedulers.list_by_subscription": "Microsoft.DurableTask.Schedulers.listBySubscription",
37-
"azure.mgmt.durabletask.DurableTaskMgmtClient.task_hubs.get": "Microsoft.DurableTask.TaskHubs.get",
38-
"azure.mgmt.durabletask.DurableTaskMgmtClient.task_hubs.begin_create_or_update": "Microsoft.DurableTask.TaskHubs.createOrUpdate",
39-
"azure.mgmt.durabletask.DurableTaskMgmtClient.task_hubs.begin_delete": "Microsoft.DurableTask.TaskHubs.delete",
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"
31+
"azure.mgmt.durabletask.operations.Operations.list": "Azure.ResourceManager.Operations.list",
32+
"azure.mgmt.durabletask.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list",
33+
"azure.mgmt.durabletask.operations.SchedulersOperations.get": "Microsoft.DurableTask.Schedulers.get",
34+
"azure.mgmt.durabletask.aio.operations.SchedulersOperations.get": "Microsoft.DurableTask.Schedulers.get",
35+
"azure.mgmt.durabletask.operations.SchedulersOperations.begin_create_or_update": "Microsoft.DurableTask.Schedulers.createOrUpdate",
36+
"azure.mgmt.durabletask.aio.operations.SchedulersOperations.begin_create_or_update": "Microsoft.DurableTask.Schedulers.createOrUpdate",
37+
"azure.mgmt.durabletask.operations.SchedulersOperations.begin_update": "Microsoft.DurableTask.Schedulers.update",
38+
"azure.mgmt.durabletask.aio.operations.SchedulersOperations.begin_update": "Microsoft.DurableTask.Schedulers.update",
39+
"azure.mgmt.durabletask.operations.SchedulersOperations.begin_delete": "Microsoft.DurableTask.Schedulers.delete",
40+
"azure.mgmt.durabletask.aio.operations.SchedulersOperations.begin_delete": "Microsoft.DurableTask.Schedulers.delete",
41+
"azure.mgmt.durabletask.operations.SchedulersOperations.list_by_resource_group": "Microsoft.DurableTask.Schedulers.listByResourceGroup",
42+
"azure.mgmt.durabletask.aio.operations.SchedulersOperations.list_by_resource_group": "Microsoft.DurableTask.Schedulers.listByResourceGroup",
43+
"azure.mgmt.durabletask.operations.SchedulersOperations.list_by_subscription": "Microsoft.DurableTask.Schedulers.listBySubscription",
44+
"azure.mgmt.durabletask.aio.operations.SchedulersOperations.list_by_subscription": "Microsoft.DurableTask.Schedulers.listBySubscription",
45+
"azure.mgmt.durabletask.operations.TaskHubsOperations.get": "Microsoft.DurableTask.TaskHubs.get",
46+
"azure.mgmt.durabletask.aio.operations.TaskHubsOperations.get": "Microsoft.DurableTask.TaskHubs.get",
47+
"azure.mgmt.durabletask.operations.TaskHubsOperations.begin_create_or_update": "Microsoft.DurableTask.TaskHubs.createOrUpdate",
48+
"azure.mgmt.durabletask.aio.operations.TaskHubsOperations.begin_create_or_update": "Microsoft.DurableTask.TaskHubs.createOrUpdate",
49+
"azure.mgmt.durabletask.operations.TaskHubsOperations.begin_delete": "Microsoft.DurableTask.TaskHubs.delete",
50+
"azure.mgmt.durabletask.aio.operations.TaskHubsOperations.begin_delete": "Microsoft.DurableTask.TaskHubs.delete",
51+
"azure.mgmt.durabletask.operations.TaskHubsOperations.list_by_scheduler": "Microsoft.DurableTask.TaskHubs.listByScheduler",
52+
"azure.mgmt.durabletask.aio.operations.TaskHubsOperations.list_by_scheduler": "Microsoft.DurableTask.TaskHubs.listByScheduler",
53+
"azure.mgmt.durabletask.operations.RetentionPoliciesOperations.get": "Microsoft.DurableTask.RetentionPolicies.get",
54+
"azure.mgmt.durabletask.aio.operations.RetentionPoliciesOperations.get": "Microsoft.DurableTask.RetentionPolicies.get",
55+
"azure.mgmt.durabletask.operations.RetentionPoliciesOperations.begin_create_or_replace": "Microsoft.DurableTask.RetentionPolicies.createOrReplace",
56+
"azure.mgmt.durabletask.aio.operations.RetentionPoliciesOperations.begin_create_or_replace": "Microsoft.DurableTask.RetentionPolicies.createOrReplace",
57+
"azure.mgmt.durabletask.operations.RetentionPoliciesOperations.begin_update": "Microsoft.DurableTask.RetentionPolicies.update",
58+
"azure.mgmt.durabletask.aio.operations.RetentionPoliciesOperations.begin_update": "Microsoft.DurableTask.RetentionPolicies.update",
59+
"azure.mgmt.durabletask.operations.RetentionPoliciesOperations.begin_delete": "Microsoft.DurableTask.RetentionPolicies.delete",
60+
"azure.mgmt.durabletask.aio.operations.RetentionPoliciesOperations.begin_delete": "Microsoft.DurableTask.RetentionPolicies.delete",
61+
"azure.mgmt.durabletask.operations.RetentionPoliciesOperations.list_by_scheduler": "Microsoft.DurableTask.RetentionPolicies.listByScheduler",
62+
"azure.mgmt.durabletask.aio.operations.RetentionPoliciesOperations.list_by_scheduler": "Microsoft.DurableTask.RetentionPolicies.listByScheduler"
4663
}
4764
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

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

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,22 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any, TYPE_CHECKING
10+
from typing import Any, Optional, TYPE_CHECKING, cast
1111
from typing_extensions import Self
1212

1313
from azure.core.pipeline import policies
1414
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.core.settings import settings
1516
from azure.mgmt.core import ARMPipelineClient
1617
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
18+
from azure.mgmt.core.tools import get_arm_endpoints
1719

1820
from ._configuration import DurableTaskMgmtClientConfiguration
19-
from ._serialization import Deserializer, Serializer
21+
from ._utils.serialization import Deserializer, Serializer
2022
from .operations import Operations, RetentionPoliciesOperations, SchedulersOperations, TaskHubsOperations
2123

2224
if TYPE_CHECKING:
25+
from azure.core import AzureClouds
2326
from azure.core.credentials import TokenCredential
2427

2528

@@ -38,11 +41,13 @@ class DurableTaskMgmtClient:
3841
:type credential: ~azure.core.credentials.TokenCredential
3942
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4043
:type subscription_id: str
41-
:param base_url: Service host. Default value is "https://management.azure.com".
44+
:param base_url: Service host. Default value is None.
4245
:type base_url: str
43-
:keyword api_version: The API version to use for this operation. Default value is
44-
"2025-04-01-preview". Note that overriding this default value may result in unsupported
45-
behavior.
46+
:keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
47+
None.
48+
:paramtype cloud_setting: ~azure.core.AzureClouds
49+
:keyword api_version: The API version to use for this operation. Default value is "2025-11-01".
50+
Note that overriding this default value may result in unsupported behavior.
4651
:paramtype api_version: str
4752
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4853
Retry-After header is present.
@@ -52,13 +57,26 @@ def __init__(
5257
self,
5358
credential: "TokenCredential",
5459
subscription_id: str,
55-
base_url: str = "https://management.azure.com",
60+
base_url: Optional[str] = None,
61+
*,
62+
cloud_setting: Optional["AzureClouds"] = None,
5663
**kwargs: Any
5764
) -> None:
5865
_endpoint = "{endpoint}"
66+
_cloud = cloud_setting or settings.current.azure_cloud # type: ignore
67+
_endpoints = get_arm_endpoints(_cloud)
68+
if not base_url:
69+
base_url = _endpoints["resource_manager"]
70+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
5971
self._config = DurableTaskMgmtClientConfiguration(
60-
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
72+
credential=credential,
73+
subscription_id=subscription_id,
74+
base_url=cast(str, base_url),
75+
cloud_setting=cloud_setting,
76+
credential_scopes=credential_scopes,
77+
**kwargs
6178
)
79+
6280
_policies = kwargs.pop("policies", None)
6381
if _policies is None:
6482
_policies = [
@@ -77,7 +95,7 @@ def __init__(
7795
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
7896
self._config.http_logging_policy,
7997
]
80-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
98+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs)
8199

82100
self._serialize = Serializer()
83101
self._deserialize = Deserializer()

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

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

9-
from typing import Any, TYPE_CHECKING
9+
from typing import Any, Optional, TYPE_CHECKING
1010

1111
from azure.core.pipeline import policies
1212
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1313

1414
from ._version import VERSION
1515

1616
if TYPE_CHECKING:
17+
from azure.core import AzureClouds
1718
from azure.core.credentials import TokenCredential
1819

1920

@@ -29,9 +30,11 @@ class DurableTaskMgmtClientConfiguration: # pylint: disable=too-many-instance-a
2930
:type subscription_id: str
3031
:param base_url: Service host. Default value is "https://management.azure.com".
3132
:type base_url: str
32-
:keyword api_version: The API version to use for this operation. Default value is
33-
"2025-04-01-preview". Note that overriding this default value may result in unsupported
34-
behavior.
33+
:param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
34+
None.
35+
:type cloud_setting: ~azure.core.AzureClouds
36+
:keyword api_version: The API version to use for this operation. Default value is "2025-11-01".
37+
Note that overriding this default value may result in unsupported behavior.
3538
:paramtype api_version: str
3639
"""
3740

@@ -40,9 +43,10 @@ def __init__(
4043
credential: "TokenCredential",
4144
subscription_id: str,
4245
base_url: str = "https://management.azure.com",
46+
cloud_setting: Optional["AzureClouds"] = None,
4347
**kwargs: Any
4448
) -> None:
45-
api_version: str = kwargs.pop("api_version", "2025-04-01-preview")
49+
api_version: str = kwargs.pop("api_version", "2025-11-01")
4650

4751
if credential is None:
4852
raise ValueError("Parameter 'credential' must not be None.")
@@ -52,6 +56,7 @@ def __init__(
5256
self.credential = credential
5357
self.subscription_id = subscription_id
5458
self.base_url = base_url
59+
self.cloud_setting = cloud_setting
5560
self.api_version = api_version
5661
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5762
kwargs.setdefault("sdk_moniker", "mgmt-durabletask/{}".format(VERSION))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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+
# --------------------------------------------------------------------------

0 commit comments

Comments
 (0)