Skip to content

Commit 2e85ec1

Browse files
author
SDKAuto
committed
CodeGen from PR 32247 in Azure/azure-rest-api-specs
Merge 5759c77eee2d57bdb9e47aa1805d0ffb61704f2d into ae6e92d62421bfafa2b695d742f3820d5de204eb
1 parent 8860e71 commit 2e85ec1

File tree

60 files changed

+9513
-8048
lines changed

Some content is hidden

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

60 files changed

+9513
-8048
lines changed
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "64f6997950d8bee63f314563cedaa20148db2186",
2+
"commit": "b3fb8a3a9015def6fa7f88134dfa3e228b740f2b",
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=/mnt/vss/_work/1/azure-sdk-for-python/sdk --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.38.1"
116
}

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

Lines changed: 2 additions & 2 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
# 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 ._service_networking_mgmt_client import ServiceNetworkingMgmtClient # type: ignore
15+
from ._client import ServiceNetworkingMgmtClient # type: ignore
1616
from ._version import VERSION
1717

1818
__version__ = VERSION
Lines changed: 27 additions & 24 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 (
@@ -33,11 +32,6 @@
3332
class ServiceNetworkingMgmtClient:
3433
"""Traffic Controller Provider management API.
3534
36-
:ivar operations: Operations operations
37-
:vartype operations: azure.mgmt.servicenetworking.operations.Operations
38-
:ivar traffic_controller_interface: TrafficControllerInterfaceOperations operations
39-
:vartype traffic_controller_interface:
40-
azure.mgmt.servicenetworking.operations.TrafficControllerInterfaceOperations
4135
:ivar associations_interface: AssociationsInterfaceOperations operations
4236
:vartype associations_interface:
4337
azure.mgmt.servicenetworking.operations.AssociationsInterfaceOperations
@@ -47,14 +41,19 @@ class ServiceNetworkingMgmtClient:
4741
:ivar security_policies_interface: SecurityPoliciesInterfaceOperations operations
4842
:vartype security_policies_interface:
4943
azure.mgmt.servicenetworking.operations.SecurityPoliciesInterfaceOperations
50-
: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.
5150
:type credential: ~azure.core.credentials.TokenCredential
52-
: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.
5352
:type subscription_id: str
54-
: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".
5554
:type base_url: str
56-
:keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this
57-
default value may result in unsupported behavior.
55+
:keyword api_version: The API version to use for this operation. Default value is "2025-01-01".
56+
Note that overriding this default value may result in unsupported behavior.
5857
:paramtype api_version: str
5958
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6059
Retry-After header is present.
@@ -67,8 +66,9 @@ def __init__(
6766
base_url: str = "https://management.azure.com",
6867
**kwargs: Any
6968
) -> None:
69+
_endpoint = "{endpoint}"
7070
self._config = ServiceNetworkingMgmtClientConfiguration(
71-
credential=credential, subscription_id=subscription_id, **kwargs
71+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
7272
)
7373
_policies = kwargs.pop("policies", None)
7474
if _policies is None:
@@ -88,16 +88,11 @@ def __init__(
8888
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
8989
self._config.http_logging_policy,
9090
]
91-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
91+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
9292

93-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
94-
self._serialize = Serializer(client_models)
95-
self._deserialize = Deserializer(client_models)
93+
self._serialize = Serializer()
94+
self._deserialize = Deserializer()
9695
self._serialize.client_side_validation = False
97-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
98-
self.traffic_controller_interface = TrafficControllerInterfaceOperations(
99-
self._client, self._config, self._serialize, self._deserialize
100-
)
10196
self.associations_interface = AssociationsInterfaceOperations(
10297
self._client, self._config, self._serialize, self._deserialize
10398
)
@@ -107,14 +102,18 @@ def __init__(
107102
self.security_policies_interface = SecurityPoliciesInterfaceOperations(
108103
self._client, self._config, self._serialize, self._deserialize
109104
)
105+
self.traffic_controller_interface = TrafficControllerInterfaceOperations(
106+
self._client, self._config, self._serialize, self._deserialize
107+
)
108+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
110109

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

129128
request_copy = deepcopy(request)
130-
request_copy.url = self._client.format_url(request_copy.url)
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)
131134
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
132135

133136
def close(self) -> None:

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

Lines changed: 15 additions & 6 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

@@ -23,16 +23,24 @@ class ServiceNetworkingMgmtClientConfiguration: # pylint: disable=too-many-inst
2323
Note that all parameters used to create this instance are saved as instance
2424
attributes.
2525
26-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
2727
:type credential: ~azure.core.credentials.TokenCredential
28-
: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.
2929
:type subscription_id: str
30-
:keyword api_version: Api Version. Default value is "2025-01-01". Note that overriding this
31-
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 "2025-01-01".
33+
Note that overriding this default value may result in unsupported behavior.
3234
:paramtype api_version: str
3335
"""
3436

35-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
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:
3644
api_version: str = kwargs.pop("api_version", "2025-01-01")
3745

3846
if credential is None:
@@ -42,6 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4250

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

0 commit comments

Comments
 (0)