Skip to content

Commit fae7070

Browse files
azure-sdkmsyyc
andauthored
[AutoRelease] update module mysql for azure-mgmt-rdbms (#36799)
* code and test * update --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: msyyc <[email protected]>
1 parent 245460b commit fae7070

File tree

153 files changed

+3208
-4032
lines changed

Some content is hidden

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

153 files changed

+3208
-4032
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "67e8e173b7a52626d07b4bd4001abcb5bd413b34",
2+
"commit": "c1d839d48ee936c9338431c38f2cbbfbc9879ea2",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.13.16",
6+
"@autorest/python@6.17.0",
77
"@autorest/[email protected]"
88
],
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/python@6.13.16 --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
10-
"readme": "specification/mysql/resource-manager/readme.md"
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 --use=@autorest/python@6.17.0 --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
10+
"readme": "specification/postgresql/resource-manager/readme.md"
1111
}

sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/_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 PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
21+
class PostgreSQLManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2322
"""Configuration for PostgreSQLManagementClient.
2423
2524
Note that all parameters used to create this instance are saved as instance
@@ -32,7 +31,6 @@ class PostgreSQLManagementClientConfiguration(Configuration): # pylint: disable
3231
"""
3332

3433
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
35-
super(PostgreSQLManagementClientConfiguration, 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/postgresql/_postgre_sql_management_client.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
1315
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1417

1518
from . import models as _models
1619
from ._configuration import PostgreSQLManagementClientConfiguration
@@ -111,7 +114,25 @@ def __init__(
111114
self._config = PostgreSQLManagementClientConfiguration(
112115
credential=credential, subscription_id=subscription_id, **kwargs
113116
)
114-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
117+
_policies = kwargs.pop("policies", None)
118+
if _policies is None:
119+
_policies = [
120+
policies.RequestIdPolicy(**kwargs),
121+
self._config.headers_policy,
122+
self._config.user_agent_policy,
123+
self._config.proxy_policy,
124+
policies.ContentDecodePolicy(**kwargs),
125+
ARMAutoResourceProviderRegistrationPolicy(),
126+
self._config.redirect_policy,
127+
self._config.retry_policy,
128+
self._config.authentication_policy,
129+
self._config.custom_hook_policy,
130+
self._config.logging_policy,
131+
policies.DistributedTracingPolicy(**kwargs),
132+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
133+
self._config.http_logging_policy,
134+
]
135+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
115136

116137
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
117138
self._serialize = Serializer(client_models)
@@ -156,7 +177,7 @@ def __init__(
156177
)
157178
self.server_keys = ServerKeysOperations(self._client, self._config, self._serialize, self._deserialize)
158179

159-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
180+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
160181
"""Runs the network request through the client's chained policies.
161182
162183
>>> from azure.core.rest import HttpRequest
@@ -176,12 +197,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
176197

177198
request_copy = deepcopy(request)
178199
request_copy.url = self._client.format_url(request_copy.url)
179-
return self._client.send_request(request_copy, **kwargs)
200+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
180201

181202
def close(self) -> None:
182203
self._client.close()
183204

184-
def __enter__(self) -> "PostgreSQLManagementClient":
205+
def __enter__(self) -> Self:
185206
self._client.__enter__()
186207
return self
187208

0 commit comments

Comments
 (0)