|
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, TYPE_CHECKING |
10 | 11 |
|
11 |
| -from azure.mgmt.core import ARMPipelineClient |
12 | 12 | from msrest import Deserializer, Serializer
|
13 | 13 |
|
14 |
| -if TYPE_CHECKING: |
15 |
| - # pylint: disable=unused-import,ungrouped-imports |
16 |
| - from typing import Any, Optional |
17 |
| - |
18 |
| - from azure.core.credentials import TokenCredential |
| 14 | +from azure.core.rest import HttpRequest, HttpResponse |
| 15 | +from azure.mgmt.core import ARMPipelineClient |
19 | 16 |
|
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 | 17 | from . import models
|
| 18 | +from ._configuration import AzureMachineLearningWorkspacesConfiguration |
| 19 | +from .operations import ComputeOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, WorkspaceFeaturesOperations, WorkspaceSkusOperations, WorkspacesOperations |
34 | 20 |
|
| 21 | +if TYPE_CHECKING: |
| 22 | + # pylint: disable=unused-import,ungrouped-imports |
| 23 | + from azure.core.credentials import TokenCredential |
35 | 24 |
|
36 |
| -class AzureMachineLearningWorkspaces(AzureMachineLearningWorkspacesOperationsMixin): |
| 25 | +class AzureMachineLearningWorkspaces: # pylint: disable=too-many-instance-attributes |
37 | 26 | """These APIs allow end users to operate on Azure Machine Learning Workspace resources.
|
38 | 27 |
|
39 | 28 | :ivar operations: Operations operations
|
40 | 29 | :vartype operations: azure.mgmt.machinelearningservices.operations.Operations
|
41 | 30 | :ivar workspaces: WorkspacesOperations operations
|
42 | 31 | :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 |
47 | 32 | :ivar usages: UsagesOperations operations
|
48 | 33 | :vartype usages: azure.mgmt.machinelearningservices.operations.UsagesOperations
|
49 | 34 | :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations
|
50 |
| - :vartype virtual_machine_sizes: azure.mgmt.machinelearningservices.operations.VirtualMachineSizesOperations |
| 35 | + :vartype virtual_machine_sizes: |
| 36 | + azure.mgmt.machinelearningservices.operations.VirtualMachineSizesOperations |
51 | 37 | :ivar quotas: QuotasOperations operations
|
52 | 38 | :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 |
| 39 | + :ivar compute: ComputeOperations operations |
| 40 | + :vartype compute: azure.mgmt.machinelearningservices.operations.ComputeOperations |
57 | 41 | :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
|
58 |
| - :vartype private_endpoint_connections: azure.mgmt.machinelearningservices.operations.PrivateEndpointConnectionsOperations |
| 42 | + :vartype private_endpoint_connections: |
| 43 | + azure.mgmt.machinelearningservices.operations.PrivateEndpointConnectionsOperations |
59 | 44 | :ivar private_link_resources: PrivateLinkResourcesOperations operations
|
60 |
| - :vartype private_link_resources: azure.mgmt.machinelearningservices.operations.PrivateLinkResourcesOperations |
| 45 | + :vartype private_link_resources: |
| 46 | + azure.mgmt.machinelearningservices.operations.PrivateLinkResourcesOperations |
| 47 | + :ivar workspace_connections: WorkspaceConnectionsOperations operations |
| 48 | + :vartype workspace_connections: |
| 49 | + azure.mgmt.machinelearningservices.operations.WorkspaceConnectionsOperations |
| 50 | + :ivar workspace_features: WorkspaceFeaturesOperations operations |
| 51 | + :vartype workspace_features: |
| 52 | + azure.mgmt.machinelearningservices.operations.WorkspaceFeaturesOperations |
| 53 | + :ivar workspace_skus: WorkspaceSkusOperations operations |
| 54 | + :vartype workspace_skus: azure.mgmt.machinelearningservices.operations.WorkspaceSkusOperations |
61 | 55 | :param credential: Credential needed for the client to connect to Azure.
|
62 | 56 | :type credential: ~azure.core.credentials.TokenCredential
|
63 |
| - :param subscription_id: Azure subscription identifier. |
| 57 | + :param subscription_id: The ID of the target subscription. |
64 | 58 | :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. |
| 59 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 60 | + :type base_url: str |
| 61 | + :keyword api_version: Api Version. Default value is "2021-07-01". Note that overriding this |
| 62 | + default value may result in unsupported behavior. |
| 63 | + :paramtype api_version: str |
| 64 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 65 | + Retry-After header is present. |
67 | 66 | """
|
68 | 67 |
|
69 | 68 | def __init__(
|
70 | 69 | 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) |
| 70 | + credential: "TokenCredential", |
| 71 | + subscription_id: str, |
| 72 | + base_url: str = "https://management.azure.com", |
| 73 | + **kwargs: Any |
| 74 | + ) -> None: |
| 75 | + self._config = AzureMachineLearningWorkspacesConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) |
80 | 76 | self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
|
81 | 77 |
|
82 | 78 | client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
|
83 | 79 | self._serialize = Serializer(client_models)
|
84 |
| - self._serialize.client_side_validation = False |
85 | 80 | self._deserialize = Deserializer(client_models)
|
| 81 | + self._serialize.client_side_validation = False |
| 82 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) |
| 83 | + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 84 | + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 85 | + self.virtual_machine_sizes = VirtualMachineSizesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 86 | + self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize) |
| 87 | + self.compute = ComputeOperations(self._client, self._config, self._serialize, self._deserialize) |
| 88 | + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 89 | + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 90 | + self.workspace_connections = WorkspaceConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 91 | + self.workspace_features = WorkspaceFeaturesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 92 | + self.workspace_skus = WorkspaceSkusOperations(self._client, self._config, self._serialize, self._deserialize) |
| 93 | + |
| 94 | + |
| 95 | + def _send_request( |
| 96 | + self, |
| 97 | + request: HttpRequest, |
| 98 | + **kwargs: Any |
| 99 | + ) -> HttpResponse: |
| 100 | + """Runs the network request through the client's chained policies. |
| 101 | +
|
| 102 | + >>> from azure.core.rest import HttpRequest |
| 103 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 104 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 105 | + >>> response = client._send_request(request) |
| 106 | + <HttpResponse: 200 OK> |
| 107 | +
|
| 108 | + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart |
| 109 | +
|
| 110 | + :param request: The network request you want to make. Required. |
| 111 | + :type request: ~azure.core.rest.HttpRequest |
| 112 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 113 | + :return: The response of your network call. Does not do error handling on your response. |
| 114 | + :rtype: ~azure.core.rest.HttpResponse |
| 115 | + """ |
86 | 116 |
|
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) |
| 117 | + request_copy = deepcopy(request) |
| 118 | + request_copy.url = self._client.format_url(request_copy.url) |
| 119 | + return self._client.send_request(request_copy, **kwargs) |
109 | 120 |
|
110 | 121 | def close(self):
|
111 | 122 | # type: () -> None
|
|
0 commit comments