Skip to content

Commit 32eb776

Browse files
author
SDKAuto
committed
CodeGen from PR 20121 in Azure/azure-rest-api-specs
Merge d4a2ceae8dee937042a4bcd897279570e38174a0 into 4b5383a3c9fb089d361d2e11f65d0d04c76e94ac
1 parent 3422050 commit 32eb776

Some content is hidden

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

43 files changed

+11367
-6108
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.7.2",
2+
"autorest": "3.8.4",
33
"use": [
4-
"@autorest/python@5.12.0",
5-
"@autorest/modelerfour@4.19.3"
4+
"@autorest/python@6.0.1",
5+
"@autorest/modelerfour@4.23.5"
66
],
7-
"commit": "0f149eb7239f7a262601bb5476e7772f06d1b28d",
7+
"commit": "f963a5a562e738723636af6bfa4f8cf097663719",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/labservices/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
9+
"autorest_command": "autorest specification/labservices/resource-manager/readme.md --models-mode=msrest --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.0.1 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False",
1010
"readme": "specification/labservices/resource-manager/readme.md"
1111
}

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

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

9-
from ._lab_services_client import LabServicesClient
9+
from ._managed_labs_client import ManagedLabsClient
1010
from ._version import VERSION
1111

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

15-
# `._patch.py` is used for handwritten extensions to the generated code
16-
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17-
from ._patch import patch_sdk
18-
patch_sdk()
14+
try:
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
17+
except ImportError:
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = ["ManagedLabsClient"]
22+
__all__.extend([p for p in _patch_all if p not in __all__])
23+
24+
_patch_sdk()

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

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,50 +19,51 @@
1919
from azure.core.credentials import TokenCredential
2020

2121

22-
class LabServicesClientConfiguration(Configuration):
23-
"""Configuration for LabServicesClient.
22+
class ManagedLabsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
23+
"""Configuration for ManagedLabsClient.
2424
2525
Note that all parameters used to create this instance are saved as instance
2626
attributes.
2727
28-
:param credential: Credential needed for the client to connect to Azure.
28+
:param credential: Credential needed for the client to connect to Azure. Required.
2929
:type credential: ~azure.core.credentials.TokenCredential
30-
:param subscription_id: The ID of the target subscription.
30+
:param subscription_id: The ID of the target subscription. Required.
3131
:type subscription_id: str
32+
:keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
33+
default value may result in unsupported behavior.
34+
:paramtype api_version: str
3235
"""
3336

34-
def __init__(
35-
self,
36-
credential: "TokenCredential",
37-
subscription_id: str,
38-
**kwargs: Any
39-
) -> None:
40-
super(LabServicesClientConfiguration, self).__init__(**kwargs)
37+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38+
super(ManagedLabsClientConfiguration, self).__init__(**kwargs)
39+
api_version = kwargs.pop("api_version", "2022-08-01") # type: str
40+
4141
if credential is None:
4242
raise ValueError("Parameter 'credential' must not be None.")
4343
if subscription_id is None:
4444
raise ValueError("Parameter 'subscription_id' must not be None.")
4545

4646
self.credential = credential
4747
self.subscription_id = subscription_id
48-
self.api_version = "2021-11-15-preview"
49-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
50-
kwargs.setdefault('sdk_moniker', 'mgmt-labservices/{}'.format(VERSION))
48+
self.api_version = api_version
49+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
50+
kwargs.setdefault("sdk_moniker", "mgmt-labservices/{}".format(VERSION))
5151
self._configure(**kwargs)
5252

5353
def _configure(
54-
self,
55-
**kwargs # type: Any
54+
self, **kwargs # type: Any
5655
):
5756
# type: (...) -> None
58-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
59-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
60-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
61-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
62-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
63-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
64-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
65-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
66-
self.authentication_policy = kwargs.get('authentication_policy')
57+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
58+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
59+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
60+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
61+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
62+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
63+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
64+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
65+
self.authentication_policy = kwargs.get("authentication_policy")
6766
if self.credential and not self.authentication_policy:
68-
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
68+
self.credential, *self.credential_scopes, **kwargs
69+
)

sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_lab_services_client.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,24 @@
1515

1616
from . import models
1717
from ._configuration import LabServicesClientConfiguration
18-
from .operations import ImagesOperations, LabPlansOperations, LabsOperations, OperationResultsOperations, Operations, SchedulesOperations, SkusOperations, UsagesOperations, UsersOperations, VirtualMachinesOperations
18+
from .operations import (
19+
ImagesOperations,
20+
LabPlansOperations,
21+
LabsOperations,
22+
OperationResultsOperations,
23+
Operations,
24+
SchedulesOperations,
25+
SkusOperations,
26+
UsagesOperations,
27+
UsersOperations,
28+
VirtualMachinesOperations,
29+
)
1930

2031
if TYPE_CHECKING:
2132
# pylint: disable=unused-import,ungrouped-imports
2233
from azure.core.credentials import TokenCredential
2334

35+
2436
class LabServicesClient:
2537
"""REST API for managing Azure Lab Services images.
2638
@@ -72,14 +84,17 @@ def __init__(
7284
self.lab_plans = LabPlansOperations(self._client, self._config, self._serialize, self._deserialize)
7385
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
7486
self.labs = LabsOperations(self._client, self._config, self._serialize, self._deserialize)
75-
self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize)
87+
self.operation_results = OperationResultsOperations(
88+
self._client, self._config, self._serialize, self._deserialize
89+
)
7690
self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize)
7791
self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize)
78-
self.virtual_machines = VirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize)
92+
self.virtual_machines = VirtualMachinesOperations(
93+
self._client, self._config, self._serialize, self._deserialize
94+
)
7995
self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize)
8096
self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize)
8197

82-
8398
def _send_request(
8499
self,
85100
request, # type: HttpRequest
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING
11+
12+
from azure.core.rest import HttpRequest, HttpResponse
13+
from azure.mgmt.core import ARMPipelineClient
14+
15+
from . import models
16+
from ._configuration import ManagedLabsClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
ImagesOperations,
20+
LabPlansOperations,
21+
LabsOperations,
22+
OperationResultsOperations,
23+
Operations,
24+
SchedulesOperations,
25+
SkusOperations,
26+
UsagesOperations,
27+
UsersOperations,
28+
VirtualMachinesOperations,
29+
)
30+
31+
if TYPE_CHECKING:
32+
# pylint: disable=unused-import,ungrouped-imports
33+
from azure.core.credentials import TokenCredential
34+
35+
36+
class ManagedLabsClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
37+
"""REST API for managing Azure Lab Services images.
38+
39+
:ivar images: ImagesOperations operations
40+
:vartype images: azure.mgmt.labservices.operations.ImagesOperations
41+
:ivar lab_plans: LabPlansOperations operations
42+
:vartype lab_plans: azure.mgmt.labservices.operations.LabPlansOperations
43+
:ivar operations: Operations operations
44+
:vartype operations: azure.mgmt.labservices.operations.Operations
45+
:ivar labs: LabsOperations operations
46+
:vartype labs: azure.mgmt.labservices.operations.LabsOperations
47+
:ivar operation_results: OperationResultsOperations operations
48+
:vartype operation_results: azure.mgmt.labservices.operations.OperationResultsOperations
49+
:ivar schedules: SchedulesOperations operations
50+
:vartype schedules: azure.mgmt.labservices.operations.SchedulesOperations
51+
:ivar skus: SkusOperations operations
52+
:vartype skus: azure.mgmt.labservices.operations.SkusOperations
53+
:ivar usages: UsagesOperations operations
54+
:vartype usages: azure.mgmt.labservices.operations.UsagesOperations
55+
:ivar users: UsersOperations operations
56+
:vartype users: azure.mgmt.labservices.operations.UsersOperations
57+
:ivar virtual_machines: VirtualMachinesOperations operations
58+
:vartype virtual_machines: azure.mgmt.labservices.operations.VirtualMachinesOperations
59+
:param credential: Credential needed for the client to connect to Azure. Required.
60+
:type credential: ~azure.core.credentials.TokenCredential
61+
:param subscription_id: The ID of the target subscription. Required.
62+
:type subscription_id: str
63+
:param base_url: Service URL. Default value is "https://management.azure.com".
64+
:type base_url: str
65+
:keyword api_version: Api Version. Default value is "2022-08-01". Note that overriding this
66+
default value may result in unsupported behavior.
67+
:paramtype api_version: str
68+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
69+
Retry-After header is present.
70+
"""
71+
72+
def __init__(
73+
self,
74+
credential: "TokenCredential",
75+
subscription_id: str,
76+
base_url: str = "https://management.azure.com",
77+
**kwargs: Any
78+
) -> None:
79+
self._config = ManagedLabsClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
80+
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
81+
82+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
83+
self._serialize = Serializer(client_models)
84+
self._deserialize = Deserializer(client_models)
85+
self._serialize.client_side_validation = False
86+
self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize)
87+
self.lab_plans = LabPlansOperations(self._client, self._config, self._serialize, self._deserialize)
88+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
89+
self.labs = LabsOperations(self._client, self._config, self._serialize, self._deserialize)
90+
self.operation_results = OperationResultsOperations(
91+
self._client, self._config, self._serialize, self._deserialize
92+
)
93+
self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize)
94+
self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize)
95+
self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize)
96+
self.users = UsersOperations(self._client, self._config, self._serialize, self._deserialize)
97+
self.virtual_machines = VirtualMachinesOperations(
98+
self._client, self._config, self._serialize, self._deserialize
99+
)
100+
101+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
102+
"""Runs the network request through the client's chained policies.
103+
104+
>>> from azure.core.rest import HttpRequest
105+
>>> request = HttpRequest("GET", "https://www.example.org/")
106+
<HttpRequest [GET], url: 'https://www.example.org/'>
107+
>>> response = client._send_request(request)
108+
<HttpResponse: 200 OK>
109+
110+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
111+
112+
:param request: The network request you want to make. Required.
113+
:type request: ~azure.core.rest.HttpRequest
114+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
115+
:return: The response of your network call. Does not do error handling on your response.
116+
:rtype: ~azure.core.rest.HttpResponse
117+
"""
118+
119+
request_copy = deepcopy(request)
120+
request_copy.url = self._client.format_url(request_copy.url)
121+
return self._client.send_request(request_copy, **kwargs)
122+
123+
def close(self):
124+
# type: () -> None
125+
self._client.close()
126+
127+
def __enter__(self):
128+
# type: () -> ManagedLabsClient
129+
self._client.__enter__()
130+
return self
131+
132+
def __exit__(self, *exc_details):
133+
# type: (Any) -> None
134+
self._client.__exit__(*exc_details)

sdk/labservices/azure-mgmt-labservices/azure/mgmt/labservices/_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
# This file is used for handwritten extensions to the generated code. Example:
2929
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
3030
def patch_sdk():
31-
pass
31+
pass

0 commit comments

Comments
 (0)