Skip to content

Commit 135182d

Browse files
author
SDKAuto
committed
CodeGen from PR 3381 in test-repo-billy/azure-rest-api-specs
Merge 38fb6d71b1390e4613ad06828100d50d97c9ee89 into 38f1c3fea49fef7f917ab06516df896f11b4741a
1 parent a1a6086 commit 135182d

File tree

157 files changed

+23291
-19410
lines changed

Some content is hidden

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

157 files changed

+23291
-19410
lines changed
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "061505b89d5d0bbcc9f980e2276f79ff354ce286",
3-
"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/scvmm/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.10.2 --version-tolerant=False",
10-
"readme": "specification/scvmm/resource-manager/readme.md"
2+
"commit": "8cdd7c81fd6b95ab9a23a1635dd571ad4d7811d0",
3+
"repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs",
4+
"typespec_src": "specification/scvmm/ScVmm.Management",
5+
"@azure-tools/typespec-python": "0.37.1"
116
}

sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/__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 ._sc_vmm_mgmt_client import ScVmmMgmtClient
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 ScVmmMgmtClient # 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
"ScVmmMgmtClient",
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()

sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_sc_vmm_mgmt_client.py renamed to sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_client.py

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
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

1213
from azure.core.pipeline import policies
1314
from azure.core.rest import HttpRequest, HttpResponse
1415
from azure.mgmt.core import ARMPipelineClient
1516
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1617

17-
from . import models as _models
1818
from ._configuration import ScVmmMgmtClientConfiguration
1919
from ._serialization import Deserializer, Serializer
2020
from .operations import (
@@ -31,45 +31,44 @@
3131
)
3232

3333
if TYPE_CHECKING:
34-
# pylint: disable=unused-import,ungrouped-imports
3534
from azure.core.credentials import TokenCredential
3635

3736

38-
class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
37+
class ScVmmMgmtClient: # pylint: disable=too-many-instance-attributes
3938
"""The Microsoft.ScVmm Rest API spec.
4039
41-
:ivar virtual_machine_instances: VirtualMachineInstancesOperations operations
42-
:vartype virtual_machine_instances:
43-
azure.mgmt.scvmm.operations.VirtualMachineInstancesOperations
44-
:ivar guest_agents: GuestAgentsOperations operations
45-
:vartype guest_agents: azure.mgmt.scvmm.operations.GuestAgentsOperations
46-
:ivar vm_instance_hybrid_identity_metadatas: VmInstanceHybridIdentityMetadatasOperations
47-
operations
48-
:vartype vm_instance_hybrid_identity_metadatas:
49-
azure.mgmt.scvmm.operations.VmInstanceHybridIdentityMetadatasOperations
5040
:ivar operations: Operations operations
5141
:vartype operations: azure.mgmt.scvmm.operations.Operations
52-
:ivar availability_sets: AvailabilitySetsOperations operations
53-
:vartype availability_sets: azure.mgmt.scvmm.operations.AvailabilitySetsOperations
42+
:ivar vmm_servers: VmmServersOperations operations
43+
:vartype vmm_servers: azure.mgmt.scvmm.operations.VmmServersOperations
5444
:ivar clouds: CloudsOperations operations
5545
:vartype clouds: azure.mgmt.scvmm.operations.CloudsOperations
46+
:ivar virtual_networks: VirtualNetworksOperations operations
47+
:vartype virtual_networks: azure.mgmt.scvmm.operations.VirtualNetworksOperations
5648
:ivar virtual_machine_templates: VirtualMachineTemplatesOperations operations
5749
:vartype virtual_machine_templates:
5850
azure.mgmt.scvmm.operations.VirtualMachineTemplatesOperations
59-
:ivar virtual_networks: VirtualNetworksOperations operations
60-
:vartype virtual_networks: azure.mgmt.scvmm.operations.VirtualNetworksOperations
61-
:ivar vmm_servers: VmmServersOperations operations
62-
:vartype vmm_servers: azure.mgmt.scvmm.operations.VmmServersOperations
51+
:ivar availability_sets: AvailabilitySetsOperations operations
52+
:vartype availability_sets: azure.mgmt.scvmm.operations.AvailabilitySetsOperations
6353
:ivar inventory_items: InventoryItemsOperations operations
6454
:vartype inventory_items: azure.mgmt.scvmm.operations.InventoryItemsOperations
65-
:param credential: Credential needed for the client to connect to Azure. Required.
55+
:ivar virtual_machine_instances: VirtualMachineInstancesOperations operations
56+
:vartype virtual_machine_instances:
57+
azure.mgmt.scvmm.operations.VirtualMachineInstancesOperations
58+
:ivar vm_instance_hybrid_identity_metadatas: VmInstanceHybridIdentityMetadatasOperations
59+
operations
60+
:vartype vm_instance_hybrid_identity_metadatas:
61+
azure.mgmt.scvmm.operations.VmInstanceHybridIdentityMetadatasOperations
62+
:ivar guest_agents: GuestAgentsOperations operations
63+
:vartype guest_agents: azure.mgmt.scvmm.operations.GuestAgentsOperations
64+
:param credential: Credential used to authenticate requests to the service. Required.
6665
:type credential: ~azure.core.credentials.TokenCredential
6766
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
6867
:type subscription_id: str
69-
:param base_url: Service URL. Default value is "https://management.azure.com".
68+
:param base_url: Service host. Default value is "https://management.azure.com".
7069
:type base_url: str
71-
:keyword api_version: Api Version. Default value is "2023-10-07". Note that overriding this
72-
default value may result in unsupported behavior.
70+
:keyword api_version: The API version to use for this operation. Default value is "2024-06-01".
71+
Note that overriding this default value may result in unsupported behavior.
7372
:paramtype api_version: str
7473
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
7574
Retry-After header is present.
@@ -82,7 +81,10 @@ def __init__(
8281
base_url: str = "https://management.azure.com",
8382
**kwargs: Any
8483
) -> None:
85-
self._config = ScVmmMgmtClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
84+
_endpoint = "{endpoint}"
85+
self._config = ScVmmMgmtClientConfiguration(
86+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
87+
)
8688
_policies = kwargs.pop("policies", None)
8789
if _policies is None:
8890
_policies = [
@@ -101,40 +103,39 @@ def __init__(
101103
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
102104
self._config.http_logging_policy,
103105
]
104-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
106+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
105107

106-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
107-
self._serialize = Serializer(client_models)
108-
self._deserialize = Deserializer(client_models)
108+
self._serialize = Serializer()
109+
self._deserialize = Deserializer()
109110
self._serialize.client_side_validation = False
110-
self.virtual_machine_instances = VirtualMachineInstancesOperations(
111+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
112+
self.vmm_servers = VmmServersOperations(self._client, self._config, self._serialize, self._deserialize)
113+
self.clouds = CloudsOperations(self._client, self._config, self._serialize, self._deserialize)
114+
self.virtual_networks = VirtualNetworksOperations(
111115
self._client, self._config, self._serialize, self._deserialize
112116
)
113-
self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize)
114-
self.vm_instance_hybrid_identity_metadatas = VmInstanceHybridIdentityMetadatasOperations(
117+
self.virtual_machine_templates = VirtualMachineTemplatesOperations(
115118
self._client, self._config, self._serialize, self._deserialize
116119
)
117-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
118120
self.availability_sets = AvailabilitySetsOperations(
119121
self._client, self._config, self._serialize, self._deserialize
120122
)
121-
self.clouds = CloudsOperations(self._client, self._config, self._serialize, self._deserialize)
122-
self.virtual_machine_templates = VirtualMachineTemplatesOperations(
123+
self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize)
124+
self.virtual_machine_instances = VirtualMachineInstancesOperations(
123125
self._client, self._config, self._serialize, self._deserialize
124126
)
125-
self.virtual_networks = VirtualNetworksOperations(
127+
self.vm_instance_hybrid_identity_metadatas = VmInstanceHybridIdentityMetadatasOperations(
126128
self._client, self._config, self._serialize, self._deserialize
127129
)
128-
self.vmm_servers = VmmServersOperations(self._client, self._config, self._serialize, self._deserialize)
129-
self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize)
130+
self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize)
130131

131-
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
132+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
132133
"""Runs the network request through the client's chained policies.
133134
134135
>>> from azure.core.rest import HttpRequest
135136
>>> request = HttpRequest("GET", "https://www.example.org/")
136137
<HttpRequest [GET], url: 'https://www.example.org/'>
137-
>>> response = client._send_request(request)
138+
>>> response = client.send_request(request)
138139
<HttpResponse: 200 OK>
139140
140141
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -147,13 +148,17 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
147148
"""
148149

149150
request_copy = deepcopy(request)
150-
request_copy.url = self._client.format_url(request_copy.url)
151+
path_format_arguments = {
152+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
153+
}
154+
155+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
151156
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
152157

153158
def close(self) -> None:
154159
self._client.close()
155160

156-
def __enter__(self) -> "ScVmmMgmtClient":
161+
def __enter__(self) -> Self:
157162
self._client.__enter__()
158163
return self
159164

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

Lines changed: 16 additions & 8 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,34 @@
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 ScVmmMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
20+
class ScVmmMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes
2221
"""Configuration for ScVmmMgmtClient.
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
2928
: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 "2023-10-07". Note that overriding this
32-
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 "2024-06-01".
33+
Note that overriding this default value may result in unsupported behavior.
3334
:paramtype api_version: str
3435
"""
3536

36-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
37-
api_version: str = kwargs.pop("api_version", "2023-10-07")
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:
44+
api_version: str = kwargs.pop("api_version", "2024-06-01")
3845

3946
if credential is None:
4047
raise ValueError("Parameter 'credential' must not be None.")
@@ -43,6 +50,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4350

4451
self.credential = credential
4552
self.subscription_id = subscription_id
53+
self.base_url = base_url
4654
self.api_version = api_version
4755
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4856
kwargs.setdefault("sdk_moniker", "mgmt-scvmm/{}".format(VERSION))

0 commit comments

Comments
 (0)