diff options
Diffstat (limited to '.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio')
13 files changed, 4168 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/__init__.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/__init__.py new file mode 100644 index 00000000..f67ccda9 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._azure_machine_learning_workspaces import AzureMachineLearningWorkspaces +__all__ = ['AzureMachineLearningWorkspaces'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/_azure_machine_learning_workspaces.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/_azure_machine_learning_workspaces.py new file mode 100644 index 00000000..597cca3d --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/_azure_machine_learning_workspaces.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from .. import models +from ._configuration import AzureMachineLearningWorkspacesConfiguration +from .operations import DataCallOperations, DataContainerOperations, DataVersionOperations, DatasetControllerV2Operations, DatasetV2Operations, DatasetsV1Operations, DeleteOperations, GetOperationStatusOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class AzureMachineLearningWorkspaces: + """AzureMachineLearningWorkspaces. + + :ivar data_call: DataCallOperations operations + :vartype data_call: azure.mgmt.machinelearningservices.aio.operations.DataCallOperations + :ivar data_container: DataContainerOperations operations + :vartype data_container: + azure.mgmt.machinelearningservices.aio.operations.DataContainerOperations + :ivar delete: DeleteOperations operations + :vartype delete: azure.mgmt.machinelearningservices.aio.operations.DeleteOperations + :ivar datasets_v1: DatasetsV1Operations operations + :vartype datasets_v1: azure.mgmt.machinelearningservices.aio.operations.DatasetsV1Operations + :ivar dataset_controller_v2: DatasetControllerV2Operations operations + :vartype dataset_controller_v2: + azure.mgmt.machinelearningservices.aio.operations.DatasetControllerV2Operations + :ivar dataset_v2: DatasetV2Operations operations + :vartype dataset_v2: azure.mgmt.machinelearningservices.aio.operations.DatasetV2Operations + :ivar data_version: DataVersionOperations operations + :vartype data_version: azure.mgmt.machinelearningservices.aio.operations.DataVersionOperations + :ivar get_operation_status: GetOperationStatusOperations operations + :vartype get_operation_status: + azure.mgmt.machinelearningservices.aio.operations.GetOperationStatusOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param base_url: Service URL. Default value is ''. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + base_url: str = "", + **kwargs: Any + ) -> None: + self._config = AzureMachineLearningWorkspacesConfiguration(credential=credential, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.data_call = DataCallOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_container = DataContainerOperations(self._client, self._config, self._serialize, self._deserialize) + self.delete = DeleteOperations(self._client, self._config, self._serialize, self._deserialize) + self.datasets_v1 = DatasetsV1Operations(self._client, self._config, self._serialize, self._deserialize) + self.dataset_controller_v2 = DatasetControllerV2Operations(self._client, self._config, self._serialize, self._deserialize) + self.dataset_v2 = DatasetV2Operations(self._client, self._config, self._serialize, self._deserialize) + self.data_version = DataVersionOperations(self._client, self._config, self._serialize, self._deserialize) + self.get_operation_status = GetOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + <HttpRequest [GET], url: 'https://www.example.org/'> + >>> response = await client._send_request(request) + <AsyncHttpResponse: 200 OK> + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AzureMachineLearningWorkspaces": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/_configuration.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/_configuration.py new file mode 100644 index 00000000..26def54e --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/_configuration.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AzureMachineLearningWorkspacesConfiguration(Configuration): + """Configuration for AzureMachineLearningWorkspaces. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + super(AzureMachineLearningWorkspacesConfiguration, self).__init__(**kwargs) + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-machinelearningservices/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/_patch.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/_patch.py new file mode 100644 index 00000000..74e48ecd --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass
\ No newline at end of file diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/__init__.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/__init__.py new file mode 100644 index 00000000..f0340813 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._data_call_operations import DataCallOperations +from ._data_container_operations import DataContainerOperations +from ._delete_operations import DeleteOperations +from ._datasets_v1_operations import DatasetsV1Operations +from ._dataset_controller_v2_operations import DatasetControllerV2Operations +from ._dataset_v2_operations import DatasetV2Operations +from ._data_version_operations import DataVersionOperations +from ._get_operation_status_operations import GetOperationStatusOperations + +__all__ = [ + 'DataCallOperations', + 'DataContainerOperations', + 'DeleteOperations', + 'DatasetsV1Operations', + 'DatasetControllerV2Operations', + 'DatasetV2Operations', + 'DataVersionOperations', + 'GetOperationStatusOperations', +] diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_data_call_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_data_call_operations.py new file mode 100644 index 00000000..cf00280c --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_data_call_operations.py @@ -0,0 +1,243 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._data_call_operations import build_get_preview_for_ml_table_request, build_get_quick_profile_for_ml_table_request, build_get_schema_for_ml_table_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataCallOperations: + """DataCallOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_schema_for_ml_table( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + body: Optional["_models.DataCallRequest"] = None, + **kwargs: Any + ) -> List["_models.ColumnDefinition"]: + """Get schema for a specific MLTable. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DataCallRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of ColumnDefinition, or the result of cls(response) + :rtype: list[~azure.mgmt.machinelearningservices.models.ColumnDefinition] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ColumnDefinition"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DataCallRequest') + else: + _json = None + + request = build_get_schema_for_ml_table_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.get_schema_for_ml_table.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[ColumnDefinition]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_schema_for_ml_table.metadata = {'url': '/data/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datacall/schema'} # type: ignore + + + @distributed_trace_async + async def get_preview_for_ml_table( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + body: Optional["_models.DataCallRequest"] = None, + **kwargs: Any + ) -> "_models.DataViewSetResult": + """Get preview for a specific MLTable. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DataCallRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataViewSetResult, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataViewSetResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataViewSetResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DataCallRequest') + else: + _json = None + + request = build_get_preview_for_ml_table_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.get_preview_for_ml_table.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataViewSetResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_preview_for_ml_table.metadata = {'url': '/data/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datacall/preview'} # type: ignore + + + @distributed_trace_async + async def get_quick_profile_for_ml_table( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + body: Optional["_models.DataCallRequest"] = None, + **kwargs: Any + ) -> List["_models.ProfileResult"]: + """Get quick profile for a specific MLTable. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DataCallRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of ProfileResult, or the result of cls(response) + :rtype: list[~azure.mgmt.machinelearningservices.models.ProfileResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ProfileResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DataCallRequest') + else: + _json = None + + request = build_get_quick_profile_for_ml_table_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.get_quick_profile_for_ml_table.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[ProfileResult]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_quick_profile_for_ml_table.metadata = {'url': '/data/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datacall/quickprofile'} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_data_container_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_data_container_operations.py new file mode 100644 index 00000000..c4c78abb --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_data_container_operations.py @@ -0,0 +1,321 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._data_container_operations import build_create_data_container_request, build_get_data_container_request, build_list_data_container_request, build_modify_data_container_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataContainerOperations: + """DataContainerOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create_data_container( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + body: Optional["_models.DataContainer"] = None, + **kwargs: Any + ) -> "_models.DataContainerEntity": + """create_data_container. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DataContainer + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataContainerEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataContainerEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataContainerEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DataContainer') + else: + _json = None + + request = build_create_data_container_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.create_data_container.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataContainerEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_data_container.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datacontainer'} # type: ignore + + + @distributed_trace + def list_data_container( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PaginatedDataContainerEntityList"]: + """list_data_container. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedDataContainerEntityList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedDataContainerEntityList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedDataContainerEntityList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_data_container_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_data_container.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_data_container_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedDataContainerEntityList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_data_container.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datacontainer'} # type: ignore + + @distributed_trace_async + async def get_data_container( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + **kwargs: Any + ) -> "_models.DataContainerEntity": + """get_data_container. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataContainerEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataContainerEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataContainerEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_data_container_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + template_url=self.get_data_container.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataContainerEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_data_container.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datacontainer/{name}'} # type: ignore + + + @distributed_trace_async + async def modify_data_container( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + body: Optional["_models.DataContainerMutable"] = None, + **kwargs: Any + ) -> "_models.DataContainerEntity": + """modify_data_container. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DataContainerMutable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataContainerEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataContainerEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataContainerEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DataContainerMutable') + else: + _json = None + + request = build_modify_data_container_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + content_type=content_type, + json=_json, + template_url=self.modify_data_container.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataContainerEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + modify_data_container.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datacontainer/{name}'} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_data_version_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_data_version_operations.py new file mode 100644 index 00000000..9f375aeb --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_data_version_operations.py @@ -0,0 +1,804 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._data_version_operations import build_batch_get_resolved_uris_request, build_create_request, build_create_unregistered_input_data_request, build_create_unregistered_output_data_request, build_delete_request, build_exists_request, build_get_by_asset_id_request, build_get_request, build_list_request, build_modify_request, build_registered_existing_data_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataVersionOperations: + """DataVersionOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + body: Optional["_models.DataVersion"] = None, + **kwargs: Any + ) -> "_models.DataVersionEntity": + """create. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DataVersion + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataVersionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataVersionEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DataVersion') + else: + _json = None + + request = build_create_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataVersionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/{name}/versions'} # type: ignore + + + @distributed_trace + def list( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + order_by: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PaginatedDataVersionEntityList"]: + """list. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :param order_by: + :type order_by: str + :param top: + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedDataVersionEntityList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedDataVersionEntityList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedDataVersionEntityList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + order_by=order_by, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + order_by=order_by, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedDataVersionEntityList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/{name}/versions'} # type: ignore + + @distributed_trace_async + async def get( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + **kwargs: Any + ) -> "_models.DataVersionEntity": + """get. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :param version: + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataVersionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataVersionEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataVersionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/{name}/versions/{version}'} # type: ignore + + + @distributed_trace_async + async def modify( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Optional["_models.DataVersionMutable"] = None, + **kwargs: Any + ) -> "_models.DataVersionEntity": + """modify. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :param version: + :type version: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DataVersionMutable + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataVersionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataVersionEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DataVersionMutable') + else: + _json = None + + request = build_modify_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + content_type=content_type, + json=_json, + template_url=self.modify.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataVersionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + modify.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/{name}/versions/{version}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + **kwargs: Any + ) -> "_models.HttpResponseMessage": + """delete. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :param version: + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HttpResponseMessage, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.HttpResponseMessage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HttpResponseMessage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HttpResponseMessage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + delete.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/{name}/versions/{version}'} # type: ignore + + + @distributed_trace_async + async def exists( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + **kwargs: Any + ) -> bool: + """exists. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :param version: + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: bool, or the result of cls(response) + :rtype: bool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[bool] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_exists_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + template_url=self.exists.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('bool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + exists.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/{name}/versions/{version}/exists'} # type: ignore + + + @distributed_trace_async + async def get_by_asset_id( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + body: Optional["_models.AssetId"] = None, + **kwargs: Any + ) -> "_models.DataVersionEntity": + """get_by_asset_id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.AssetId + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataVersionEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataVersionEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'AssetId') + else: + _json = None + + request = build_get_by_asset_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.get_by_asset_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataVersionEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_by_asset_id.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/getByAssetId'} # type: ignore + + + @distributed_trace_async + async def create_unregistered_input_data( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + body: Optional["_models.CreateUnregisteredInputData"] = None, + **kwargs: Any + ) -> "_models.DataContainerEntity": + """create_unregistered_input_data. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.CreateUnregisteredInputData + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataContainerEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataContainerEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataContainerEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'CreateUnregisteredInputData') + else: + _json = None + + request = build_create_unregistered_input_data_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.create_unregistered_input_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataContainerEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_unregistered_input_data.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/createUnregisteredInput'} # type: ignore + + + @distributed_trace_async + async def create_unregistered_output_data( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + body: Optional["_models.CreateUnregisteredOutputData"] = None, + **kwargs: Any + ) -> "_models.DataContainerEntity": + """create_unregistered_output_data. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.CreateUnregisteredOutputData + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataContainerEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataContainerEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataContainerEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'CreateUnregisteredOutputData') + else: + _json = None + + request = build_create_unregistered_output_data_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.create_unregistered_output_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataContainerEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_unregistered_output_data.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/createUnregisteredOutput'} # type: ignore + + + @distributed_trace_async + async def registered_existing_data( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + body: Optional["_models.RegisterExistingData"] = None, + **kwargs: Any + ) -> "_models.DataContainerEntity": + """registered_existing_data. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.RegisterExistingData + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataContainerEntity, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DataContainerEntity + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataContainerEntity"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'RegisterExistingData') + else: + _json = None + + request = build_registered_existing_data_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.registered_existing_data.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataContainerEntity', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + registered_existing_data.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/registerExisting'} # type: ignore + + + @distributed_trace_async + async def batch_get_resolved_uris( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + body: Optional["_models.BatchGetResolvedURIs"] = None, + **kwargs: Any + ) -> "_models.BatchDataUriResponse": + """batch_get_resolved_uris. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.BatchGetResolvedURIs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BatchDataUriResponse, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.BatchDataUriResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BatchDataUriResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'BatchGetResolvedURIs') + else: + _json = None + + request = build_batch_get_resolved_uris_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self.batch_get_resolved_uris.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BatchDataUriResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + batch_get_resolved_uris.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/dataversion/batchGetResolvedUris'} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_dataset_controller_v2_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_dataset_controller_v2_operations.py new file mode 100644 index 00000000..a3574be3 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_dataset_controller_v2_operations.py @@ -0,0 +1,845 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dataset_controller_v2_operations import build_delete_all_datasets_request, build_get_all_dataset_definitions_request, build_get_all_dataset_versions_request, build_get_dataset_by_name_request, build_get_dataset_definition_request, build_list_request, build_register_request, build_unregister_dataset_request, build_update_dataset_request, build_update_definition_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DatasetControllerV2Operations: + """DatasetControllerV2Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_dataset_definition( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + version: str, + **kwargs: Any + ) -> "_models.DatasetDefinition": + """Get a specific dataset definition. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param version: + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatasetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_dataset_definition_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + version=version, + template_url=self.get_dataset_definition.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatasetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_dataset_definition.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}/definitions/{version}'} # type: ignore + + + @distributed_trace + def get_all_dataset_definitions( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PaginatedDatasetDefinitionList"]: + """Get all dataset definitions for a given dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :param page_size: + :type page_size: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedDatasetDefinitionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedDatasetDefinitionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedDatasetDefinitionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_all_dataset_definitions_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=self.get_all_dataset_definitions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_all_dataset_definitions_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedDatasetDefinitionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + get_all_dataset_definitions.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}/definitions'} # type: ignore + + @distributed_trace_async + async def update_definition( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + register_as_pending: Optional[bool] = False, + force_update: Optional[bool] = False, + dataset_type: Optional[str] = None, + user_version_id: Optional[str] = None, + body: Optional["_models.DatasetDefinition"] = None, + **kwargs: Any + ) -> "_models.Dataset": + """Update a dataset definition. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param register_as_pending: + :type register_as_pending: bool + :param force_update: + :type force_update: bool + :param dataset_type: + :type dataset_type: str + :param user_version_id: + :type user_version_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DatasetDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Dataset, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DatasetDefinition') + else: + _json = None + + request = build_update_definition_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + content_type=content_type, + json=_json, + register_as_pending=register_as_pending, + force_update=force_update, + dataset_type=dataset_type, + user_version_id=user_version_id, + template_url=self.update_definition.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Dataset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_definition.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}/definitions'} # type: ignore + + + @distributed_trace + def get_all_dataset_versions( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PaginatedStringList"]: + """Get all dataset versions for a given dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :param page_size: + :type page_size: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedStringList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedStringList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedStringList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_all_dataset_versions_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=self.get_all_dataset_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_all_dataset_versions_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedStringList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + get_all_dataset_versions.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}/versions'} # type: ignore + + @distributed_trace_async + async def get_dataset_by_name( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_name: str, + version_id: Optional[str] = None, + include_latest_definition: Optional[bool] = True, + **kwargs: Any + ) -> "_models.Dataset": + """Get a dataset for a given dataset name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_name: + :type dataset_name: str + :param version_id: + :type version_id: str + :param include_latest_definition: + :type include_latest_definition: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Dataset, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_dataset_by_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_name=dataset_name, + version_id=version_id, + include_latest_definition=include_latest_definition, + template_url=self.get_dataset_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Dataset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_dataset_by_name.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/query/name={datasetName}'} # type: ignore + + + @distributed_trace + def list( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_names: Optional[List[str]] = None, + search_text: Optional[str] = None, + include_invisible: Optional[bool] = False, + status: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + include_latest_definition: Optional[bool] = False, + order_by: Optional[str] = None, + order_by_asc: Optional[bool] = False, + dataset_types: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PaginatedDatasetList"]: + """Get a list of datasets. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_names: + :type dataset_names: list[str] + :param search_text: + :type search_text: str + :param include_invisible: + :type include_invisible: bool + :param status: + :type status: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :param page_size: + :type page_size: int + :param include_latest_definition: + :type include_latest_definition: bool + :param order_by: + :type order_by: str + :param order_by_asc: + :type order_by_asc: bool + :param dataset_types: + :type dataset_types: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedDatasetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedDatasetList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedDatasetList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_names=dataset_names, + search_text=search_text, + include_invisible=include_invisible, + status=status, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + include_latest_definition=include_latest_definition, + order_by=order_by, + order_by_asc=order_by_asc, + dataset_types=dataset_types, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_names=dataset_names, + search_text=search_text, + include_invisible=include_invisible, + status=status, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + include_latest_definition=include_latest_definition, + order_by=order_by, + order_by_asc=order_by_asc, + dataset_types=dataset_types, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedDatasetList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets'} # type: ignore + + @distributed_trace_async + async def register( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + register_as_pending: Optional[bool] = False, + if_exists_ok: Optional[bool] = True, + update_definition_if_exists: Optional[bool] = False, + with_data_hash: Optional[bool] = False, + user_version_id: Optional[str] = None, + body: Optional["_models.Dataset"] = None, + **kwargs: Any + ) -> "_models.Dataset": + """Register new dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param register_as_pending: + :type register_as_pending: bool + :param if_exists_ok: + :type if_exists_ok: bool + :param update_definition_if_exists: + :type update_definition_if_exists: bool + :param with_data_hash: + :type with_data_hash: bool + :param user_version_id: + :type user_version_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.Dataset + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Dataset, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'Dataset') + else: + _json = None + + request = build_register_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + register_as_pending=register_as_pending, + if_exists_ok=if_exists_ok, + update_definition_if_exists=update_definition_if_exists, + with_data_hash=with_data_hash, + user_version_id=user_version_id, + template_url=self.register.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Dataset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + register.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets'} # type: ignore + + + @distributed_trace_async + async def delete_all_datasets( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: + """Unregister all datasets in the workspace. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_all_datasets_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.delete_all_datasets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_all_datasets.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets'} # type: ignore + + + @distributed_trace_async + async def update_dataset( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + force_update: Optional[bool] = False, + body: Optional["_models.Dataset"] = None, + **kwargs: Any + ) -> "_models.Dataset": + """Update a dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param force_update: + :type force_update: bool + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.Dataset + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Dataset, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'Dataset') + else: + _json = None + + request = build_update_dataset_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + content_type=content_type, + json=_json, + force_update=force_update, + template_url=self.update_dataset.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Dataset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_dataset.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}'} # type: ignore + + + @distributed_trace_async + async def unregister_dataset( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + **kwargs: Any + ) -> None: + """Unregister a dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_unregister_dataset_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + template_url=self.unregister_dataset.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + unregister_dataset.metadata = {'url': '/dataset/v1.2/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{name}'} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_dataset_v2_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_dataset_v2_operations.py new file mode 100644 index 00000000..584122c1 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_dataset_v2_operations.py @@ -0,0 +1,592 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dataset_v2_operations import build_create_request, build_delete_all_datasets_request, build_delete_dataset_by_name_request, build_get_dataset_by_id_request, build_get_dataset_by_name_request, build_list_request, build_update_dataset_by_name_and_version_request, build_update_dataset_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DatasetV2Operations: + """DatasetV2Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def create( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + if_exists_update: Optional[bool] = False, + body: Optional["_models.DatasetV2"] = None, + **kwargs: Any + ) -> "_models.DatasetV2": + """Create new dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param if_exists_update: + :type if_exists_update: bool + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DatasetV2 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetV2, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatasetV2 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetV2"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DatasetV2') + else: + _json = None + + request = build_create_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + if_exists_update=if_exists_update, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatasetV2', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/dataset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets'} # type: ignore + + + @distributed_trace_async + async def delete_all_datasets( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: + """Delete all datasets in the workspace. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_all_datasets_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.delete_all_datasets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_all_datasets.metadata = {'url': '/dataset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets'} # type: ignore + + + @distributed_trace + def list( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + names: Optional[List[str]] = None, + search_text: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PaginatedDatasetV2List"]: + """Get a list of datasets. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param names: + :type names: list[str] + :param search_text: + :type search_text: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :param page_size: + :type page_size: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedDatasetV2List or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedDatasetV2List] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedDatasetV2List"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + names=names, + search_text=search_text, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + names=names, + search_text=search_text, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedDatasetV2List", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/dataset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets'} # type: ignore + + @distributed_trace_async + async def delete_dataset_by_name( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + version_id: str, + **kwargs: Any + ) -> None: + """Delete a dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :param version_id: + :type version_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_dataset_by_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version_id=version_id, + template_url=self.delete_dataset_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_dataset_by_name.metadata = {'url': '/dataset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{name}/versions/{versionId}'} # type: ignore + + + @distributed_trace_async + async def update_dataset_by_name_and_version( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + version_id: str, + body: Optional["_models.DatasetV2"] = None, + **kwargs: Any + ) -> "_models.DatasetV2": + """Update a dataset by its name and version. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :param version_id: + :type version_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DatasetV2 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetV2, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatasetV2 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetV2"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DatasetV2') + else: + _json = None + + request = build_update_dataset_by_name_and_version_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version_id=version_id, + content_type=content_type, + json=_json, + template_url=self.update_dataset_by_name_and_version.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatasetV2', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_dataset_by_name_and_version.metadata = {'url': '/dataset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{name}/versions/{versionId}'} # type: ignore + + + @distributed_trace_async + async def get_dataset_by_id( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + **kwargs: Any + ) -> "_models.DatasetV2": + """Get a dataset for a given dataset id. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetV2, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatasetV2 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetV2"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_dataset_by_id_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + template_url=self.get_dataset_by_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatasetV2', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_dataset_by_id.metadata = {'url': '/dataset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}'} # type: ignore + + + @distributed_trace_async + async def update_dataset( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + body: Optional["_models.DatasetV2"] = None, + **kwargs: Any + ) -> "_models.DatasetV2": + """Update a dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DatasetV2 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetV2, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatasetV2 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetV2"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DatasetV2') + else: + _json = None + + request = build_update_dataset_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + content_type=content_type, + json=_json, + template_url=self.update_dataset.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatasetV2', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_dataset.metadata = {'url': '/dataset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}'} # type: ignore + + + @distributed_trace_async + async def get_dataset_by_name( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_name: str, + version_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.DatasetV2": + """Get a dataset for a given dataset name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_name: + :type dataset_name: str + :param version_id: + :type version_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetV2, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatasetV2 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetV2"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_dataset_by_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_name=dataset_name, + version_id=version_id, + template_url=self.get_dataset_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatasetV2', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_dataset_by_name.metadata = {'url': '/dataset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/query/name={datasetName}'} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_datasets_v1_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_datasets_v1_operations.py new file mode 100644 index 00000000..97e74d53 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_datasets_v1_operations.py @@ -0,0 +1,845 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._datasets_v1_operations import build_delete_all_datasets_request, build_get_all_dataset_definitions_request, build_get_all_dataset_versions_request, build_get_dataset_by_name_request, build_get_dataset_definition_request, build_list_request, build_register_request, build_unregister_dataset_request, build_update_dataset_request, build_update_definition_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DatasetsV1Operations: + """DatasetsV1Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_dataset_definition( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + version: str, + **kwargs: Any + ) -> "_models.DatasetDefinition": + """Get a specific dataset definition. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param version: + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatasetDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_dataset_definition_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + version=version, + template_url=self.get_dataset_definition.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatasetDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_dataset_definition.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}/definitions/{version}'} # type: ignore + + + @distributed_trace + def get_all_dataset_definitions( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PaginatedDatasetDefinitionList"]: + """Get all dataset definitions for a given dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :param page_size: + :type page_size: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedDatasetDefinitionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedDatasetDefinitionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedDatasetDefinitionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_all_dataset_definitions_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=self.get_all_dataset_definitions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_all_dataset_definitions_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedDatasetDefinitionList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + get_all_dataset_definitions.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}/definitions'} # type: ignore + + @distributed_trace_async + async def update_definition( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + register_as_pending: Optional[bool] = False, + force_update: Optional[bool] = False, + dataset_type: Optional[str] = None, + user_version_id: Optional[str] = None, + body: Optional["_models.DatasetDefinition"] = None, + **kwargs: Any + ) -> "_models.Dataset": + """Update a dataset definition. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param register_as_pending: + :type register_as_pending: bool + :param force_update: + :type force_update: bool + :param dataset_type: + :type dataset_type: str + :param user_version_id: + :type user_version_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.DatasetDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Dataset, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'DatasetDefinition') + else: + _json = None + + request = build_update_definition_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + content_type=content_type, + json=_json, + register_as_pending=register_as_pending, + force_update=force_update, + dataset_type=dataset_type, + user_version_id=user_version_id, + template_url=self.update_definition.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Dataset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_definition.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}/definitions'} # type: ignore + + + @distributed_trace + def get_all_dataset_versions( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PaginatedStringList"]: + """Get all dataset versions for a given dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :param page_size: + :type page_size: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedStringList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedStringList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedStringList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_get_all_dataset_versions_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=self.get_all_dataset_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_get_all_dataset_versions_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedStringList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + get_all_dataset_versions.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}/versions'} # type: ignore + + @distributed_trace_async + async def get_dataset_by_name( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_name: str, + version_id: Optional[str] = None, + include_latest_definition: Optional[bool] = True, + **kwargs: Any + ) -> "_models.Dataset": + """Get a dataset for a given dataset name. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_name: + :type dataset_name: str + :param version_id: + :type version_id: str + :param include_latest_definition: + :type include_latest_definition: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Dataset, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_dataset_by_name_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_name=dataset_name, + version_id=version_id, + include_latest_definition=include_latest_definition, + template_url=self.get_dataset_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Dataset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_dataset_by_name.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/query/name={datasetName}'} # type: ignore + + + @distributed_trace + def list( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_names: Optional[List[str]] = None, + search_text: Optional[str] = None, + include_invisible: Optional[bool] = False, + status: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + page_size: Optional[int] = None, + include_latest_definition: Optional[bool] = False, + order_by: Optional[str] = None, + order_by_asc: Optional[bool] = False, + dataset_types: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PaginatedDatasetList"]: + """Get a list of datasets. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_names: + :type dataset_names: list[str] + :param search_text: + :type search_text: str + :param include_invisible: + :type include_invisible: bool + :param status: + :type status: str + :param continuation_token_parameter: + :type continuation_token_parameter: str + :param page_size: + :type page_size: int + :param include_latest_definition: + :type include_latest_definition: bool + :param order_by: + :type order_by: str + :param order_by_asc: + :type order_by_asc: bool + :param dataset_types: + :type dataset_types: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PaginatedDatasetList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PaginatedDatasetList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PaginatedDatasetList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_names=dataset_names, + search_text=search_text, + include_invisible=include_invisible, + status=status, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + include_latest_definition=include_latest_definition, + order_by=order_by, + order_by_asc=order_by_asc, + dataset_types=dataset_types, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_names=dataset_names, + search_text=search_text, + include_invisible=include_invisible, + status=status, + continuation_token_parameter=continuation_token_parameter, + page_size=page_size, + include_latest_definition=include_latest_definition, + order_by=order_by, + order_by_asc=order_by_asc, + dataset_types=dataset_types, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PaginatedDatasetList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets'} # type: ignore + + @distributed_trace_async + async def register( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + register_as_pending: Optional[bool] = False, + if_exists_ok: Optional[bool] = True, + update_definition_if_exists: Optional[bool] = False, + with_data_hash: Optional[bool] = False, + user_version_id: Optional[str] = None, + body: Optional["_models.Dataset"] = None, + **kwargs: Any + ) -> "_models.Dataset": + """Register new dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param register_as_pending: + :type register_as_pending: bool + :param if_exists_ok: + :type if_exists_ok: bool + :param update_definition_if_exists: + :type update_definition_if_exists: bool + :param with_data_hash: + :type with_data_hash: bool + :param user_version_id: + :type user_version_id: str + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.Dataset + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Dataset, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'Dataset') + else: + _json = None + + request = build_register_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + register_as_pending=register_as_pending, + if_exists_ok=if_exists_ok, + update_definition_if_exists=update_definition_if_exists, + with_data_hash=with_data_hash, + user_version_id=user_version_id, + template_url=self.register.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Dataset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + register.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets'} # type: ignore + + + @distributed_trace_async + async def delete_all_datasets( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: + """Unregister all datasets in the workspace. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_all_datasets_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.delete_all_datasets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_all_datasets.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets'} # type: ignore + + + @distributed_trace_async + async def update_dataset( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + dataset_id: str, + force_update: Optional[bool] = False, + body: Optional["_models.Dataset"] = None, + **kwargs: Any + ) -> "_models.Dataset": + """Update a dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param dataset_id: + :type dataset_id: str + :param force_update: + :type force_update: bool + :param body: + :type body: ~azure.mgmt.machinelearningservices.models.Dataset + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Dataset, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'Dataset') + else: + _json = None + + request = build_update_dataset_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dataset_id=dataset_id, + content_type=content_type, + json=_json, + force_update=force_update, + template_url=self.update_dataset.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Dataset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_dataset.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{datasetId}'} # type: ignore + + + @distributed_trace_async + async def unregister_dataset( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + **kwargs: Any + ) -> None: + """Unregister a dataset. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_unregister_dataset_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + template_url=self.unregister_dataset.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in []: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + unregister_dataset.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datasets/{name}'} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_delete_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_delete_operations.py new file mode 100644 index 00000000..9bb293a5 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_delete_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._delete_operations import build_data_container_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeleteOperations: + """DeleteOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def data_container( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + **kwargs: Any + ) -> "_models.HttpResponseMessage": + """data_container. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HttpResponseMessage, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.HttpResponseMessage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HttpResponseMessage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_data_container_request( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + template_url=self.data_container.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('HttpResponseMessage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + data_container.metadata = {'url': '/data/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datacontainer/{name}'} # type: ignore + diff --git a/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_get_operation_status_operations.py b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_get_operation_status_operations.py new file mode 100644 index 00000000..273b307f --- /dev/null +++ b/.venv/lib/python3.12/site-packages/azure/ai/ml/_restclient/dataset_dataplane/aio/operations/_get_operation_status_operations.py @@ -0,0 +1,170 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._get_operation_status_operations import build_get_dataset_operation_status_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GetOperationStatusOperations: + """GetOperationStatusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.machinelearningservices.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _get_dataset_operation_status_initial( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResponse1LongRunningOperationResponseObject"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResponse1LongRunningOperationResponseObject"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_dataset_operation_status_request_initial( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + operation_id=operation_id, + template_url=self._get_dataset_operation_status_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('LongRunningOperationResponse1LongRunningOperationResponseObject', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _get_dataset_operation_status_initial.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/operations/{operationId}'} # type: ignore + + + @distributed_trace_async + async def begin_get_dataset_operation_status( + self, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + operation_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResponse1LongRunningOperationResponseObject"]: + """get_dataset_operation_status. + + :param subscription_id: The Azure Subscription ID. + :type subscription_id: str + :param resource_group_name: The Name of the resource group in which the workspace is located. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + LongRunningOperationResponse1LongRunningOperationResponseObject or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.LongRunningOperationResponse1LongRunningOperationResponseObject] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResponse1LongRunningOperationResponseObject"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._get_dataset_operation_status_initial( + subscription_id=subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + operation_id=operation_id, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('LongRunningOperationResponse1LongRunningOperationResponseObject', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_get_dataset_operation_status.metadata = {'url': '/dataset/v1.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/operations/{operationId}'} # type: ignore |