|
6 | 6 | # Changes may cause incorrect behavior and will be lost if the code is regenerated. |
7 | 7 | # -------------------------------------------------------------------------- |
8 | 8 |
|
9 | | -from typing import TYPE_CHECKING |
| 9 | +from copy import deepcopy |
| 10 | +from typing import Any, Optional, TYPE_CHECKING |
10 | 11 |
|
| 12 | +from azure.core.rest import HttpRequest, HttpResponse |
11 | 13 | from azure.mgmt.core import ARMPipelineClient |
12 | 14 | from msrest import Deserializer, Serializer |
13 | 15 |
|
| 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 | + |
14 | 20 | if TYPE_CHECKING: |
15 | 21 | # pylint: disable=unused-import,ungrouped-imports |
16 | | - from typing import Any, Optional |
17 | | - |
18 | 22 | from azure.core.credentials import TokenCredential |
19 | 23 |
|
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: |
37 | 25 | """These APIs allow end users to operate on Azure Machine Learning Workspace resources. |
38 | 26 |
|
39 | 27 | :ivar operations: Operations operations |
40 | | - :vartype operations: azure.mgmt.machinelearningservices.operations.Operations |
| 28 | + :vartype operations: azure_machine_learning_workspaces.operations.Operations |
41 | 29 | :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 |
47 | 31 | :ivar usages: UsagesOperations operations |
48 | | - :vartype usages: azure.mgmt.machinelearningservices.operations.UsagesOperations |
| 32 | + :vartype usages: azure_machine_learning_workspaces.operations.UsagesOperations |
49 | 33 | :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 |
51 | 36 | :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 |
57 | 40 | :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 |
59 | 43 | :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 |
61 | 54 | :param credential: Credential needed for the client to connect to Azure. |
62 | 55 | :type credential: ~azure.core.credentials.TokenCredential |
63 | | - :param subscription_id: Azure subscription identifier. |
| 56 | + :param subscription_id: The ID of the target subscription. |
64 | 57 | :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. |
67 | 62 | """ |
68 | 63 |
|
69 | 64 | def __init__( |
70 | 65 | 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) |
80 | 72 | self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
81 | 73 |
|
82 | 74 | client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
83 | 75 | self._serialize = Serializer(client_models) |
84 | | - self._serialize.client_side_validation = False |
85 | 76 | 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 | + """ |
86 | 112 |
|
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) |
109 | 116 |
|
110 | 117 | def close(self): |
111 | 118 | # type: () -> None |
|
0 commit comments