Skip to content

Commit f10ee01

Browse files
azure-sdkWzb123456789msyyc
authored
[AutoRelease] t2-avs-2022-10-13-52806(Do not merge) (#26798)
* code and test * Update CHANGELOG.md * Update CHANGELOG.md * Update _version.py Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: zhenbiao wei <[email protected]> Co-authored-by: Yuchao Yan <[email protected]>
1 parent 9f1085e commit f10ee01

Some content is hidden

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

59 files changed

+27290
-17949
lines changed

sdk/compute/azure-mgmt-avs/CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Release History
22

3+
# 7.1.0 (2022-10-18)
4+
5+
### Features Added
6+
7+
- Added operation ClustersOperations.list_zones
8+
- Added operation WorkloadNetworksOperations.get
9+
- Added operation WorkloadNetworksOperations.list
10+
- Model EncryptionKeyVaultProperties has a new parameter auto_detected_key_version
11+
- Model PlacementPolicyUpdate has a new parameter affinity_strength
12+
- Model PlacementPolicyUpdate has a new parameter azure_hybrid_benefit_type
13+
- Model PrivateCloud has a new parameter nsx_public_ip_quota_raised
14+
- Model PrivateCloudProperties has a new parameter nsx_public_ip_quota_raised
15+
- Model ScriptPackage has a new parameter company
16+
- Model ScriptPackage has a new parameter uri
17+
- Model VmHostPlacementPolicyProperties has a new parameter affinity_strength
18+
- Model VmHostPlacementPolicyProperties has a new parameter azure_hybrid_benefit_type
19+
- Operation LocationsOperations.check_trial_availability has a new parameter sku
20+
321
## 7.0.0 (2021-11-11)
422

523
**Features**

sdk/compute/azure-mgmt-avs/MANIFEST.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include _meta.json
2-
recursive-include tests *.py *.yaml
2+
recursive-include tests *.py *.json
3+
recursive-include samples *.py *.md
34
include *.md
45
include azure/__init__.py
56
include azure/mgmt/__init__.py

sdk/compute/azure-mgmt-avs/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

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

77
## _Disclaimer_
@@ -12,8 +12,6 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313

1414
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
15-
16-
1715

1816
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
1917
Code samples for this package can be found at [Avs Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.4.5",
2+
"autorest": "3.9.2",
33
"use": [
4-
"@autorest/python@5.8.4",
5-
"@autorest/modelerfour@4.19.2"
4+
"@autorest/python@6.1.11",
5+
"@autorest/modelerfour@4.24.3"
66
],
7-
"commit": "69e98508ef71f09851b2a79971d2d8e12560adc5",
7+
"commit": "c71a66dab813061f1d09982c2748a09317fe0860",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/vmware/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.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5",
9+
"autorest_command": "autorest specification/vmware/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.11 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
1010
"readme": "specification/vmware/resource-manager/readme.md"
1111
}

sdk/compute/azure-mgmt-avs/azure/mgmt/avs/__init__.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
13-
__all__ = ['AVSClient']
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+
21+
__all__ = ["AVSClient"]
22+
__all__.extend([p for p in _patch_all if p not in __all__])
23+
24+
_patch_sdk()

sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_avs_client.py

+81-79
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,40 @@
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

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
12-
from msrest import Deserializer, Serializer
14+
15+
from . import models
16+
from ._configuration import AVSClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
AddonsOperations,
20+
AuthorizationsOperations,
21+
CloudLinksOperations,
22+
ClustersOperations,
23+
DatastoresOperations,
24+
GlobalReachConnectionsOperations,
25+
HcxEnterpriseSitesOperations,
26+
LocationsOperations,
27+
Operations,
28+
PlacementPoliciesOperations,
29+
PrivateCloudsOperations,
30+
ScriptCmdletsOperations,
31+
ScriptExecutionsOperations,
32+
ScriptPackagesOperations,
33+
VirtualMachinesOperations,
34+
WorkloadNetworksOperations,
35+
)
1336

1437
if TYPE_CHECKING:
1538
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1839
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
20-
21-
from ._configuration import AVSClientConfiguration
22-
from .operations import Operations
23-
from .operations import LocationsOperations
24-
from .operations import PrivateCloudsOperations
25-
from .operations import ClustersOperations
26-
from .operations import DatastoresOperations
27-
from .operations import HcxEnterpriseSitesOperations
28-
from .operations import AuthorizationsOperations
29-
from .operations import GlobalReachConnectionsOperations
30-
from .operations import WorkloadNetworksOperations
31-
from .operations import CloudLinksOperations
32-
from .operations import AddonsOperations
33-
from .operations import VirtualMachinesOperations
34-
from .operations import PlacementPoliciesOperations
35-
from .operations import ScriptPackagesOperations
36-
from .operations import ScriptCmdletsOperations
37-
from .operations import ScriptExecutionsOperations
38-
from . import models
3940

4041

41-
class AVSClient(object):
42+
class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
4243
"""Azure VMware Solution API.
4344
4445
:ivar operations: Operations operations
@@ -73,82 +74,83 @@ class AVSClient(object):
7374
:vartype script_cmdlets: azure.mgmt.avs.operations.ScriptCmdletsOperations
7475
:ivar script_executions: ScriptExecutionsOperations operations
7576
:vartype script_executions: azure.mgmt.avs.operations.ScriptExecutionsOperations
76-
:param credential: Credential needed for the client to connect to Azure.
77+
:param credential: Credential needed for the client to connect to Azure. Required.
7778
:type credential: ~azure.core.credentials.TokenCredential
78-
:param subscription_id: The ID of the target subscription.
79+
:param subscription_id: The ID of the target subscription. Required.
7980
:type subscription_id: str
80-
:param str base_url: Service URL
81-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
81+
:param base_url: Service URL. Default value is "https://management.azure.com".
82+
:type base_url: str
83+
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
84+
default value may result in unsupported behavior.
85+
:paramtype api_version: str
86+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
87+
Retry-After header is present.
8288
"""
8389

8490
def __init__(
8591
self,
86-
credential, # type: "TokenCredential"
87-
subscription_id, # type: str
88-
base_url=None, # type: Optional[str]
89-
**kwargs # type: Any
90-
):
91-
# type: (...) -> None
92-
if not base_url:
93-
base_url = 'https://management.azure.com'
94-
self._config = AVSClientConfiguration(credential, subscription_id, **kwargs)
92+
credential: "TokenCredential",
93+
subscription_id: str,
94+
base_url: str = "https://management.azure.com",
95+
**kwargs: Any
96+
) -> None:
97+
self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
9598
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
9699

97100
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
98101
self._serialize = Serializer(client_models)
99-
self._serialize.client_side_validation = False
100102
self._deserialize = Deserializer(client_models)
101-
102-
self.operations = Operations(
103-
self._client, self._config, self._serialize, self._deserialize)
104-
self.locations = LocationsOperations(
105-
self._client, self._config, self._serialize, self._deserialize)
106-
self.private_clouds = PrivateCloudsOperations(
107-
self._client, self._config, self._serialize, self._deserialize)
108-
self.clusters = ClustersOperations(
109-
self._client, self._config, self._serialize, self._deserialize)
110-
self.datastores = DatastoresOperations(
111-
self._client, self._config, self._serialize, self._deserialize)
103+
self._serialize.client_side_validation = False
104+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
105+
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
106+
self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize)
107+
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
108+
self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize)
112109
self.hcx_enterprise_sites = HcxEnterpriseSitesOperations(
113-
self._client, self._config, self._serialize, self._deserialize)
114-
self.authorizations = AuthorizationsOperations(
115-
self._client, self._config, self._serialize, self._deserialize)
110+
self._client, self._config, self._serialize, self._deserialize
111+
)
112+
self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize)
116113
self.global_reach_connections = GlobalReachConnectionsOperations(
117-
self._client, self._config, self._serialize, self._deserialize)
114+
self._client, self._config, self._serialize, self._deserialize
115+
)
118116
self.workload_networks = WorkloadNetworksOperations(
119-
self._client, self._config, self._serialize, self._deserialize)
120-
self.cloud_links = CloudLinksOperations(
121-
self._client, self._config, self._serialize, self._deserialize)
122-
self.addons = AddonsOperations(
123-
self._client, self._config, self._serialize, self._deserialize)
117+
self._client, self._config, self._serialize, self._deserialize
118+
)
119+
self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize)
120+
self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize)
124121
self.virtual_machines = VirtualMachinesOperations(
125-
self._client, self._config, self._serialize, self._deserialize)
122+
self._client, self._config, self._serialize, self._deserialize
123+
)
126124
self.placement_policies = PlacementPoliciesOperations(
127-
self._client, self._config, self._serialize, self._deserialize)
128-
self.script_packages = ScriptPackagesOperations(
129-
self._client, self._config, self._serialize, self._deserialize)
130-
self.script_cmdlets = ScriptCmdletsOperations(
131-
self._client, self._config, self._serialize, self._deserialize)
125+
self._client, self._config, self._serialize, self._deserialize
126+
)
127+
self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize)
128+
self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize)
132129
self.script_executions = ScriptExecutionsOperations(
133-
self._client, self._config, self._serialize, self._deserialize)
130+
self._client, self._config, self._serialize, self._deserialize
131+
)
134132

135-
def _send_request(self, http_request, **kwargs):
136-
# type: (HttpRequest, Any) -> HttpResponse
133+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
137134
"""Runs the network request through the client's chained policies.
138135
139-
:param http_request: The network request you want to make. Required.
140-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
141-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
136+
>>> from azure.core.rest import HttpRequest
137+
>>> request = HttpRequest("GET", "https://www.example.org/")
138+
<HttpRequest [GET], url: 'https://www.example.org/'>
139+
>>> response = client._send_request(request)
140+
<HttpResponse: 200 OK>
141+
142+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
143+
144+
:param request: The network request you want to make. Required.
145+
:type request: ~azure.core.rest.HttpRequest
146+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
142147
:return: The response of your network call. Does not do error handling on your response.
143-
:rtype: ~azure.core.pipeline.transport.HttpResponse
148+
:rtype: ~azure.core.rest.HttpResponse
144149
"""
145-
path_format_arguments = {
146-
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
147-
}
148-
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
149-
stream = kwargs.pop("stream", True)
150-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
151-
return pipeline_response.http_response
150+
151+
request_copy = deepcopy(request)
152+
request_copy.url = self._client.format_url(request_copy.url)
153+
return self._client.send_request(request_copy, **kwargs)
152154

153155
def close(self):
154156
# type: () -> None

sdk/compute/azure-mgmt-avs/azure/mgmt/avs/_configuration.py

+28-30
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,64 @@
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 AVSClientConfiguration(Configuration):
22+
class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2523
"""Configuration for AVSClient.
2624
2725
Note that all parameters used to create this instance are saved as instance
2826
attributes.
2927
30-
:param credential: Credential needed for the client to connect to Azure.
28+
:param credential: Credential needed for the client to connect to Azure. Required.
3129
:type credential: ~azure.core.credentials.TokenCredential
32-
:param subscription_id: The ID of the target subscription.
30+
:param subscription_id: The ID of the target subscription. Required.
3331
:type subscription_id: str
32+
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
33+
default value may result in unsupported behavior.
34+
:paramtype api_version: str
3435
"""
3536

36-
def __init__(
37-
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
37+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38+
super(AVSClientConfiguration, self).__init__(**kwargs)
39+
api_version = kwargs.pop("api_version", "2022-05-01") # type: str
40+
4341
if credential is None:
4442
raise ValueError("Parameter 'credential' must not be None.")
4543
if subscription_id is None:
4644
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(AVSClientConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
51-
self.api_version = "2021-12-01"
52-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
53-
kwargs.setdefault('sdk_moniker', 'mgmt-avs/{}'.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-avs/{}".format(VERSION))
5451
self._configure(**kwargs)
5552

5653
def _configure(
57-
self,
58-
**kwargs # type: Any
54+
self, **kwargs # type: Any
5955
):
6056
# type: (...) -> None
61-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
62-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
63-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
64-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
65-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
66-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
67-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
68-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
69-
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")
7066
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
68+
self.credential, *self.credential_scopes, **kwargs
69+
)

0 commit comments

Comments
 (0)