Skip to content

Commit 6e13e31

Browse files
author
SDKAuto
committed
CodeGen from PR 34242 in Azure/azure-rest-api-specs
Merge b161da61b24af61659fe321b939003a4340dbe4b into 31869e6038974dbd20dd5028feaec2c402835cad
1 parent ebf29c4 commit 6e13e31

File tree

73 files changed

+9972
-9424
lines changed

Some content is hidden

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

73 files changed

+9972
-9424
lines changed

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

Lines changed: 517 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 3 additions & 3 deletions
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 Databasewatcher 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.
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
2-
"commit": "07da438f8dc690946b39511467744ed889434de5",
2+
"commit": "860b6a84dd52db81fdbd34ee4e98a2c23a4026fc",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"typespec_src": "specification/databasewatcher/DatabaseWatcher.Management",
5-
"@azure-tools/typespec-python": "0.38.2"
5+
"@azure-tools/typespec-python": "0.38.2",
6+
"autorest": "3.10.2",
7+
"use": [
8+
"@autorest/[email protected]",
9+
"@autorest/[email protected]"
10+
],
11+
"autorest_command": "autorest specification/databasewatcher/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
12+
"readme": "specification/databasewatcher/resource-manager/readme.md"
613
}

sdk/databasewatcher/azure-mgmt-databasewatcher/azure/mgmt/databasewatcher/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) Python Code Generator.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88
# pylint: disable=wrong-import-position
@@ -12,7 +12,7 @@
1212
if TYPE_CHECKING:
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414

15-
from ._client import DatabaseWatcherMgmtClient # type: ignore
15+
from ._microsoft_database_watcher import MicrosoftDatabaseWatcher # type: ignore
1616
from ._version import VERSION
1717

1818
__version__ = VERSION
@@ -25,7 +25,7 @@
2525
from ._patch import patch_sdk as _patch_sdk
2626

2727
__all__ = [
28-
"DatabaseWatcherMgmtClient",
28+
"MicrosoftDatabaseWatcher",
2929
]
3030
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
3131

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

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) Python Code Generator.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

@@ -17,30 +17,22 @@
1717
from azure.core.credentials import TokenCredential
1818

1919

20-
class DatabaseWatcherMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes
21-
"""Configuration for DatabaseWatcherMgmtClient.
20+
class MicrosoftDatabaseWatcherConfiguration: # pylint: disable=too-many-instance-attributes
21+
"""Configuration for MicrosoftDatabaseWatcher.
2222
2323
Note that all parameters used to create this instance are saved as instance
2424
attributes.
2525
26-
:param credential: Credential used to authenticate requests to the service. Required.
26+
:param credential: Credential needed for the client to connect to Azure. Required.
2727
:type credential: ~azure.core.credentials.TokenCredential
2828
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
2929
:type subscription_id: str
30-
:param base_url: Service host. Default value is "https://management.azure.com".
31-
:type base_url: str
32-
:keyword api_version: The API version to use for this operation. Default value is "2025-01-02".
33-
Note that overriding this default value may result in unsupported behavior.
30+
:keyword api_version: Api Version. Default value is "2025-01-02". Note that overriding this
31+
default value may result in unsupported behavior.
3432
:paramtype api_version: str
3533
"""
3634

37-
def __init__(
38-
self,
39-
credential: "TokenCredential",
40-
subscription_id: str,
41-
base_url: str = "https://management.azure.com",
42-
**kwargs: Any
43-
) -> None:
35+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
4436
api_version: str = kwargs.pop("api_version", "2025-01-02")
4537

4638
if credential is None:
@@ -50,7 +42,6 @@ def __init__(
5042

5143
self.credential = credential
5244
self.subscription_id = subscription_id
53-
self.base_url = base_url
5445
self.api_version = api_version
5546
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5647
kwargs.setdefault("sdk_moniker", "mgmt-databasewatcher/{}".format(VERSION))

sdk/databasewatcher/azure-mgmt-databasewatcher/azure/mgmt/databasewatcher/_client.py renamed to sdk/databasewatcher/azure-mgmt-databasewatcher/azure/mgmt/databasewatcher/_microsoft_database_watcher.py

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) Python Code Generator.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
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

18-
from ._configuration import DatabaseWatcherMgmtClientConfiguration
19-
from ._serialization import Deserializer, Serializer
20+
from . import models as _models
21+
from ._configuration import MicrosoftDatabaseWatcherConfiguration
22+
from ._utils.serialization import Deserializer, Serializer
2023
from .operations import (
2124
AlertRuleResourcesOperations,
2225
HealthValidationsOperations,
@@ -30,8 +33,8 @@
3033
from azure.core.credentials import TokenCredential
3134

3235

33-
class DatabaseWatcherMgmtClient:
34-
"""DatabaseWatcherMgmtClient.
36+
class MicrosoftDatabaseWatcher:
37+
"""MicrosoftDatabaseWatcher.
3538
3639
:ivar operations: Operations operations
3740
:vartype operations: azure.mgmt.databasewatcher.operations.Operations
@@ -42,35 +45,36 @@ class DatabaseWatcherMgmtClient:
4245
azure.mgmt.databasewatcher.operations.AlertRuleResourcesOperations
4346
:ivar health_validations: HealthValidationsOperations operations
4447
:vartype health_validations: azure.mgmt.databasewatcher.operations.HealthValidationsOperations
45-
:ivar targets: TargetsOperations operations
46-
:vartype targets: azure.mgmt.databasewatcher.operations.TargetsOperations
4748
:ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations
4849
:vartype shared_private_link_resources:
4950
azure.mgmt.databasewatcher.operations.SharedPrivateLinkResourcesOperations
50-
:param credential: Credential used to authenticate requests to the service. Required.
51+
:ivar targets: TargetsOperations operations
52+
:vartype targets: azure.mgmt.databasewatcher.operations.TargetsOperations
53+
:param credential: Credential needed for the client to connect to Azure. Required.
5154
:type credential: ~azure.core.credentials.TokenCredential
5255
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5356
:type subscription_id: str
54-
:param base_url: Service host. Default value is "https://management.azure.com".
57+
:param base_url: Service URL. Default value is None.
5558
:type base_url: str
56-
:keyword api_version: The API version to use for this operation. Default value is "2025-01-02".
57-
Note that overriding this default value may result in unsupported behavior.
59+
:keyword api_version: Api Version. Default value is "2025-01-02". Note that overriding this
60+
default value may result in unsupported behavior.
5861
:paramtype api_version: str
5962
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6063
Retry-After header is present.
6164
"""
6265

6366
def __init__(
64-
self,
65-
credential: "TokenCredential",
66-
subscription_id: str,
67-
base_url: str = "https://management.azure.com",
68-
**kwargs: Any
67+
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
6968
) -> None:
70-
_endpoint = "{endpoint}"
71-
self._config = DatabaseWatcherMgmtClientConfiguration(
72-
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
69+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
70+
_endpoints = get_arm_endpoints(_cloud)
71+
if not base_url:
72+
base_url = _endpoints["resource_manager"]
73+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
74+
self._config = MicrosoftDatabaseWatcherConfiguration(
75+
credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs
7376
)
77+
7478
_policies = kwargs.pop("policies", None)
7579
if _policies is None:
7680
_policies = [
@@ -89,10 +93,11 @@ def __init__(
8993
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
9094
self._config.http_logging_policy,
9195
]
92-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
96+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs)
9397

94-
self._serialize = Serializer()
95-
self._deserialize = Deserializer()
98+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
99+
self._serialize = Serializer(client_models)
100+
self._deserialize = Deserializer(client_models)
96101
self._serialize.client_side_validation = False
97102
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
98103
self.watchers = WatchersOperations(self._client, self._config, self._serialize, self._deserialize)
@@ -102,18 +107,18 @@ def __init__(
102107
self.health_validations = HealthValidationsOperations(
103108
self._client, self._config, self._serialize, self._deserialize
104109
)
105-
self.targets = TargetsOperations(self._client, self._config, self._serialize, self._deserialize)
106110
self.shared_private_link_resources = SharedPrivateLinkResourcesOperations(
107111
self._client, self._config, self._serialize, self._deserialize
108112
)
113+
self.targets = TargetsOperations(self._client, self._config, self._serialize, self._deserialize)
109114

110-
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
115+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
111116
"""Runs the network request through the client's chained policies.
112117
113118
>>> from azure.core.rest import HttpRequest
114119
>>> request = HttpRequest("GET", "https://www.example.org/")
115120
<HttpRequest [GET], url: 'https://www.example.org/'>
116-
>>> response = client.send_request(request)
121+
>>> response = client._send_request(request)
117122
<HttpResponse: 200 OK>
118123
119124
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -126,11 +131,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
126131
"""
127132

128133
request_copy = deepcopy(request)
129-
path_format_arguments = {
130-
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
131-
}
132-
133-
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
134+
request_copy.url = self._client.format_url(request_copy.url)
134135
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
135136

136137
def close(self) -> None:

0 commit comments

Comments
 (0)