Skip to content

Commit 33f1341

Browse files
azure-sdkmsyyc
andauthored
[AutoRelease] t2-rdbms-2024-04-18-24756(can only be merged by SDK owner) (#35262)
* code and test * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: Yuchao Yan <[email protected]>
1 parent a9f7dcf commit 33f1341

File tree

245 files changed

+3333
-6486
lines changed

Some content is hidden

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

245 files changed

+3333
-6486
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "1f6e89637068d59b5ae935de9a88d5742d12f8e6",
2+
"commit": "71a0c7adf2a6e169ab9a33c7cf36bb93db083e86",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.9.7",
55
"use": [
66
"@autorest/[email protected]",
77
"@autorest/[email protected]"
88
],
9-
"autorest_command": "autorest specification/postgresql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-flexibleserver-2023-12-01-preview --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
10-
"readme": "specification/postgresql/resource-manager/readme.md"
9+
"autorest_command": "autorest specification/mysql/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
10+
"readme": "specification/mysql/resource-manager/readme.md"
1111
}

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_configuration.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from typing import Any, TYPE_CHECKING
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1413

@@ -19,7 +18,7 @@
1918
from azure.core.credentials import TokenCredential
2019

2120

22-
class MySQLManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
21+
class MySQLManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2322
"""Configuration for MySQLManagementClient.
2423
2524
Note that all parameters used to create this instance are saved as instance
@@ -32,7 +31,6 @@ class MySQLManagementClientConfiguration(Configuration): # pylint: disable=too-
3231
"""
3332

3433
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
35-
super(MySQLManagementClientConfiguration, self).__init__(**kwargs)
3634
if credential is None:
3735
raise ValueError("Parameter 'credential' must not be None.")
3836
if subscription_id is None:
@@ -42,6 +40,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4240
self.subscription_id = subscription_id
4341
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4442
kwargs.setdefault("sdk_moniker", "mgmt-rdbms/{}".format(VERSION))
43+
self.polling_interval = kwargs.get("polling_interval", 30)
4544
self._configure(**kwargs)
4645

4746
def _configure(self, **kwargs: Any) -> None:
@@ -50,9 +49,9 @@ def _configure(self, **kwargs: Any) -> None:
5049
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5150
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5251
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
53-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5452
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
5553
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
54+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5655
self.authentication_policy = kwargs.get("authentication_policy")
5756
if self.credential and not self.authentication_policy:
5857
self.authentication_policy = ARMChallengeAuthenticationPolicy(

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/mysql/_my_sql_management_client.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
1111

12+
from azure.core.pipeline import policies
1213
from azure.core.rest import HttpRequest, HttpResponse
1314
from azure.mgmt.core import ARMPipelineClient
15+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1416

1517
from . import models as _models
1618
from ._configuration import MySQLManagementClientConfiguration
@@ -137,7 +139,25 @@ def __init__(
137139
self._config = MySQLManagementClientConfiguration(
138140
credential=credential, subscription_id=subscription_id, **kwargs
139141
)
140-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
142+
_policies = kwargs.pop("policies", None)
143+
if _policies is None:
144+
_policies = [
145+
policies.RequestIdPolicy(**kwargs),
146+
self._config.headers_policy,
147+
self._config.user_agent_policy,
148+
self._config.proxy_policy,
149+
policies.ContentDecodePolicy(**kwargs),
150+
ARMAutoResourceProviderRegistrationPolicy(),
151+
self._config.redirect_policy,
152+
self._config.retry_policy,
153+
self._config.authentication_policy,
154+
self._config.custom_hook_policy,
155+
self._config.logging_policy,
156+
policies.DistributedTracingPolicy(**kwargs),
157+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
158+
self._config.http_logging_policy,
159+
]
160+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
141161

142162
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
143163
self._serialize = Serializer(client_models)
@@ -199,7 +219,7 @@ def __init__(
199219
)
200220
self.server_keys = ServerKeysOperations(self._client, self._config, self._serialize, self._deserialize)
201221

202-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
222+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
203223
"""Runs the network request through the client's chained policies.
204224
205225
>>> from azure.core.rest import HttpRequest
@@ -219,7 +239,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
219239

220240
request_copy = deepcopy(request)
221241
request_copy.url = self._client.format_url(request_copy.url)
222-
return self._client.send_request(request_copy, **kwargs)
242+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
223243

224244
def close(self) -> None:
225245
self._client.close()

0 commit comments

Comments
 (0)