Skip to content

Commit 9f88bc0

Browse files
author
SDKAuto
committed
CodeGen from PR 30578 in Azure/azure-rest-api-specs
Merge 0464fca2f595058a5c0401f696a05369d9d4b8d9 into 63c41aa20e38fe6d2ddd1a367b4fe57e8b601c34
1 parent 8c21128 commit 9f88bc0

File tree

75 files changed

+10945
-9160
lines changed

Some content is hidden

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

75 files changed

+10945
-9160
lines changed
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "4307895c13b5bc76d3d6e5d6346a32577842ac17",
2+
"commit": "e61ff8e55ea3e12827199208ecde57a04050202c",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.7",
5-
"use": [
6-
"@autorest/[email protected]",
7-
"@autorest/[email protected]"
8-
],
9-
"autorest_command": "autorest specification/networkanalytics/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/networkanalytics/resource-manager/readme.md"
4+
"typespec_src": "specification/networkanalytics/NetworkAnalytics.Management",
5+
"@azure-tools/typespec-python": "0.35.1"
116
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
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) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._network_analytics_mgmt_client import NetworkAnalyticsMgmtClient
9+
from ._client import NetworkAnalyticsMgmtClient
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
Lines changed: 46 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,47 @@
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) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
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

15-
from . import models as _models
1618
from ._configuration import NetworkAnalyticsMgmtClientConfiguration
1719
from ._serialization import Deserializer, Serializer
1820
from .operations import DataProductsCatalogsOperations, DataProductsOperations, DataTypesOperations, Operations
1921

2022
if TYPE_CHECKING:
21-
# pylint: disable=unused-import,ungrouped-imports
2223
from azure.core.credentials import TokenCredential
2324

2425

25-
class NetworkAnalyticsMgmtClient: # pylint: disable=client-accepts-api-version-keyword
26+
class NetworkAnalyticsMgmtClient:
2627
"""NetworkAnalyticsMgmtClient.
2728
2829
:ivar operations: Operations operations
2930
:vartype operations: azure.mgmt.networkanalytics.operations.Operations
30-
:ivar data_products: DataProductsOperations operations
31-
:vartype data_products: azure.mgmt.networkanalytics.operations.DataProductsOperations
3231
:ivar data_products_catalogs: DataProductsCatalogsOperations operations
3332
:vartype data_products_catalogs:
3433
azure.mgmt.networkanalytics.operations.DataProductsCatalogsOperations
3534
:ivar data_types: DataTypesOperations operations
3635
:vartype data_types: azure.mgmt.networkanalytics.operations.DataTypesOperations
37-
:param credential: Credential needed for the client to connect to Azure. Required.
36+
:ivar data_products: DataProductsOperations operations
37+
:vartype data_products: azure.mgmt.networkanalytics.operations.DataProductsOperations
38+
:param credential: Credential used to authenticate requests to the service. Required.
3839
:type credential: ~azure.core.credentials.TokenCredential
39-
:param subscription_id: The ID of the target subscription. Required.
40+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4041
:type subscription_id: str
41-
:param base_url: Service URL. Default value is "https://management.azure.com".
42+
:param base_url: Service host. Default value is "https://management.azure.com".
4243
:type base_url: str
43-
:keyword api_version: Api Version. Default value is "2023-11-15". Note that overriding this
44-
default value may result in unsupported behavior.
44+
:keyword api_version: The API version to use for this operation. Default value is "2023-11-15".
45+
Note that overriding this default value may result in unsupported behavior.
4546
:paramtype api_version: str
4647
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4748
Retry-After header is present.
@@ -54,29 +55,47 @@ def __init__(
5455
base_url: str = "https://management.azure.com",
5556
**kwargs: Any
5657
) -> None:
58+
_endpoint = "{endpoint}"
5759
self._config = NetworkAnalyticsMgmtClientConfiguration(
58-
credential=credential, subscription_id=subscription_id, **kwargs
60+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
5961
)
60-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
61-
62-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
63-
self._serialize = Serializer(client_models)
64-
self._deserialize = Deserializer(client_models)
62+
_policies = kwargs.pop("policies", None)
63+
if _policies is None:
64+
_policies = [
65+
policies.RequestIdPolicy(**kwargs),
66+
self._config.headers_policy,
67+
self._config.user_agent_policy,
68+
self._config.proxy_policy,
69+
policies.ContentDecodePolicy(**kwargs),
70+
ARMAutoResourceProviderRegistrationPolicy(),
71+
self._config.redirect_policy,
72+
self._config.retry_policy,
73+
self._config.authentication_policy,
74+
self._config.custom_hook_policy,
75+
self._config.logging_policy,
76+
policies.DistributedTracingPolicy(**kwargs),
77+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
78+
self._config.http_logging_policy,
79+
]
80+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
81+
82+
self._serialize = Serializer()
83+
self._deserialize = Deserializer()
6584
self._serialize.client_side_validation = False
6685
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
67-
self.data_products = DataProductsOperations(self._client, self._config, self._serialize, self._deserialize)
6886
self.data_products_catalogs = DataProductsCatalogsOperations(
6987
self._client, self._config, self._serialize, self._deserialize
7088
)
7189
self.data_types = DataTypesOperations(self._client, self._config, self._serialize, self._deserialize)
90+
self.data_products = DataProductsOperations(self._client, self._config, self._serialize, self._deserialize)
7291

73-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
92+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
7493
"""Runs the network request through the client's chained policies.
7594
7695
>>> from azure.core.rest import HttpRequest
7796
>>> request = HttpRequest("GET", "https://www.example.org/")
7897
<HttpRequest [GET], url: 'https://www.example.org/'>
79-
>>> response = client._send_request(request)
98+
>>> response = client.send_request(request)
8099
<HttpResponse: 200 OK>
81100
82101
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -89,13 +108,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
89108
"""
90109

91110
request_copy = deepcopy(request)
92-
request_copy.url = self._client.format_url(request_copy.url)
93-
return self._client.send_request(request_copy, **kwargs)
111+
path_format_arguments = {
112+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
113+
}
114+
115+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
116+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
94117

95118
def close(self) -> None:
96119
self._client.close()
97120

98-
def __enter__(self) -> "NetworkAnalyticsMgmtClient":
121+
def __enter__(self) -> Self:
99122
self._client.__enter__()
100123
return self
101124

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,45 @@
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) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
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

1514
from ._version import VERSION
1615

1716
if TYPE_CHECKING:
18-
# pylint: disable=unused-import,ungrouped-imports
1917
from azure.core.credentials import TokenCredential
2018

2119

22-
class NetworkAnalyticsMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class NetworkAnalyticsMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes
2321
"""Configuration for NetworkAnalyticsMgmtClient.
2422
2523
Note that all parameters used to create this instance are saved as instance
2624
attributes.
2725
28-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
2927
:type credential: ~azure.core.credentials.TokenCredential
30-
:param subscription_id: The ID of the target subscription. Required.
28+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3129
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2023-11-15". Note that overriding this
33-
default value may result in unsupported behavior.
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 "2023-11-15".
33+
Note that overriding this default value may result in unsupported behavior.
3434
:paramtype api_version: str
3535
"""
3636

37-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38-
super(NetworkAnalyticsMgmtClientConfiguration, self).__init__(**kwargs)
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:
3944
api_version: str = kwargs.pop("api_version", "2023-11-15")
4045

4146
if credential is None:
@@ -45,9 +50,11 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4550

4651
self.credential = credential
4752
self.subscription_id = subscription_id
53+
self.base_url = base_url
4854
self.api_version = api_version
4955
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5056
kwargs.setdefault("sdk_moniker", "mgmt-networkanalytics/{}".format(VERSION))
57+
self.polling_interval = kwargs.get("polling_interval", 30)
5158
self._configure(**kwargs)
5259

5360
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +63,9 @@ def _configure(self, **kwargs: Any) -> None:
5663
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5764
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5865
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
59-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6066
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6167
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
68+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6269
self.authentication_policy = kwargs.get("authentication_policy")
6370
if self.credential and not self.authentication_policy:
6471
self.authentication_policy = ARMChallengeAuthenticationPolicy(

0 commit comments

Comments
 (0)