Skip to content

Commit b721463

Browse files
author
SDKAuto
committed
CodeGen from PR 31915 in Azure/azure-rest-api-specs
Merge 983656781f675e9f6336ff55e9088d241df8e085 into ca4642f6cddab6de445a69ae0f617c5ddab9c2d5
1 parent 96b2d6e commit b721463

File tree

634 files changed

+1132709
-134
lines changed

Some content is hidden

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

634 files changed

+1132709
-134
lines changed

sdk/compute/azure-mgmt-compute/_meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"commit": "898ea5c3fac1ef8041ef6339ae00072058b06285",
2+
"commit": "f8d119de1db0e07e06122755ca9eef8fb7f743cd",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.10.2",
55
"use": [
66
"@autorest/[email protected]",
77
"@autorest/[email protected]"
88
],
9-
"autorest_command": "autorest specification/compute/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",
9+
"autorest_command": "autorest specification/compute/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/s/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/compute/resource-manager/readme.md",
1111
"package-2024-03-02-only": "2024-07-16 12:23:13 -0400 602fb5144a226577186e35845422c11db9067cf8 Microsoft.Compute/DiskRP/stable/2024-03-02/snapshot.json",
1212
"package-2024-03-01-only": "2024-06-05 15:03:47 -0700 491e00d17f24909ecf5e1030b3833bed51224e92 Microsoft.Compute/ComputeRP/stable/2024-03-01/virtualMachineScaleSet.json",

sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py

Lines changed: 1568 additions & 36 deletions
Large diffs are not rendered by default.

sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py

Lines changed: 1568 additions & 36 deletions
Large diffs are not rendered by default.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
# pylint: disable=wrong-import-position
9+
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._compute_management_client import ComputeManagementClient # type: ignore
16+
from ._version import VERSION
17+
18+
__version__ = VERSION
19+
20+
try:
21+
from ._patch import __all__ as _patch_all
22+
from ._patch import *
23+
except ImportError:
24+
_patch_all = []
25+
from ._patch import patch_sdk as _patch_sdk
26+
27+
__all__ = [
28+
"ComputeManagementClient",
29+
]
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
31+
32+
_patch_sdk()
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
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+
from typing_extensions import Self
12+
13+
from azure.core.pipeline import policies
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
17+
18+
from . import models as _models
19+
from .._serialization import Deserializer, Serializer
20+
from ._configuration import ComputeManagementClientConfiguration
21+
from .operations import (
22+
AvailabilitySetsOperations,
23+
UsageOperations,
24+
VirtualMachineExtensionImagesOperations,
25+
VirtualMachineExtensionsOperations,
26+
VirtualMachineImagesOperations,
27+
VirtualMachineScaleSetVMsOperations,
28+
VirtualMachineScaleSetsOperations,
29+
VirtualMachineSizesOperations,
30+
VirtualMachinesOperations,
31+
)
32+
33+
if TYPE_CHECKING:
34+
from azure.core.credentials import TokenCredential
35+
36+
37+
class ComputeManagementClient: # pylint: disable=too-many-instance-attributes
38+
"""Compute Client.
39+
40+
:ivar availability_sets: AvailabilitySetsOperations operations
41+
:vartype availability_sets:
42+
azure.mgmt.compute.v2015_06_15.operations.AvailabilitySetsOperations
43+
:ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations
44+
:vartype virtual_machine_extension_images:
45+
azure.mgmt.compute.v2015_06_15.operations.VirtualMachineExtensionImagesOperations
46+
:ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations
47+
:vartype virtual_machine_extensions:
48+
azure.mgmt.compute.v2015_06_15.operations.VirtualMachineExtensionsOperations
49+
:ivar virtual_machine_images: VirtualMachineImagesOperations operations
50+
:vartype virtual_machine_images:
51+
azure.mgmt.compute.v2015_06_15.operations.VirtualMachineImagesOperations
52+
:ivar usage: UsageOperations operations
53+
:vartype usage: azure.mgmt.compute.v2015_06_15.operations.UsageOperations
54+
:ivar virtual_machine_sizes: VirtualMachineSizesOperations operations
55+
:vartype virtual_machine_sizes:
56+
azure.mgmt.compute.v2015_06_15.operations.VirtualMachineSizesOperations
57+
:ivar virtual_machines: VirtualMachinesOperations operations
58+
:vartype virtual_machines: azure.mgmt.compute.v2015_06_15.operations.VirtualMachinesOperations
59+
:ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations
60+
:vartype virtual_machine_scale_sets:
61+
azure.mgmt.compute.v2015_06_15.operations.VirtualMachineScaleSetsOperations
62+
:ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations
63+
:vartype virtual_machine_scale_set_vms:
64+
azure.mgmt.compute.v2015_06_15.operations.VirtualMachineScaleSetVMsOperations
65+
:param credential: Credential needed for the client to connect to Azure. Required.
66+
:type credential: ~azure.core.credentials.TokenCredential
67+
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure
68+
subscription. The subscription ID forms part of the URI for every service call. Required.
69+
:type subscription_id: str
70+
:param base_url: Service URL. Default value is "https://management.azure.com".
71+
:type base_url: str
72+
:keyword api_version: Api Version. Default value is "2015-06-15". Note that overriding this
73+
default value may result in unsupported behavior.
74+
:paramtype api_version: str
75+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
76+
Retry-After header is present.
77+
"""
78+
79+
def __init__(
80+
self,
81+
credential: "TokenCredential",
82+
subscription_id: str,
83+
base_url: str = "https://management.azure.com",
84+
**kwargs: Any
85+
) -> None:
86+
self._config = ComputeManagementClientConfiguration(
87+
credential=credential, subscription_id=subscription_id, **kwargs
88+
)
89+
_policies = kwargs.pop("policies", None)
90+
if _policies is None:
91+
_policies = [
92+
policies.RequestIdPolicy(**kwargs),
93+
self._config.headers_policy,
94+
self._config.user_agent_policy,
95+
self._config.proxy_policy,
96+
policies.ContentDecodePolicy(**kwargs),
97+
ARMAutoResourceProviderRegistrationPolicy(),
98+
self._config.redirect_policy,
99+
self._config.retry_policy,
100+
self._config.authentication_policy,
101+
self._config.custom_hook_policy,
102+
self._config.logging_policy,
103+
policies.DistributedTracingPolicy(**kwargs),
104+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
105+
self._config.http_logging_policy,
106+
]
107+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
108+
109+
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
110+
self._serialize = Serializer(client_models)
111+
self._deserialize = Deserializer(client_models)
112+
self._serialize.client_side_validation = False
113+
self.availability_sets = AvailabilitySetsOperations(
114+
self._client, self._config, self._serialize, self._deserialize, "2015-06-15"
115+
)
116+
self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations(
117+
self._client, self._config, self._serialize, self._deserialize, "2015-06-15"
118+
)
119+
self.virtual_machine_extensions = VirtualMachineExtensionsOperations(
120+
self._client, self._config, self._serialize, self._deserialize, "2015-06-15"
121+
)
122+
self.virtual_machine_images = VirtualMachineImagesOperations(
123+
self._client, self._config, self._serialize, self._deserialize, "2015-06-15"
124+
)
125+
self.usage = UsageOperations(self._client, self._config, self._serialize, self._deserialize, "2015-06-15")
126+
self.virtual_machine_sizes = VirtualMachineSizesOperations(
127+
self._client, self._config, self._serialize, self._deserialize, "2015-06-15"
128+
)
129+
self.virtual_machines = VirtualMachinesOperations(
130+
self._client, self._config, self._serialize, self._deserialize, "2015-06-15"
131+
)
132+
self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations(
133+
self._client, self._config, self._serialize, self._deserialize, "2015-06-15"
134+
)
135+
self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations(
136+
self._client, self._config, self._serialize, self._deserialize, "2015-06-15"
137+
)
138+
139+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
140+
"""Runs the network request through the client's chained policies.
141+
142+
>>> from azure.core.rest import HttpRequest
143+
>>> request = HttpRequest("GET", "https://www.example.org/")
144+
<HttpRequest [GET], url: 'https://www.example.org/'>
145+
>>> response = client._send_request(request)
146+
<HttpResponse: 200 OK>
147+
148+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
149+
150+
:param request: The network request you want to make. Required.
151+
:type request: ~azure.core.rest.HttpRequest
152+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
153+
:return: The response of your network call. Does not do error handling on your response.
154+
:rtype: ~azure.core.rest.HttpResponse
155+
"""
156+
157+
request_copy = deepcopy(request)
158+
request_copy.url = self._client.format_url(request_copy.url)
159+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
160+
161+
def close(self) -> None:
162+
self._client.close()
163+
164+
def __enter__(self) -> Self:
165+
self._client.__enter__()
166+
return self
167+
168+
def __exit__(self, *exc_details: Any) -> None:
169+
self._client.__exit__(*exc_details)
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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 typing import Any, TYPE_CHECKING
10+
11+
from azure.core.pipeline import policies
12+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
13+
14+
from ._version import VERSION
15+
16+
if TYPE_CHECKING:
17+
from azure.core.credentials import TokenCredential
18+
19+
20+
class ComputeManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
21+
"""Configuration for ComputeManagementClient.
22+
23+
Note that all parameters used to create this instance are saved as instance
24+
attributes.
25+
26+
:param credential: Credential needed for the client to connect to Azure. Required.
27+
:type credential: ~azure.core.credentials.TokenCredential
28+
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure
29+
subscription. The subscription ID forms part of the URI for every service call. Required.
30+
:type subscription_id: str
31+
:keyword api_version: Api Version. Default value is "2015-06-15". Note that overriding this
32+
default value may result in unsupported behavior.
33+
:paramtype api_version: str
34+
"""
35+
36+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
37+
api_version: str = kwargs.pop("api_version", "2015-06-15")
38+
39+
if credential is None:
40+
raise ValueError("Parameter 'credential' must not be None.")
41+
if subscription_id is None:
42+
raise ValueError("Parameter 'subscription_id' must not be None.")
43+
44+
self.credential = credential
45+
self.subscription_id = subscription_id
46+
self.api_version = api_version
47+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
48+
kwargs.setdefault("sdk_moniker", "mgmt-compute/{}".format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
50+
self._configure(**kwargs)
51+
52+
def _configure(self, **kwargs: Any) -> None:
53+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
54+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
55+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
56+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
57+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
58+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
59+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
60+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
61+
self.authentication_policy = kwargs.get("authentication_policy")
62+
if self.credential and not self.authentication_policy:
63+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
64+
self.credential, *self.credential_scopes, **kwargs
65+
)

0 commit comments

Comments
 (0)