Skip to content

Commit d45a358

Browse files
author
SDKAuto
committed
CodeGen from PR 31518 in Azure/azure-rest-api-specs
Merge a2b3d0461773e32d93bc88ddebcd47cb08d6578f into 5bd6dc6118d8bc231ecd913c2e67ff521cfd43b7
1 parent d96f897 commit d45a358

File tree

62 files changed

+9950
-8228
lines changed

Some content is hidden

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

62 files changed

+9950
-8228
lines changed
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "778fdb20839c487eba95a6b161812ad9d9d6337d",
2+
"commit": "a1675a20d0af726e54a54ae7f4d156ca089b230b",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.10.2",
5-
"use": [
6-
"@autorest/[email protected]",
7-
"@autorest/[email protected]"
8-
],
9-
"autorest_command": "autorest specification/servicenetworking/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=2024-05-01-preview --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
10-
"readme": "specification/servicenetworking/resource-manager/readme.md"
4+
"typespec_src": "specification/servicenetworking/ServiceNetworking.Management",
5+
"@azure-tools/typespec-python": "0.36.4"
116
}

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
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
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._service_networking_mgmt_client import ServiceNetworkingMgmtClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import ServiceNetworkingMgmtClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"ServiceNetworkingMgmtClient",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()
Lines changed: 29 additions & 26 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) 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

@@ -15,7 +15,6 @@
1515
from azure.mgmt.core import ARMPipelineClient
1616
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1717

18-
from . import models as _models
1918
from ._configuration import ServiceNetworkingMgmtClientConfiguration
2019
from ._serialization import Deserializer, Serializer
2120
from .operations import (
@@ -27,18 +26,12 @@
2726
)
2827

2928
if TYPE_CHECKING:
30-
# pylint: disable=unused-import,ungrouped-imports
3129
from azure.core.credentials import TokenCredential
3230

3331

34-
class ServiceNetworkingMgmtClient: # pylint: disable=client-accepts-api-version-keyword
32+
class ServiceNetworkingMgmtClient:
3533
"""Traffic Controller Provider management API.
3634
37-
:ivar operations: Operations operations
38-
:vartype operations: azure.mgmt.servicenetworking.operations.Operations
39-
:ivar traffic_controller_interface: TrafficControllerInterfaceOperations operations
40-
:vartype traffic_controller_interface:
41-
azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations
4235
:ivar associations_interface: AssociationsInterfaceOperations operations
4336
:vartype associations_interface:
4437
azure.mgmt.servicenetworking.operations.AssociationsInterfaceOperations
@@ -48,14 +41,20 @@ class ServiceNetworkingMgmtClient: # pylint: disable=client-accepts-api-version
4841
:ivar security_policies_interface: SecurityPoliciesInterfaceOperations operations
4942
:vartype security_policies_interface:
5043
azure.mgmt.servicenetworking.operations.SecurityPoliciesInterfaceOperations
51-
:param credential: Credential needed for the client to connect to Azure. Required.
44+
:ivar traffic_controller_interface: TrafficControllerInterfaceOperations operations
45+
:vartype traffic_controller_interface:
46+
azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations
47+
:ivar operations: Operations operations
48+
:vartype operations: azure.mgmt.servicenetworking.operations.Operations
49+
:param credential: Credential used to authenticate requests to the service. Required.
5250
:type credential: ~azure.core.credentials.TokenCredential
53-
:param subscription_id: The ID of the target subscription. Required.
51+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5452
:type subscription_id: str
55-
:param base_url: Service URL. Default value is "https://management.azure.com".
53+
:param base_url: Service host. Default value is "https://management.azure.com".
5654
:type base_url: str
57-
:keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding
58-
this default value may result in unsupported behavior.
55+
:keyword api_version: The API version to use for this operation. Default value is
56+
"2024-11-01-preview". Note that overriding this default value may result in unsupported
57+
behavior.
5958
:paramtype api_version: str
6059
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6160
Retry-After header is present.
@@ -68,8 +67,9 @@ def __init__(
6867
base_url: str = "https://management.azure.com",
6968
**kwargs: Any
7069
) -> None:
70+
_endpoint = "{endpoint}"
7171
self._config = ServiceNetworkingMgmtClientConfiguration(
72-
credential=credential, subscription_id=subscription_id, **kwargs
72+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
7373
)
7474
_policies = kwargs.pop("policies", None)
7575
if _policies is None:
@@ -89,16 +89,11 @@ def __init__(
8989
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
9090
self._config.http_logging_policy,
9191
]
92-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
92+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
9393

94-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
95-
self._serialize = Serializer(client_models)
96-
self._deserialize = Deserializer(client_models)
94+
self._serialize = Serializer()
95+
self._deserialize = Deserializer()
9796
self._serialize.client_side_validation = False
98-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
99-
self.traffic_controller_interface = TrafficControllerInterfaceOperations(
100-
self._client, self._config, self._serialize, self._deserialize
101-
)
10297
self.associations_interface = AssociationsInterfaceOperations(
10398
self._client, self._config, self._serialize, self._deserialize
10499
)
@@ -108,14 +103,18 @@ def __init__(
108103
self.security_policies_interface = SecurityPoliciesInterfaceOperations(
109104
self._client, self._config, self._serialize, self._deserialize
110105
)
106+
self.traffic_controller_interface = TrafficControllerInterfaceOperations(
107+
self._client, self._config, self._serialize, self._deserialize
108+
)
109+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
111110

112-
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
111+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
113112
"""Runs the network request through the client's chained policies.
114113
115114
>>> from azure.core.rest import HttpRequest
116115
>>> request = HttpRequest("GET", "https://www.example.org/")
117116
<HttpRequest [GET], url: 'https://www.example.org/'>
118-
>>> response = client._send_request(request)
117+
>>> response = client.send_request(request)
119118
<HttpResponse: 200 OK>
120119
121120
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -128,7 +127,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
128127
"""
129128

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

134137
def close(self) -> None:

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

Lines changed: 18 additions & 9 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) 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

@@ -14,27 +14,35 @@
1414
from ._version import VERSION
1515

1616
if TYPE_CHECKING:
17-
# pylint: disable=unused-import,ungrouped-imports
1817
from azure.core.credentials import TokenCredential
1918

2019

21-
class ServiceNetworkingMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
20+
class ServiceNetworkingMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes
2221
"""Configuration for ServiceNetworkingMgmtClient.
2322
2423
Note that all parameters used to create this instance are saved as instance
2524
attributes.
2625
27-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
2827
:type credential: ~azure.core.credentials.TokenCredential
29-
: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.
3029
:type subscription_id: str
31-
:keyword api_version: Api Version. Default value is "2024-05-01-preview". Note that overriding
32-
this 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
33+
"2024-11-01-preview". Note that overriding this default value may result in unsupported
34+
behavior.
3335
:paramtype api_version: str
3436
"""
3537

36-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
37-
api_version: str = kwargs.pop("api_version", "2024-05-01-preview")
38+
def __init__(
39+
self,
40+
credential: "TokenCredential",
41+
subscription_id: str,
42+
base_url: str = "https://management.azure.com",
43+
**kwargs: Any
44+
) -> None:
45+
api_version: str = kwargs.pop("api_version", "2024-11-01-preview")
3846

3947
if credential is None:
4048
raise ValueError("Parameter 'credential' must not be None.")
@@ -43,6 +51,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4351

4452
self.credential = credential
4553
self.subscription_id = subscription_id
54+
self.base_url = base_url
4655
self.api_version = api_version
4756
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4857
kwargs.setdefault("sdk_moniker", "mgmt-servicenetworking/{}".format(VERSION))

0 commit comments

Comments
 (0)