Skip to content

Commit 9bf951d

Browse files
author
SDKAuto
committed
CodeGen from PR 19099 in Azure/azure-rest-api-specs
Merge 12419e2b64042f9af0bd5b95fa8f99f43aa75021 into bab2f4389eb5ca73cdf366ec0a4af3f3eb6e1f6d
1 parent 12f3e62 commit 9bf951d

36 files changed

+5269
-4210
lines changed
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"autorest": "3.3.0",
3-
"use": "@autorest/[email protected]",
4-
"commit": "a3a99cb1a7fac19acb046b4920fce6945dc7e8a2",
2+
"autorest": "3.7.2",
3+
"use": [
4+
"@autorest/[email protected]",
5+
"@autorest/[email protected]"
6+
],
7+
"commit": "966bacca6a05668425af1e19edd826ce08e5e16e",
58
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
6-
"autorest_command": "autorest specification/hybridcompute/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.6 --version=3.3.0",
9+
"autorest_command": "autorest specification/hybridcompute/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/[email protected] --version=3.7.2",
710
"readme": "specification/hybridcompute/resource-manager/readme.md"
811
}

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
13-
__all__ = ['HybridComputeManagementClient']
1413

1514
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
1817
except ImportError:
19-
pass
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
__all__ = ['HybridComputeManagementClient']
21+
__all__.extend([p for p in _patch_all if p not in __all__])
22+
23+
_patch_sdk()

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
13+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1414

1515
from ._version import VERSION
1616

1717
if TYPE_CHECKING:
1818
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2119
from azure.core.credentials import TokenCredential
2220

2321

24-
class HybridComputeManagementClientConfiguration(Configuration):
22+
class HybridComputeManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2523
"""Configuration for HybridComputeManagementClient.
2624
2725
Note that all parameters used to create this instance are saved as instance
@@ -31,24 +29,28 @@ class HybridComputeManagementClientConfiguration(Configuration):
3129
:type credential: ~azure.core.credentials.TokenCredential
3230
:param subscription_id: The ID of the target subscription.
3331
:type subscription_id: str
32+
:keyword api_version: Api Version. Default value is "2022-05-10-preview". Note that overriding
33+
this default value may result in unsupported behavior.
34+
:paramtype api_version: str
3435
"""
3536

3637
def __init__(
3738
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
39+
credential: "TokenCredential",
40+
subscription_id: str,
41+
**kwargs: Any
42+
) -> None:
43+
super(HybridComputeManagementClientConfiguration, self).__init__(**kwargs)
44+
api_version = kwargs.pop('api_version', "2022-05-10-preview") # type: str
45+
4346
if credential is None:
4447
raise ValueError("Parameter 'credential' must not be None.")
4548
if subscription_id is None:
4649
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(HybridComputeManagementClientConfiguration, self).__init__(**kwargs)
4850

4951
self.credential = credential
5052
self.subscription_id = subscription_id
51-
self.api_version = "2021-03-25-preview"
53+
self.api_version = api_version
5254
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
5355
kwargs.setdefault('sdk_moniker', 'mgmt-hybridcompute/{}'.format(VERSION))
5456
self._configure(**kwargs)
@@ -68,4 +70,4 @@ def _configure(
6870
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6971
self.authentication_policy = kwargs.get('authentication_policy')
7072
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
73+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_hybrid_compute_management_client.py

Lines changed: 62 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,23 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING
1011

11-
from azure.mgmt.core import ARMPipelineClient
1212
from msrest import Deserializer, Serializer
1313

14-
if TYPE_CHECKING:
15-
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
18-
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.mgmt.core import ARMPipelineClient
2016

21-
from ._configuration import HybridComputeManagementClientConfiguration
22-
from .operations import MachinesOperations
23-
from .operations import MachineExtensionsOperations
24-
from .operations import Operations
25-
from .operations import PrivateLinkScopesOperations
26-
from .operations import PrivateLinkResourcesOperations
27-
from .operations import PrivateEndpointConnectionsOperations
2817
from . import models
18+
from ._configuration import HybridComputeManagementClientConfiguration
19+
from .operations import HybridComputeManagementClientOperationsMixin, MachineExtensionsOperations, MachinesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, PrivateLinkScopesOperations
2920

21+
if TYPE_CHECKING:
22+
# pylint: disable=unused-import,ungrouped-imports
23+
from azure.core.credentials import TokenCredential
3024

31-
class HybridComputeManagementClient(object):
25+
class HybridComputeManagementClient(HybridComputeManagementClientOperationsMixin): # pylint: disable=too-many-instance-attributes
3226
"""The Hybrid Compute Management Client.
3327
3428
:ivar machines: MachinesOperations operations
@@ -40,65 +34,83 @@ class HybridComputeManagementClient(object):
4034
:ivar private_link_scopes: PrivateLinkScopesOperations operations
4135
:vartype private_link_scopes: azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations
4236
:ivar private_link_resources: PrivateLinkResourcesOperations operations
43-
:vartype private_link_resources: azure.mgmt.hybridcompute.operations.PrivateLinkResourcesOperations
37+
:vartype private_link_resources:
38+
azure.mgmt.hybridcompute.operations.PrivateLinkResourcesOperations
4439
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
45-
:vartype private_endpoint_connections: azure.mgmt.hybridcompute.operations.PrivateEndpointConnectionsOperations
40+
:vartype private_endpoint_connections:
41+
azure.mgmt.hybridcompute.operations.PrivateEndpointConnectionsOperations
4642
:param credential: Credential needed for the client to connect to Azure.
4743
:type credential: ~azure.core.credentials.TokenCredential
4844
:param subscription_id: The ID of the target subscription.
4945
:type subscription_id: str
50-
:param str base_url: Service URL
51-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
46+
:param base_url: Service URL. Default value is "https://management.azure.com".
47+
:type base_url: str
48+
:keyword api_version: Api Version. Default value is "2022-05-10-preview". Note that overriding
49+
this default value may result in unsupported behavior.
50+
:paramtype api_version: str
51+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
52+
Retry-After header is present.
5253
"""
5354

5455
def __init__(
5556
self,
56-
credential, # type: "TokenCredential"
57-
subscription_id, # type: str
58-
base_url=None, # type: Optional[str]
59-
**kwargs # type: Any
60-
):
61-
# type: (...) -> None
62-
if not base_url:
63-
base_url = 'https://management.azure.com'
64-
self._config = HybridComputeManagementClientConfiguration(credential, subscription_id, **kwargs)
57+
credential: "TokenCredential",
58+
subscription_id: str,
59+
base_url: str = "https://management.azure.com",
60+
**kwargs: Any
61+
) -> None:
62+
self._config = HybridComputeManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
6563
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6664

6765
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
6866
self._serialize = Serializer(client_models)
69-
self._serialize.client_side_validation = False
7067
self._deserialize = Deserializer(client_models)
71-
68+
self._serialize.client_side_validation = False
7269
self.machines = MachinesOperations(
73-
self._client, self._config, self._serialize, self._deserialize)
70+
self._client, self._config, self._serialize, self._deserialize
71+
)
7472
self.machine_extensions = MachineExtensionsOperations(
75-
self._client, self._config, self._serialize, self._deserialize)
73+
self._client, self._config, self._serialize, self._deserialize
74+
)
7675
self.operations = Operations(
77-
self._client, self._config, self._serialize, self._deserialize)
76+
self._client, self._config, self._serialize, self._deserialize
77+
)
7878
self.private_link_scopes = PrivateLinkScopesOperations(
79-
self._client, self._config, self._serialize, self._deserialize)
79+
self._client, self._config, self._serialize, self._deserialize
80+
)
8081
self.private_link_resources = PrivateLinkResourcesOperations(
81-
self._client, self._config, self._serialize, self._deserialize)
82+
self._client, self._config, self._serialize, self._deserialize
83+
)
8284
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
83-
self._client, self._config, self._serialize, self._deserialize)
85+
self._client, self._config, self._serialize, self._deserialize
86+
)
87+
8488

85-
def _send_request(self, http_request, **kwargs):
86-
# type: (HttpRequest, Any) -> HttpResponse
89+
def _send_request(
90+
self,
91+
request: HttpRequest,
92+
**kwargs: Any
93+
) -> HttpResponse:
8794
"""Runs the network request through the client's chained policies.
8895
89-
:param http_request: The network request you want to make. Required.
90-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
91-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
96+
>>> from azure.core.rest import HttpRequest
97+
>>> request = HttpRequest("GET", "https://www.example.org/")
98+
<HttpRequest [GET], url: 'https://www.example.org/'>
99+
>>> response = client._send_request(request)
100+
<HttpResponse: 200 OK>
101+
102+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
103+
104+
:param request: The network request you want to make. Required.
105+
:type request: ~azure.core.rest.HttpRequest
106+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
92107
:return: The response of your network call. Does not do error handling on your response.
93-
:rtype: ~azure.core.pipeline.transport.HttpResponse
108+
:rtype: ~azure.core.rest.HttpResponse
94109
"""
95-
path_format_arguments = {
96-
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
97-
}
98-
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
99-
stream = kwargs.pop("stream", True)
100-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
101-
return pipeline_response.http_response
110+
111+
request_copy = deepcopy(request)
112+
request_copy.url = self._client.format_url(request_copy.url)
113+
return self._client.send_request(request_copy, **kwargs)
102114

103115
def close(self):
104116
# type: () -> None

sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_metadata.json

Lines changed: 0 additions & 108 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ------------------------------------
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT License.
4+
# ------------------------------------
5+
"""Customize generated code here.
6+
7+
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
8+
"""
9+
from typing import List
10+
11+
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
12+
13+
def patch_sdk():
14+
"""Do not remove from this file.
15+
16+
`patch_sdk` is a last resort escape hatch that allows you to do customizations
17+
you can't accomplish using the techniques described in
18+
https://aka.ms/azsdk/python/dpcodegen/python/customize
19+
"""

0 commit comments

Comments
 (0)