Skip to content

Commit b4641f2

Browse files
author
SDKAuto
committed
CodeGen from PR 26644 in Azure/azure-rest-api-specs
Merge 5bf267a768138ae7f6056f66e0eef8e142718f5e into fba917faefdd37873aea9eb998b8f114c5e5b7c5
1 parent 4c85db2 commit b4641f2

139 files changed

Lines changed: 14661 additions & 11976 deletions

File tree

Some content is hidden

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

sdk/scvmm/azure-mgmt-scvmm/README.md

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,61 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Scvmm Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
88

99
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
1010

11-
# Usage
11+
## Getting started
1212

13+
### Prerequisites
1314

14-
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15-
16-
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
17-
Code samples for this package can be found at [Scvmm Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
18-
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
15+
- Python 3.8+ is required to use this package.
16+
- [Azure subscription](https://azure.microsoft.com/free/)
1917

18+
### Install the package
2019

21-
# Provide Feedback
20+
```bash
21+
pip install azure-mgmt-scvmm
22+
pip install azure-identity
23+
```
24+
25+
### Authentication
26+
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.
28+
29+
- `AZURE_CLIENT_ID` for Azure client ID.
30+
- `AZURE_TENANT_ID` for Azure tenant ID.
31+
- `AZURE_CLIENT_SECRET` for Azure client secret.
32+
33+
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
34+
35+
With above configuration, client can be authenticated by following code:
36+
37+
```python
38+
from azure.identity import DefaultAzureCredential
39+
from azure.mgmt.scvmm import SCVMM
40+
import os
41+
42+
sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
43+
client = SCVMM(credential=DefaultAzureCredential(), subscription_id=sub_id)
44+
```
45+
46+
## Examples
47+
48+
Code samples for this package can be found at:
49+
- [Search Scvmm Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com
50+
- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
51+
52+
53+
## Troubleshooting
54+
55+
## Next steps
56+
57+
## Provide Feedback
2258

2359
If you encounter any bugs or have suggestions, please file an issue in the
2460
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
2561
section of the project.
26-
27-
28-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-scvmm%2FREADME.png)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"commit": "7a54c1a83d14da431c0ae48c4315cba143084bce",
2+
"commit": "2426adf3e648d1709018f1d6844a5db404c789b2",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.2",
4+
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.2.7",
7-
"@autorest/modelerfour@4.24.3"
6+
"@autorest/python@6.13.16",
7+
"@autorest/modelerfour@4.27.0"
88
],
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/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/scvmm/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/scvmm/resource-manager/readme.md"
1111
}

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

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

9-
from ._scvmm import SCVMM
9+
from ._sc_vmm_mgmt_client import ScVmmMgmtClient
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
@@ -19,7 +19,7 @@
1919
from ._patch import patch_sdk as _patch_sdk
2020

2121
__all__ = [
22-
"SCVMM",
22+
"ScVmmMgmtClient",
2323
]
2424
__all__.extend([p for p in _patch_all if p not in __all__])
2525

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

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

9-
import sys
109
from typing import Any, TYPE_CHECKING
1110

12-
from azure.core.configuration import Configuration
1311
from azure.core.pipeline import policies
1412
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1513

1614
from ._version import VERSION
1715

18-
if sys.version_info >= (3, 8):
19-
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20-
else:
21-
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22-
2316
if TYPE_CHECKING:
2417
# pylint: disable=unused-import,ungrouped-imports
2518
from azure.core.credentials import TokenCredential
2619

2720

28-
class SCVMMConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
29-
"""Configuration for SCVMM.
21+
class ScVmmMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
22+
"""Configuration for ScVmmMgmtClient.
3023
3124
Note that all parameters used to create this instance are saved as instance
3225
attributes.
3326
3427
:param credential: Credential needed for the client to connect to Azure. Required.
3528
:type credential: ~azure.core.credentials.TokenCredential
36-
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
37-
00000000-0000-0000-0000-000000000000). Required.
29+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3830
:type subscription_id: str
39-
:keyword api_version: Api Version. Default value is "2020-06-05-preview". Note that overriding
40-
this default value may result in unsupported behavior.
31+
:keyword api_version: Api Version. Default value is "2023-10-07". Note that overriding this
32+
default value may result in unsupported behavior.
4133
:paramtype api_version: str
4234
"""
4335

4436
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
45-
super(SCVMMConfiguration, self).__init__(**kwargs)
46-
api_version: Literal["2020-06-05-preview"] = kwargs.pop("api_version", "2020-06-05-preview")
37+
api_version: str = kwargs.pop("api_version", "2023-10-07")
4738

4839
if credential is None:
4940
raise ValueError("Parameter 'credential' must not be None.")
@@ -55,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
5546
self.api_version = api_version
5647
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5748
kwargs.setdefault("sdk_moniker", "mgmt-scvmm/{}".format(VERSION))
49+
self.polling_interval = kwargs.get("polling_interval", 30)
5850
self._configure(**kwargs)
5951

6052
def _configure(self, **kwargs: Any) -> None:
@@ -63,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None:
6355
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
6456
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
6557
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
66-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6758
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6859
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
60+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6961
self.authentication_policy = kwargs.get("authentication_policy")
7062
if self.credential and not self.authentication_policy:
7163
self.authentication_policy = ARMChallengeAuthenticationPolicy(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#
2626
# --------------------------------------------------------------------------
2727

28+
2829
# This file is used for handwritten extensions to the generated code. Example:
2930
# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
3031
def patch_sdk():

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

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,24 @@
99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
1111

12+
from azure.core.pipeline import policies
1213
from azure.core.rest import HttpRequest, HttpResponse
1314
from azure.mgmt.core import ARMPipelineClient
15+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1416

1517
from . import models as _models
16-
from ._configuration import SCVMMConfiguration
18+
from ._configuration import ScVmmMgmtClientConfiguration
1719
from ._serialization import Deserializer, Serializer
1820
from .operations import (
1921
AvailabilitySetsOperations,
2022
CloudsOperations,
23+
GuestAgentsOperations,
2124
InventoryItemsOperations,
2225
Operations,
26+
VirtualMachineInstancesOperations,
2327
VirtualMachineTemplatesOperations,
24-
VirtualMachinesOperations,
2528
VirtualNetworksOperations,
29+
VmInstanceHybridIdentityMetadatasOperations,
2630
VmmServersOperations,
2731
)
2832

@@ -31,35 +35,41 @@
3135
from azure.core.credentials import TokenCredential
3236

3337

34-
class SCVMM: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
38+
class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3539
"""The Microsoft.ScVmm Rest API spec.
3640
37-
:ivar vmm_servers: VmmServersOperations operations
38-
:vartype vmm_servers: azure.mgmt.scvmm.operations.VmmServersOperations
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
3950
:ivar operations: Operations operations
4051
:vartype operations: azure.mgmt.scvmm.operations.Operations
52+
:ivar availability_sets: AvailabilitySetsOperations operations
53+
:vartype availability_sets: azure.mgmt.scvmm.operations.AvailabilitySetsOperations
4154
:ivar clouds: CloudsOperations operations
4255
:vartype clouds: azure.mgmt.scvmm.operations.CloudsOperations
43-
:ivar virtual_networks: VirtualNetworksOperations operations
44-
:vartype virtual_networks: azure.mgmt.scvmm.operations.VirtualNetworksOperations
45-
:ivar virtual_machines: VirtualMachinesOperations operations
46-
:vartype virtual_machines: azure.mgmt.scvmm.operations.VirtualMachinesOperations
4756
:ivar virtual_machine_templates: VirtualMachineTemplatesOperations operations
4857
:vartype virtual_machine_templates:
4958
azure.mgmt.scvmm.operations.VirtualMachineTemplatesOperations
50-
:ivar availability_sets: AvailabilitySetsOperations operations
51-
:vartype availability_sets: azure.mgmt.scvmm.operations.AvailabilitySetsOperations
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
5263
:ivar inventory_items: InventoryItemsOperations operations
5364
:vartype inventory_items: azure.mgmt.scvmm.operations.InventoryItemsOperations
5465
:param credential: Credential needed for the client to connect to Azure. Required.
5566
:type credential: ~azure.core.credentials.TokenCredential
56-
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
57-
00000000-0000-0000-0000-000000000000). Required.
67+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5868
:type subscription_id: str
5969
:param base_url: Service URL. Default value is "https://management.azure.com".
6070
:type base_url: str
61-
:keyword api_version: Api Version. Default value is "2020-06-05-preview". Note that overriding
62-
this default value may result in unsupported behavior.
71+
:keyword api_version: Api Version. Default value is "2023-10-07". Note that overriding this
72+
default value may result in unsupported behavior.
6373
:paramtype api_version: str
6474
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6575
Retry-After header is present.
@@ -72,31 +82,53 @@ def __init__(
7282
base_url: str = "https://management.azure.com",
7383
**kwargs: Any
7484
) -> None:
75-
self._config = SCVMMConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
76-
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
85+
self._config = ScVmmMgmtClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
86+
_policies = kwargs.pop("policies", None)
87+
if _policies is None:
88+
_policies = [
89+
policies.RequestIdPolicy(**kwargs),
90+
self._config.headers_policy,
91+
self._config.user_agent_policy,
92+
self._config.proxy_policy,
93+
policies.ContentDecodePolicy(**kwargs),
94+
ARMAutoResourceProviderRegistrationPolicy(),
95+
self._config.redirect_policy,
96+
self._config.retry_policy,
97+
self._config.authentication_policy,
98+
self._config.custom_hook_policy,
99+
self._config.logging_policy,
100+
policies.DistributedTracingPolicy(**kwargs),
101+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
102+
self._config.http_logging_policy,
103+
]
104+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
77105

78106
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
79107
self._serialize = Serializer(client_models)
80108
self._deserialize = Deserializer(client_models)
81109
self._serialize.client_side_validation = False
82-
self.vmm_servers = VmmServersOperations(self._client, self._config, self._serialize, self._deserialize)
83-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
84-
self.clouds = CloudsOperations(self._client, self._config, self._serialize, self._deserialize)
85-
self.virtual_networks = VirtualNetworksOperations(
110+
self.virtual_machine_instances = VirtualMachineInstancesOperations(
111+
self._client, self._config, self._serialize, self._deserialize
112+
)
113+
self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize)
114+
self.vm_instance_hybrid_identity_metadatas = VmInstanceHybridIdentityMetadatasOperations(
86115
self._client, self._config, self._serialize, self._deserialize
87116
)
88-
self.virtual_machines = VirtualMachinesOperations(
117+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
118+
self.availability_sets = AvailabilitySetsOperations(
89119
self._client, self._config, self._serialize, self._deserialize
90120
)
121+
self.clouds = CloudsOperations(self._client, self._config, self._serialize, self._deserialize)
91122
self.virtual_machine_templates = VirtualMachineTemplatesOperations(
92123
self._client, self._config, self._serialize, self._deserialize
93124
)
94-
self.availability_sets = AvailabilitySetsOperations(
125+
self.virtual_networks = VirtualNetworksOperations(
95126
self._client, self._config, self._serialize, self._deserialize
96127
)
128+
self.vmm_servers = VmmServersOperations(self._client, self._config, self._serialize, self._deserialize)
97129
self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize)
98130

99-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
131+
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
100132
"""Runs the network request through the client's chained policies.
101133
102134
>>> from azure.core.rest import HttpRequest
@@ -116,14 +148,14 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
116148

117149
request_copy = deepcopy(request)
118150
request_copy.url = self._client.format_url(request_copy.url)
119-
return self._client.send_request(request_copy, **kwargs)
151+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
120152

121153
def close(self) -> None:
122154
self._client.close()
123155

124-
def __enter__(self) -> "SCVMM":
156+
def __enter__(self) -> "ScVmmMgmtClient":
125157
self._client.__enter__()
126158
return self
127159

128-
def __exit__(self, *exc_details) -> None:
160+
def __exit__(self, *exc_details: Any) -> None:
129161
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)