Skip to content

Commit eebf45a

Browse files
author
SDKAuto
committed
CodeGen from PR 21043 in Azure/azure-rest-api-specs
Merge 54ab50e23d5066484f6c169903832b6fc469e53b into 0af1101de444d29bfb59dcc25d017d375337c984
1 parent 5af894b commit eebf45a

Some content is hidden

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

44 files changed

+16294
-12384
lines changed
Lines changed: 5 additions & 5 deletions
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.9",
5+
"@autorest/modelerfour@4.24.3"
66
],
7-
"commit": "7326c66014c2180e83c52c30f150eea094613ca4",
7+
"commit": "bd3f2e885f020bf8c91d681ec0fd01e08a028554",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/hdinsight/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/hdinsight/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.1.9 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
1010
"readme": "specification/hdinsight/resource-manager/readme.md"
1111
}

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
from ._version import VERSION
1111

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

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

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,65 @@
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 HDInsightManagementClientConfiguration(Configuration):
22+
class HDInsightManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2523
"""Configuration for HDInsightManagementClient.
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 subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
30+
:param subscription_id: The subscription credentials which uniquely identify Microsoft Azure
31+
subscription. The subscription ID forms part of the URI for every service call. Required.
3332
:type subscription_id: str
33+
:keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this
34+
default value may result in unsupported behavior.
35+
:paramtype api_version: str
3436
"""
3537

36-
def __init__(
37-
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
38+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
39+
super(HDInsightManagementClientConfiguration, self).__init__(**kwargs)
40+
api_version = kwargs.pop("api_version", "2021-06-01") # type: str
41+
4342
if credential is None:
4443
raise ValueError("Parameter 'credential' must not be None.")
4544
if subscription_id is None:
4645
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(HDInsightManagementClientConfiguration, self).__init__(**kwargs)
4846

4947
self.credential = credential
5048
self.subscription_id = subscription_id
51-
self.api_version = "2021-06-01"
52-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
53-
kwargs.setdefault('sdk_moniker', 'mgmt-hdinsight/{}'.format(VERSION))
49+
self.api_version = api_version
50+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
51+
kwargs.setdefault("sdk_moniker", "mgmt-hdinsight/{}".format(VERSION))
5452
self._configure(**kwargs)
5553

5654
def _configure(
57-
self,
58-
**kwargs # type: Any
55+
self, **kwargs # type: Any
5956
):
6057
# 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')
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")
7067
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
68+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
69+
self.credential, *self.credential_scopes, **kwargs
70+
)

sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py

Lines changed: 76 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,35 @@
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 HDInsightManagementClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import (
19+
ApplicationsOperations,
20+
ClustersOperations,
21+
ConfigurationsOperations,
22+
ExtensionsOperations,
23+
LocationsOperations,
24+
Operations,
25+
PrivateEndpointConnectionsOperations,
26+
PrivateLinkResourcesOperations,
27+
ScriptActionsOperations,
28+
ScriptExecutionHistoryOperations,
29+
VirtualMachinesOperations,
30+
)
1331

1432
if TYPE_CHECKING:
1533
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1834
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
20-
21-
from ._configuration import HDInsightManagementClientConfiguration
22-
from .operations import ClustersOperations
23-
from .operations import ApplicationsOperations
24-
from .operations import LocationsOperations
25-
from .operations import ConfigurationsOperations
26-
from .operations import ExtensionsOperations
27-
from .operations import ScriptActionsOperations
28-
from .operations import ScriptExecutionHistoryOperations
29-
from .operations import Operations
30-
from .operations import VirtualMachinesOperations
31-
from .operations import PrivateEndpointConnectionsOperations
32-
from .operations import PrivateLinkResourcesOperations
33-
from . import models
3435

3536

36-
class HDInsightManagementClient(object):
37+
class HDInsightManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
3738
"""HDInsight Management Client.
3839
3940
:ivar clusters: ClustersOperations operations
@@ -49,81 +50,88 @@ class HDInsightManagementClient(object):
4950
:ivar script_actions: ScriptActionsOperations operations
5051
:vartype script_actions: azure.mgmt.hdinsight.operations.ScriptActionsOperations
5152
:ivar script_execution_history: ScriptExecutionHistoryOperations operations
52-
:vartype script_execution_history: azure.mgmt.hdinsight.operations.ScriptExecutionHistoryOperations
53+
:vartype script_execution_history:
54+
azure.mgmt.hdinsight.operations.ScriptExecutionHistoryOperations
5355
:ivar operations: Operations operations
5456
:vartype operations: azure.mgmt.hdinsight.operations.Operations
5557
:ivar virtual_machines: VirtualMachinesOperations operations
5658
:vartype virtual_machines: azure.mgmt.hdinsight.operations.VirtualMachinesOperations
5759
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
58-
:vartype private_endpoint_connections: azure.mgmt.hdinsight.operations.PrivateEndpointConnectionsOperations
60+
:vartype private_endpoint_connections:
61+
azure.mgmt.hdinsight.operations.PrivateEndpointConnectionsOperations
5962
:ivar private_link_resources: PrivateLinkResourcesOperations operations
6063
:vartype private_link_resources: azure.mgmt.hdinsight.operations.PrivateLinkResourcesOperations
61-
:param credential: Credential needed for the client to connect to Azure.
64+
:param credential: Credential needed for the client to connect to Azure. Required.
6265
:type credential: ~azure.core.credentials.TokenCredential
63-
:param subscription_id: The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
66+
:param subscription_id: The subscription credentials which uniquely identify Microsoft Azure
67+
subscription. The subscription ID forms part of the URI for every service call. Required.
6468
:type subscription_id: str
65-
:param str base_url: Service URL
66-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
69+
:param base_url: Service URL. Default value is "https://management.azure.com".
70+
:type base_url: str
71+
:keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this
72+
default value may result in unsupported behavior.
73+
:paramtype api_version: str
74+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
75+
Retry-After header is present.
6776
"""
6877

6978
def __init__(
7079
self,
71-
credential, # type: "TokenCredential"
72-
subscription_id, # type: str
73-
base_url=None, # type: Optional[str]
74-
**kwargs # type: Any
75-
):
76-
# type: (...) -> None
77-
if not base_url:
78-
base_url = 'https://management.azure.com'
79-
self._config = HDInsightManagementClientConfiguration(credential, subscription_id, **kwargs)
80+
credential: "TokenCredential",
81+
subscription_id: str,
82+
base_url: str = "https://management.azure.com",
83+
**kwargs: Any
84+
) -> None:
85+
self._config = HDInsightManagementClientConfiguration(
86+
credential=credential, subscription_id=subscription_id, **kwargs
87+
)
8088
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
8189

8290
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
8391
self._serialize = Serializer(client_models)
84-
self._serialize.client_side_validation = False
8592
self._deserialize = Deserializer(client_models)
86-
87-
self.clusters = ClustersOperations(
88-
self._client, self._config, self._serialize, self._deserialize)
89-
self.applications = ApplicationsOperations(
90-
self._client, self._config, self._serialize, self._deserialize)
91-
self.locations = LocationsOperations(
92-
self._client, self._config, self._serialize, self._deserialize)
93-
self.configurations = ConfigurationsOperations(
94-
self._client, self._config, self._serialize, self._deserialize)
95-
self.extensions = ExtensionsOperations(
96-
self._client, self._config, self._serialize, self._deserialize)
97-
self.script_actions = ScriptActionsOperations(
98-
self._client, self._config, self._serialize, self._deserialize)
93+
self._serialize.client_side_validation = False
94+
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
95+
self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize)
96+
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
97+
self.configurations = ConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize)
98+
self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize)
99+
self.script_actions = ScriptActionsOperations(self._client, self._config, self._serialize, self._deserialize)
99100
self.script_execution_history = ScriptExecutionHistoryOperations(
100-
self._client, self._config, self._serialize, self._deserialize)
101-
self.operations = Operations(
102-
self._client, self._config, self._serialize, self._deserialize)
101+
self._client, self._config, self._serialize, self._deserialize
102+
)
103+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
103104
self.virtual_machines = VirtualMachinesOperations(
104-
self._client, self._config, self._serialize, self._deserialize)
105+
self._client, self._config, self._serialize, self._deserialize
106+
)
105107
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
106-
self._client, self._config, self._serialize, self._deserialize)
108+
self._client, self._config, self._serialize, self._deserialize
109+
)
107110
self.private_link_resources = PrivateLinkResourcesOperations(
108-
self._client, self._config, self._serialize, self._deserialize)
111+
self._client, self._config, self._serialize, self._deserialize
112+
)
109113

110-
def _send_request(self, http_request, **kwargs):
111-
# type: (HttpRequest, Any) -> HttpResponse
114+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
112115
"""Runs the network request through the client's chained policies.
113116
114-
:param http_request: The network request you want to make. Required.
115-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
116-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
117+
>>> from azure.core.rest import HttpRequest
118+
>>> request = HttpRequest("GET", "https://www.example.org/")
119+
<HttpRequest [GET], url: 'https://www.example.org/'>
120+
>>> response = client._send_request(request)
121+
<HttpResponse: 200 OK>
122+
123+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
124+
125+
:param request: The network request you want to make. Required.
126+
:type request: ~azure.core.rest.HttpRequest
127+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
117128
:return: The response of your network call. Does not do error handling on your response.
118-
:rtype: ~azure.core.pipeline.transport.HttpResponse
129+
:rtype: ~azure.core.rest.HttpResponse
119130
"""
120-
path_format_arguments = {
121-
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
122-
}
123-
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
124-
stream = kwargs.pop("stream", True)
125-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
126-
return pipeline_response.http_response
131+
132+
request_copy = deepcopy(request)
133+
request_copy.url = self._client.format_url(request_copy.url)
134+
return self._client.send_request(request_copy, **kwargs)
127135

128136
def close(self):
129137
# type: () -> None

0 commit comments

Comments
 (0)