Skip to content

Commit 9108330

Browse files
author
SDKAuto
committed
CodeGen from PR 17361 in Azure/azure-rest-api-specs
Merge 851e9c976ec7ed30c31483c4eb00fa7a419b646a into d72b193
1 parent 7da396f commit 9108330

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

+9574
-8332
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"autorest": "3.7.2",
3+
"use": [
4+
"@autorest/python@5.12.0",
5+
"@autorest/modelerfour@4.19.3"
6+
],
7+
"commit": "916fca5594f33bb89932ef680c0da828fae42833",
8+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9+
"autorest_command": "autorest specification/machinelearningservices/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
10+
"readme": "specification/machinelearningservices/resource-manager/readme.md"
11+
}

sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
__version__ = VERSION
1313
__all__ = ['AzureMachineLearningWorkspaces']
1414

15-
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
18-
except ImportError:
19-
pass
15+
# `._patch.py` is used for handwritten extensions to the generated code
16+
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17+
from ._patch import patch_sdk
18+
patch_sdk()

sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_azure_machine_learning_workspaces.py

Lines changed: 77 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,106 +6,113 @@
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, Optional, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
1214
from msrest import Deserializer, Serializer
1315

16+
from . import models
17+
from ._configuration import AzureMachineLearningWorkspacesConfiguration
18+
from .operations import ComputeOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspaceSkusOperations, WorkspacesOperations
19+
1420
if TYPE_CHECKING:
1521
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1822
from azure.core.credentials import TokenCredential
1923

20-
from ._configuration import AzureMachineLearningWorkspacesConfiguration
21-
from .operations import Operations
22-
from .operations import WorkspacesOperations
23-
from .operations import WorkspaceFeaturesOperations
24-
from .operations import NotebooksOperations
25-
from .operations import UsagesOperations
26-
from .operations import VirtualMachineSizesOperations
27-
from .operations import QuotasOperations
28-
from .operations import WorkspaceConnectionsOperations
29-
from .operations import MachineLearningComputeOperations
30-
from .operations import AzureMachineLearningWorkspacesOperationsMixin
31-
from .operations import PrivateEndpointConnectionsOperations
32-
from .operations import PrivateLinkResourcesOperations
33-
from . import models
34-
35-
36-
class AzureMachineLearningWorkspaces(AzureMachineLearningWorkspacesOperationsMixin):
24+
class AzureMachineLearningWorkspaces:
3725
"""These APIs allow end users to operate on Azure Machine Learning Workspace resources.
3826
3927
:ivar operations: Operations operations
40-
:vartype operations: azure.mgmt.machinelearningservices.operations.Operations
28+
:vartype operations: azure_machine_learning_workspaces.operations.Operations
4129
:ivar workspaces: WorkspacesOperations operations
42-
:vartype workspaces: azure.mgmt.machinelearningservices.operations.WorkspacesOperations
43-
:ivar workspace_features: WorkspaceFeaturesOperations operations
44-
:vartype workspace_features: azure.mgmt.machinelearningservices.operations.WorkspaceFeaturesOperations
45-
:ivar notebooks: NotebooksOperations operations
46-
:vartype notebooks: azure.mgmt.machinelearningservices.operations.NotebooksOperations
30+
:vartype workspaces: azure_machine_learning_workspaces.operations.WorkspacesOperations
4731
:ivar usages: UsagesOperations operations
48-
:vartype usages: azure.mgmt.machinelearningservices.operations.UsagesOperations
32+
:vartype usages: azure_machine_learning_workspaces.operations.UsagesOperations
4933
:ivar virtual_machine_sizes: VirtualMachineSizesOperations operations
50-
:vartype virtual_machine_sizes: azure.mgmt.machinelearningservices.operations.VirtualMachineSizesOperations
34+
:vartype virtual_machine_sizes:
35+
azure_machine_learning_workspaces.operations.VirtualMachineSizesOperations
5136
:ivar quotas: QuotasOperations operations
52-
:vartype quotas: azure.mgmt.machinelearningservices.operations.QuotasOperations
53-
:ivar workspace_connections: WorkspaceConnectionsOperations operations
54-
:vartype workspace_connections: azure.mgmt.machinelearningservices.operations.WorkspaceConnectionsOperations
55-
:ivar machine_learning_compute: MachineLearningComputeOperations operations
56-
:vartype machine_learning_compute: azure.mgmt.machinelearningservices.operations.MachineLearningComputeOperations
37+
:vartype quotas: azure_machine_learning_workspaces.operations.QuotasOperations
38+
:ivar compute: ComputeOperations operations
39+
:vartype compute: azure_machine_learning_workspaces.operations.ComputeOperations
5740
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
58-
:vartype private_endpoint_connections: azure.mgmt.machinelearningservices.operations.PrivateEndpointConnectionsOperations
41+
:vartype private_endpoint_connections:
42+
azure_machine_learning_workspaces.operations.PrivateEndpointConnectionsOperations
5943
:ivar private_link_resources: PrivateLinkResourcesOperations operations
60-
:vartype private_link_resources: azure.mgmt.machinelearningservices.operations.PrivateLinkResourcesOperations
44+
:vartype private_link_resources:
45+
azure_machine_learning_workspaces.operations.PrivateLinkResourcesOperations
46+
:ivar workspace_connections: WorkspaceConnectionsOperations operations
47+
:vartype workspace_connections:
48+
azure_machine_learning_workspaces.operations.WorkspaceConnectionsOperations
49+
:ivar workspace_features: WorkspaceFeaturesOperations operations
50+
:vartype workspace_features:
51+
azure_machine_learning_workspaces.operations.WorkspaceFeaturesOperations
52+
:ivar workspace_skus: WorkspaceSkusOperations operations
53+
:vartype workspace_skus: azure_machine_learning_workspaces.operations.WorkspaceSkusOperations
6154
:param credential: Credential needed for the client to connect to Azure.
6255
:type credential: ~azure.core.credentials.TokenCredential
63-
:param subscription_id: Azure subscription identifier.
56+
:param subscription_id: The ID of the target subscription.
6457
: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.
58+
:param base_url: Service URL. Default value is 'https://management.azure.com'.
59+
:type base_url: str
60+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
61+
Retry-After header is present.
6762
"""
6863

6964
def __init__(
7065
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 = AzureMachineLearningWorkspacesConfiguration(credential, subscription_id, **kwargs)
66+
credential: "TokenCredential",
67+
subscription_id: str,
68+
base_url: str = "https://management.azure.com",
69+
**kwargs: Any
70+
) -> None:
71+
self._config = AzureMachineLearningWorkspacesConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
8072
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
8173

8274
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
8375
self._serialize = Serializer(client_models)
84-
self._serialize.client_side_validation = False
8576
self._deserialize = Deserializer(client_models)
77+
self._serialize.client_side_validation = False
78+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
79+
self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize)
80+
self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize)
81+
self.virtual_machine_sizes = VirtualMachineSizesOperations(self._client, self._config, self._serialize, self._deserialize)
82+
self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize)
83+
self.compute = ComputeOperations(self._client, self._config, self._serialize, self._deserialize)
84+
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
85+
self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize)
86+
self.workspace_connections = WorkspaceConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
87+
self.workspace_features = WorkspaceFeaturesOperations(self._client, self._config, self._serialize, self._deserialize)
88+
self.workspace_skus = WorkspaceSkusOperations(self._client, self._config, self._serialize, self._deserialize)
89+
90+
91+
def _send_request(
92+
self,
93+
request, # type: HttpRequest
94+
**kwargs: Any
95+
) -> HttpResponse:
96+
"""Runs the network request through the client's chained policies.
97+
98+
>>> from azure.core.rest import HttpRequest
99+
>>> request = HttpRequest("GET", "https://www.example.org/")
100+
<HttpRequest [GET], url: 'https://www.example.org/'>
101+
>>> response = client._send_request(request)
102+
<HttpResponse: 200 OK>
103+
104+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
105+
106+
:param request: The network request you want to make. Required.
107+
:type request: ~azure.core.rest.HttpRequest
108+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
109+
:return: The response of your network call. Does not do error handling on your response.
110+
:rtype: ~azure.core.rest.HttpResponse
111+
"""
86112

87-
self.operations = Operations(
88-
self._client, self._config, self._serialize, self._deserialize)
89-
self.workspaces = WorkspacesOperations(
90-
self._client, self._config, self._serialize, self._deserialize)
91-
self.workspace_features = WorkspaceFeaturesOperations(
92-
self._client, self._config, self._serialize, self._deserialize)
93-
self.notebooks = NotebooksOperations(
94-
self._client, self._config, self._serialize, self._deserialize)
95-
self.usages = UsagesOperations(
96-
self._client, self._config, self._serialize, self._deserialize)
97-
self.virtual_machine_sizes = VirtualMachineSizesOperations(
98-
self._client, self._config, self._serialize, self._deserialize)
99-
self.quotas = QuotasOperations(
100-
self._client, self._config, self._serialize, self._deserialize)
101-
self.workspace_connections = WorkspaceConnectionsOperations(
102-
self._client, self._config, self._serialize, self._deserialize)
103-
self.machine_learning_compute = MachineLearningComputeOperations(
104-
self._client, self._config, self._serialize, self._deserialize)
105-
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
106-
self._client, self._config, self._serialize, self._deserialize)
107-
self.private_link_resources = PrivateLinkResourcesOperations(
108-
self._client, self._config, self._serialize, self._deserialize)
113+
request_copy = deepcopy(request)
114+
request_copy.url = self._client.format_url(request_copy.url)
115+
return self._client.send_request(request_copy, **kwargs)
109116

110117
def close(self):
111118
# type: () -> None

sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_configuration.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
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

@@ -29,26 +27,25 @@ class AzureMachineLearningWorkspacesConfiguration(Configuration):
2927
3028
:param credential: Credential needed for the client to connect to Azure.
3129
:type credential: ~azure.core.credentials.TokenCredential
32-
:param subscription_id: Azure subscription identifier.
30+
:param subscription_id: The ID of the target subscription.
3331
:type subscription_id: str
3432
"""
3533

3634
def __init__(
3735
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
36+
credential: "TokenCredential",
37+
subscription_id: str,
38+
**kwargs: Any
39+
) -> None:
40+
super(AzureMachineLearningWorkspacesConfiguration, self).__init__(**kwargs)
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(AzureMachineLearningWorkspacesConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
51-
self.api_version = "2020-08-01"
48+
self.api_version = "2021-07-01"
5249
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
5350
kwargs.setdefault('sdk_moniker', 'mgmt-machinelearningservices/{}'.format(VERSION))
5451
self._configure(**kwargs)
@@ -68,4 +65,4 @@ def _configure(
6865
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6966
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(self.credential, *self.credential_scopes, **kwargs)

0 commit comments

Comments
 (0)