diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/__init__.py new file mode 100644 index 000000000000..da46614477a9 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/__init__.py @@ -0,0 +1,18 @@ +# 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 +from ._version import VERSION + +__version__ = VERSION +__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/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_azure_machine_learning_workspaces.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_azure_machine_learning_workspaces.py new file mode 100644 index 000000000000..d23563bb6cec --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_azure_machine_learning_workspaces.py @@ -0,0 +1,98 @@ +# 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 TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import AzureMachineLearningWorkspacesConfiguration +from .operations import DeploymentTemplatesOperations, IndexesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + from azure.core.rest import HttpRequest, HttpResponse + +class AzureMachineLearningWorkspaces(object): + """AzureMachineLearningWorkspaces. + + :ivar deployment_templates: DeploymentTemplatesOperations operations + :vartype deployment_templates: + azure.mgmt.machinelearningservices.operations.DeploymentTemplatesOperations + :ivar indexes: IndexesOperations operations + :vartype indexes: azure.mgmt.machinelearningservices.operations.IndexesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :keyword api_version: Api Version. The default value is "2024-04-01-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + **kwargs # type: Any + ): + # type: (...) -> None + _base_url = '{endpoint}/genericasset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices' + self._config = AzureMachineLearningWorkspacesConfiguration(credential=credential, **kwargs) + self._client = ARMPipelineClient(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.deployment_templates = DeploymentTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.indexes = IndexesOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + 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.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AzureMachineLearningWorkspaces + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_configuration.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_configuration.py new file mode 100644 index 000000000000..8fa69b940a93 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_configuration.py @@ -0,0 +1,70 @@ +# 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 TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class AzureMachineLearningWorkspacesConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """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.TokenCredential + :keyword api_version: Api Version. The default value is "2024-04-01-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + **kwargs # type: Any + ): + # type: (...) -> None + super(AzureMachineLearningWorkspacesConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + self.api_version = api_version + 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 # type: Any + ): + # type: (...) -> 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.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_patch.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_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/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_vendor.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_version.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_version.py new file mode 100644 index 000000000000..eae7c95b6fbd --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/__init__.py new file mode 100644 index 000000000000..f67ccda966f1 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/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/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/_azure_machine_learning_workspaces.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/_azure_machine_learning_workspaces.py new file mode 100644 index 000000000000..6c461af5d5c1 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/_azure_machine_learning_workspaces.py @@ -0,0 +1,91 @@ +# 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, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import AzureMachineLearningWorkspacesConfiguration +from .operations import DeploymentTemplatesOperations, IndexesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class AzureMachineLearningWorkspaces: + """AzureMachineLearningWorkspaces. + + :ivar deployment_templates: DeploymentTemplatesOperations operations + :vartype deployment_templates: + azure.mgmt.machinelearningservices.aio.operations.DeploymentTemplatesOperations + :ivar indexes: IndexesOperations operations + :vartype indexes: azure.mgmt.machinelearningservices.aio.operations.IndexesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :keyword api_version: Api Version. The default value is "2024-04-01-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + _base_url = '{endpoint}/genericasset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices' + 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.deployment_templates = DeploymentTemplatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.indexes = IndexesOperations(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/") + + >>> response = await client._send_request(request) + + + 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/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/_configuration.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/_configuration.py new file mode 100644 index 000000000000..5d736a5ab04b --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/_configuration.py @@ -0,0 +1,66 @@ +# 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): # pylint: disable=too-many-instance-attributes + """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 + :keyword api_version: Api Version. The default value is "2024-04-01-preview". Note that + overriding this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + **kwargs: Any + ) -> None: + super(AzureMachineLearningWorkspacesConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + self.api_version = api_version + 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/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/_patch.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/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/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/operations/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/operations/__init__.py new file mode 100644 index 000000000000..f5baa9e7ddee --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/operations/__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 ._deployment_templates_operations import DeploymentTemplatesOperations +from ._indexes_operations import IndexesOperations + +__all__ = [ + 'DeploymentTemplatesOperations', + 'IndexesOperations', +] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/operations/_deployment_templates_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/operations/_deployment_templates_operations.py new file mode 100644 index 000000000000..e5e8da0764f8 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/operations/_deployment_templates_operations.py @@ -0,0 +1,415 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar + +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._deployment_templates_operations import build_create_request, build_delete_deployment_template_request, build_get_request, build_list_deployment_templates_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentTemplatesOperations: + """DeploymentTemplatesOperations 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( # pylint: disable=inconsistent-return-statements + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + registry_name: str, + name: str, + version: str, + body: "_models.DeploymentTemplate", + **kwargs: Any + ) -> None: + """Creates a deployment template version. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param registry_name: The name of the AzureML registry. + :type registry_name: str + :param name: Name of the deployment template. + :type name: str + :param version: Version of the deployment template. + :type version: str + :param body: Properties of a Deployment Template Version. + :type body: ~azure.mgmt.machinelearningservices.models.DeploymentTemplate + :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', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'DeploymentTemplate') + + request = build_create_request( + registry_name=registry_name, + name=name, + version=version, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + create.metadata = {'url': "/registries/{registryName}/{name}/versions/{version}"} # type: ignore + + + @distributed_trace + def list_deployment_templates( + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + registry_name: str, + name: Optional[str] = None, + tags: Optional[str] = None, + continuation_token_parameter: Optional[str] = None, + continuation_token_from_header: Optional[str] = None, + count: Optional[int] = None, + stage: Optional[str] = None, + list_view_type: Optional[str] = "ActiveOnly", + **kwargs: Any + ) -> AsyncIterable["_models.PagedDeploymentTemplate"]: + """List deployment templates. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param registry_name: The name of the AzureML registry. + :type registry_name: str + :param name: Filter by deployment template name. + :type name: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. + :type tags: str + :param continuation_token_parameter: Continuation token for pagination. + :type continuation_token_parameter: str + :param continuation_token_from_header: Continuation token for pagination (from header). + :type continuation_token_from_header: str + :param count: Maximum number of items to return. + :type count: int + :param stage: Filter by deployment template stage. + :type stage: str + :param list_view_type: View type for including/excluding (for example) archived entities. + :type list_view_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedDeploymentTemplate or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PagedDeploymentTemplate] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedDeploymentTemplate"] + 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_deployment_templates_request( + registry_name=registry_name, + api_version=api_version, + name=name, + tags=tags, + continuation_token_parameter=continuation_token_parameter, + continuation_token_from_header=continuation_token_from_header, + count=count, + stage=stage, + list_view_type=list_view_type, + template_url=self.list_deployment_templates.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_deployment_templates_request( + registry_name=registry_name, + api_version=api_version, + name=name, + tags=tags, + continuation_token_parameter=continuation_token_parameter, + continuation_token_from_header=continuation_token_from_header, + count=count, + stage=stage, + list_view_type=list_view_type, + template_url=next_link, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PagedDeploymentTemplate", 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( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_deployment_templates.metadata = {'url': "/registries/{registryName}/deploymenttemplates"} # type: ignore + + @distributed_trace_async + async def get( + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + registry_name: str, + name: str, + version: str, + asset_resource_tenant_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.DeploymentTemplate": + """Get a specific version of a deployment template. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param registry_name: The name of the AzureML registry. + :type registry_name: str + :param name: Name of the deployment template. + :type name: str + :param version: Version of the deployment template. + :type version: str + :param asset_resource_tenant_id: Asset resource tenant ID. + :type asset_resource_tenant_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentTemplate, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeploymentTemplate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentTemplate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_get_request( + registry_name=registry_name, + name=name, + version=version, + api_version=api_version, + asset_resource_tenant_id=asset_resource_tenant_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentTemplate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/registries/{registryName}/deploymenttemplates/{name}/versions/{version}"} # type: ignore + + + @distributed_trace_async + async def delete_deployment_template( # pylint: disable=inconsistent-return-statements + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + registry_name: str, + name: str, + version: str, + **kwargs: Any + ) -> None: + """Delete a specific version of a deployment template. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param registry_name: The name of the AzureML registry. + :type registry_name: str + :param name: Name of the deployment template. + :type name: str + :param version: Version of the deployment template. + :type version: 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', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_delete_deployment_template_request( + registry_name=registry_name, + name=name, + version=version, + api_version=api_version, + template_url=self.delete_deployment_template.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_deployment_template.metadata = {'url': "/registries/{registryName}/deploymenttemplates/{name}/versions/{version}"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/operations/_indexes_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/operations/_indexes_operations.py new file mode 100644 index 000000000000..b7d651235d82 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/aio/operations/_indexes_operations.py @@ -0,0 +1,610 @@ +# pylint: disable=too-many-lines +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar + +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._indexes_operations import build_create_or_update_request, build_get_latest_request, build_get_next_version_request, build_get_request, build_list_latest_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IndexesOperations: + """IndexesOperations 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 + def list_latest( + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + top: Optional[int] = None, + skip: Optional[int] = 0, + maxpagesize: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PagedIndex"]: + """List the latest version of each index. Latest is defined by most recent created by date. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param top: The number of result items to return. + :type top: int + :param skip: The number of result items to skip. + :type skip: int + :param maxpagesize: The maximum number of result items per page. + :type maxpagesize: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedIndex or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PagedIndex] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedIndex"] + 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_latest_request( + workspace_name=workspace_name, + api_version=api_version, + top=top, + skip=skip, + maxpagesize=maxpagesize, + template_url=self.list_latest.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_latest_request( + workspace_name=workspace_name, + api_version=api_version, + top=top, + skip=skip, + maxpagesize=maxpagesize, + template_url=next_link, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PagedIndex", 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( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_latest.metadata = {'url': "/workspaces/{workspaceName}/indexes"} # type: ignore + + @distributed_trace_async + async def get_latest( + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + **kwargs: Any + ) -> "_models.Index": + """Get latest version of the Index. Latest is defined by most recent created by date. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Index, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Index + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Index"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_get_latest_request( + workspace_name=workspace_name, + name=name, + api_version=api_version, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Index', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_latest.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}"} # type: ignore + + + @distributed_trace_async + async def get_next_version( + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + **kwargs: Any + ) -> "_models.VersionInfo": + """Get next Index version as defined by the server. The server keeps track of all versions that + are string-representations of integers. If one exists, the nextVersion will be a string + representation of the highest integer value + 1. Otherwise, the nextVersion will default to + '1'. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VersionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.VersionInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VersionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_get_next_version_request( + workspace_name=workspace_name, + name=name, + api_version=api_version, + template_url=self.get_next_version.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VersionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_next_version.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}:getNextVersion"} # type: ignore + + + @distributed_trace + def list( + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + list_view_type: str = "ActiveOnly", + order_by: Optional[str] = None, + tags: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[int] = 0, + maxpagesize: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.PagedIndex"]: + """List the versions of an Index given the name. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :param list_view_type: View type for including/excluding (for example) archived entities. + :type list_view_type: str + :param order_by: Ordering of list: Please choose orderby value from ['createdAt', + 'lastModifiedAt']. + :type order_by: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. + :type tags: str + :param top: The number of result items to return. + :type top: int + :param skip: The number of result items to skip. + :type skip: int + :param maxpagesize: The maximum number of result items per page. + :type maxpagesize: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedIndex or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PagedIndex] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedIndex"] + 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( + workspace_name=workspace_name, + name=name, + api_version=api_version, + list_view_type=list_view_type, + order_by=order_by, + tags=tags, + top=top, + skip=skip, + maxpagesize=maxpagesize, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_request( + workspace_name=workspace_name, + name=name, + api_version=api_version, + list_view_type=list_view_type, + order_by=order_by, + tags=tags, + top=top, + skip=skip, + maxpagesize=maxpagesize, + template_url=next_link, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PagedIndex", 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( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}/versions"} # type: ignore + + @distributed_trace_async + async def get( + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + **kwargs: Any + ) -> "_models.Index": + """Get a specific version of an Index. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :param version: Version of the index. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Index, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Index + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Index"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_get_request( + workspace_name=workspace_name, + name=name, + version=version, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Index', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}/versions/{version}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + endpoint: str, + subscription_id: str, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: "_models.Index", + **kwargs: Any + ) -> "_models.Index": + """Creates or updates a IndexVersion. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :param version: Version of the index. + :type version: str + :param body: Properties of an Index Version. + :type body: ~azure.mgmt.machinelearningservices.models.Index + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Index, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Index + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Index"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'Index') + + request = build_create_or_update_request( + workspace_name=workspace_name, + name=name, + version=version, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Index', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Index', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}/versions/{version}"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/models/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/models/__init__.py new file mode 100644 index 000000000000..52efbb78ee95 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/models/__init__.py @@ -0,0 +1,49 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AssetVersion + from ._models_py3 import AzureCoreFoundationsError + from ._models_py3 import AzureCoreFoundationsErrorResponse + from ._models_py3 import AzureCoreFoundationsInnerError + from ._models_py3 import DeploymentTemplate + from ._models_py3 import Index + from ._models_py3 import OnlineRequestSettings + from ._models_py3 import PagedDeploymentTemplate + from ._models_py3 import PagedIndex + from ._models_py3 import ProbeSettings + from ._models_py3 import SystemData + from ._models_py3 import VersionInfo +except (SyntaxError, ImportError): + from ._models import AssetVersion # type: ignore + from ._models import AzureCoreFoundationsError # type: ignore + from ._models import AzureCoreFoundationsErrorResponse # type: ignore + from ._models import AzureCoreFoundationsInnerError # type: ignore + from ._models import DeploymentTemplate # type: ignore + from ._models import Index # type: ignore + from ._models import OnlineRequestSettings # type: ignore + from ._models import PagedDeploymentTemplate # type: ignore + from ._models import PagedIndex # type: ignore + from ._models import ProbeSettings # type: ignore + from ._models import SystemData # type: ignore + from ._models import VersionInfo # type: ignore + +__all__ = [ + 'AssetVersion', + 'AzureCoreFoundationsError', + 'AzureCoreFoundationsErrorResponse', + 'AzureCoreFoundationsInnerError', + 'DeploymentTemplate', + 'Index', + 'OnlineRequestSettings', + 'PagedDeploymentTemplate', + 'PagedIndex', + 'ProbeSettings', + 'SystemData', + 'VersionInfo', +] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/models/_models.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/models/_models.py new file mode 100644 index 000000000000..a2b876606b9b --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/models/_models.py @@ -0,0 +1,688 @@ +# 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.core.exceptions import HttpResponseError +import msrest.serialization + + +class AssetVersion(msrest.serialization.Model): + """AssetVersion Definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Fully qualified resource Id: + azureml://workspace/{workspaceName}/indexes/{name}/versions/{version} of the index. + :vartype id: str + :ivar stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :vartype stage: str + :ivar description: Description information of the asset. + :vartype description: str + :ivar system_data: Metadata containing createdBy and modifiedBy information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :vartype tags: dict[str, str] + :ivar properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :vartype properties: dict[str, str] + """ + + _validation = { + 'id': {'required': True, 'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :paramtype stage: str + :keyword description: Description information of the asset. + :paramtype description: str + :keyword tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :paramtype tags: dict[str, str] + :keyword properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :paramtype properties: dict[str, str] + """ + super(AssetVersion, self).__init__(**kwargs) + self.id = None + self.stage = kwargs.get('stage', "Development") + self.description = kwargs.get('description', None) + self.system_data = None + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class AzureCoreFoundationsError(msrest.serialization.Model): + """The error object. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. One of a server-defined set of error codes. + :vartype code: str + :ivar message: Required. A human-readable representation of the error. + :vartype message: str + :ivar target: The target of the error. + :vartype target: str + :ivar details: An array of details about specific errors that led to this reported error. + :vartype details: list[~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsError] + :ivar innererror: An object containing more specific information than the current object about + the error. + :vartype innererror: ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsInnerError + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[AzureCoreFoundationsError]'}, + 'innererror': {'key': 'innererror', 'type': 'AzureCoreFoundationsInnerError'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword code: Required. One of a server-defined set of error codes. + :paramtype code: str + :keyword message: Required. A human-readable representation of the error. + :paramtype message: str + :keyword target: The target of the error. + :paramtype target: str + :keyword details: An array of details about specific errors that led to this reported error. + :paramtype details: list[~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsError] + :keyword innererror: An object containing more specific information than the current object + about the error. + :paramtype innererror: + ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsInnerError + """ + super(AzureCoreFoundationsError, self).__init__(**kwargs) + self.code = kwargs['code'] + self.message = kwargs['message'] + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + self.innererror = kwargs.get('innererror', None) + + +class AzureCoreFoundationsErrorResponse(msrest.serialization.Model): + """A response containing error details. + + All required parameters must be populated in order to send to Azure. + + :ivar error: Required. The error object. + :vartype error: ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsError + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'AzureCoreFoundationsError'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword error: Required. The error object. + :paramtype error: ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsError + """ + super(AzureCoreFoundationsErrorResponse, self).__init__(**kwargs) + self.error = kwargs['error'] + + +class AzureCoreFoundationsInnerError(msrest.serialization.Model): + """An object containing more specific information about the error. As per Azure REST API guidelines - https://aka.ms/AzureRestApiGuidelines#handling-errors. + + :ivar code: One of a server-defined set of error codes. + :vartype code: str + :ivar innererror: Inner error. + :vartype innererror: ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsInnerError + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'AzureCoreFoundationsInnerError'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword code: One of a server-defined set of error codes. + :paramtype code: str + :keyword innererror: Inner error. + :paramtype innererror: + ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsInnerError + """ + super(AzureCoreFoundationsInnerError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.innererror = kwargs.get('innererror', None) + + +class DeploymentTemplate(msrest.serialization.Model): + """DeploymentTemplate resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Fully qualified resource Id: + azureml://workspace/{workspaceName}/indexes/{name}/versions/{version} of the index. + :vartype id: str + :ivar stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :vartype stage: str + :ivar description: Description information of the asset. + :vartype description: str + :ivar system_data: Metadata containing createdBy and modifiedBy information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :vartype tags: dict[str, str] + :ivar properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :vartype properties: dict[str, str] + :ivar deployment_template_type: Required. The type of deployment template. + :vartype deployment_template_type: str + :ivar environment_id: Required. The ID of the environment asset. + :vartype environment_id: str + :ivar environment_variables: Environment variables for the deployment. + :vartype environment_variables: dict[str, str] + :ivar allowed_environment_variable_overrides: List of environment variable names that can be + overridden. + :vartype allowed_environment_variable_overrides: list[str] + :ivar model_mount_path: Path where the model will be mounted. + :vartype model_mount_path: str + :ivar request_settings: Request settings for online deployment. + :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :ivar liveness_probe: Liveness probe settings. + :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar readiness_probe: Readiness probe settings. + :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar allowed_instance_type: Required. List of allowed instance types for the deployment. + :vartype allowed_instance_type: list[str] + :ivar default_instance_type: Required. Default instance type for the deployment. + :vartype default_instance_type: str + :ivar instance_count: Required. Number of instances for the deployment. + :vartype instance_count: int + :ivar scoring_path: Path for scoring requests. + :vartype scoring_path: str + :ivar scoring_port: Port for scoring requests. + :vartype scoring_port: int + """ + + _validation = { + 'id': {'required': True, 'readonly': True}, + 'system_data': {'readonly': True}, + 'deployment_template_type': {'required': True}, + 'environment_id': {'required': True}, + 'allowed_instance_type': {'required': True}, + 'default_instance_type': {'required': True}, + 'instance_count': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'deployment_template_type': {'key': 'deploymentTemplateType', 'type': 'str'}, + 'environment_id': {'key': 'environmentId', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'allowed_environment_variable_overrides': {'key': 'allowedEnvironmentVariableOverrides', 'type': '[str]'}, + 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, + 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, + 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, + 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, + 'allowed_instance_type': {'key': 'allowedInstanceType', 'type': '[str]'}, + 'default_instance_type': {'key': 'defaultInstanceType', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + 'scoring_path': {'key': 'scoringPath', 'type': 'str'}, + 'scoring_port': {'key': 'scoringPort', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :paramtype stage: str + :keyword description: Description information of the asset. + :paramtype description: str + :keyword tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :paramtype tags: dict[str, str] + :keyword properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :paramtype properties: dict[str, str] + :keyword deployment_template_type: Required. The type of deployment template. + :paramtype deployment_template_type: str + :keyword environment_id: Required. The ID of the environment asset. + :paramtype environment_id: str + :keyword environment_variables: Environment variables for the deployment. + :paramtype environment_variables: dict[str, str] + :keyword allowed_environment_variable_overrides: List of environment variable names that can be + overridden. + :paramtype allowed_environment_variable_overrides: list[str] + :keyword model_mount_path: Path where the model will be mounted. + :paramtype model_mount_path: str + :keyword request_settings: Request settings for online deployment. + :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :keyword liveness_probe: Liveness probe settings. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword readiness_probe: Readiness probe settings. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword allowed_instance_type: Required. List of allowed instance types for the deployment. + :paramtype allowed_instance_type: list[str] + :keyword default_instance_type: Required. Default instance type for the deployment. + :paramtype default_instance_type: str + :keyword instance_count: Required. Number of instances for the deployment. + :paramtype instance_count: int + :keyword scoring_path: Path for scoring requests. + :paramtype scoring_path: str + :keyword scoring_port: Port for scoring requests. + :paramtype scoring_port: int + """ + super(DeploymentTemplate, self).__init__(**kwargs) + self.id = None + self.stage = kwargs.get('stage', "Development") + self.description = kwargs.get('description', None) + self.system_data = None + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + self.deployment_template_type = kwargs['deployment_template_type'] + self.environment_id = kwargs['environment_id'] + self.environment_variables = kwargs.get('environment_variables', None) + self.allowed_environment_variable_overrides = kwargs.get('allowed_environment_variable_overrides', None) + self.model_mount_path = kwargs.get('model_mount_path', None) + self.request_settings = kwargs.get('request_settings', None) + self.liveness_probe = kwargs.get('liveness_probe', None) + self.readiness_probe = kwargs.get('readiness_probe', None) + self.allowed_instance_type = kwargs['allowed_instance_type'] + self.default_instance_type = kwargs['default_instance_type'] + self.instance_count = kwargs['instance_count'] + self.scoring_path = kwargs.get('scoring_path', None) + self.scoring_port = kwargs.get('scoring_port', None) + + +class Index(msrest.serialization.Model): + """Index resource Definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Fully qualified resource Id: + azureml://workspace/{workspaceName}/indexes/{name}/versions/{version} of the index. + :vartype id: str + :ivar stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :vartype stage: str + :ivar description: Description information of the asset. + :vartype description: str + :ivar system_data: Metadata containing createdBy and modifiedBy information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :vartype tags: dict[str, str] + :ivar properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :vartype properties: dict[str, str] + :ivar storage_uri: Required. Default workspace blob storage Uri. Should work across storage + types and auth scenarios. + :vartype storage_uri: str + """ + + _validation = { + 'id': {'required': True, 'readonly': True}, + 'system_data': {'readonly': True}, + 'storage_uri': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :paramtype stage: str + :keyword description: Description information of the asset. + :paramtype description: str + :keyword tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :paramtype tags: dict[str, str] + :keyword properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :paramtype properties: dict[str, str] + :keyword storage_uri: Required. Default workspace blob storage Uri. Should work across storage + types and auth scenarios. + :paramtype storage_uri: str + """ + super(Index, self).__init__(**kwargs) + self.id = None + self.stage = kwargs.get('stage', "Development") + self.description = kwargs.get('description', None) + self.system_data = None + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + self.storage_uri = kwargs['storage_uri'] + + +class OnlineRequestSettings(msrest.serialization.Model): + """Settings for online request configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar request_timeout: Required. The timeout duration for requests. + :vartype request_timeout: ~datetime.timedelta + :ivar max_concurrent_requests_per_instance: Required. The maximum number of concurrent requests + per instance. + :vartype max_concurrent_requests_per_instance: int + """ + + _validation = { + 'request_timeout': {'required': True}, + 'max_concurrent_requests_per_instance': {'required': True}, + } + + _attribute_map = { + 'request_timeout': {'key': 'requestTimeout', 'type': 'duration'}, + 'max_concurrent_requests_per_instance': {'key': 'maxConcurrentRequestsPerInstance', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword request_timeout: Required. The timeout duration for requests. + :paramtype request_timeout: ~datetime.timedelta + :keyword max_concurrent_requests_per_instance: Required. The maximum number of concurrent + requests per instance. + :paramtype max_concurrent_requests_per_instance: int + """ + super(OnlineRequestSettings, self).__init__(**kwargs) + self.request_timeout = kwargs['request_timeout'] + self.max_concurrent_requests_per_instance = kwargs['max_concurrent_requests_per_instance'] + + +class PagedDeploymentTemplate(msrest.serialization.Model): + """Paged collection of DeploymentTemplate items. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of Deployment Templates. + :vartype value: list[~azure.mgmt.machinelearningservices.models.DeploymentTemplate] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentTemplate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Required. The list of Deployment Templates. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.DeploymentTemplate] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super(PagedDeploymentTemplate, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class PagedIndex(msrest.serialization.Model): + """Paged collection of IndexVersion items. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of Indexes. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Index] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Index]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword value: Required. The list of Indexes. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.Index] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super(PagedIndex, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class ProbeSettings(msrest.serialization.Model): + """Settings for probe configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar initial_delay: The initial delay before starting probes. + :vartype initial_delay: ~datetime.timedelta + :ivar period: Required. The period between probe executions. + :vartype period: ~datetime.timedelta + :ivar timeout: Required. The timeout duration for each probe. + :vartype timeout: ~datetime.timedelta + :ivar failure_threshold: Required. The number of consecutive failures required to consider the + probe as failed. + :vartype failure_threshold: int + :ivar success_threshold: Required. The number of consecutive successes required to consider the + probe as successful. + :vartype success_threshold: int + :ivar path: Required. The path for the probe request. + :vartype path: str + :ivar port: Required. The port number for the probe. + :vartype port: int + :ivar scheme: Required. The scheme for the probe (e.g., HTTP, HTTPS). + :vartype scheme: str + :ivar http_method: Required. The HTTP method for the probe request. + :vartype http_method: str + """ + + _validation = { + 'period': {'required': True}, + 'timeout': {'required': True}, + 'failure_threshold': {'required': True}, + 'success_threshold': {'required': True}, + 'path': {'required': True}, + 'port': {'required': True}, + 'scheme': {'required': True}, + 'http_method': {'required': True}, + } + + _attribute_map = { + 'initial_delay': {'key': 'initialDelay', 'type': 'duration'}, + 'period': {'key': 'period', 'type': 'duration'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, + 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, + 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, + 'path': {'key': 'path', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'scheme': {'key': 'scheme', 'type': 'str'}, + 'http_method': {'key': 'httpMethod', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword initial_delay: The initial delay before starting probes. + :paramtype initial_delay: ~datetime.timedelta + :keyword period: Required. The period between probe executions. + :paramtype period: ~datetime.timedelta + :keyword timeout: Required. The timeout duration for each probe. + :paramtype timeout: ~datetime.timedelta + :keyword failure_threshold: Required. The number of consecutive failures required to consider + the probe as failed. + :paramtype failure_threshold: int + :keyword success_threshold: Required. The number of consecutive successes required to consider + the probe as successful. + :paramtype success_threshold: int + :keyword path: Required. The path for the probe request. + :paramtype path: str + :keyword port: Required. The port number for the probe. + :paramtype port: int + :keyword scheme: Required. The scheme for the probe (e.g., HTTP, HTTPS). + :paramtype scheme: str + :keyword http_method: Required. The HTTP method for the probe request. + :paramtype http_method: str + """ + super(ProbeSettings, self).__init__(**kwargs) + self.initial_delay = kwargs.get('initial_delay', None) + self.period = kwargs['period'] + self.timeout = kwargs['timeout'] + self.failure_threshold = kwargs['failure_threshold'] + self.success_threshold = kwargs['success_threshold'] + self.path = kwargs['path'] + self.port = kwargs['port'] + self.scheme = kwargs['scheme'] + self.http_method = kwargs['http_method'] + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_at: The timestamp the resource was created at. + :vartype created_at: ~datetime.datetime + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The identity type that created the resource. + :vartype created_by_type: str + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _validation = { + 'created_at': {'readonly': True}, + 'created_by': {'readonly': True}, + 'created_by_type': {'readonly': True}, + 'last_modified_at': {'readonly': True}, + } + + _attribute_map = { + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SystemData, self).__init__(**kwargs) + self.created_at = None + self.created_by = None + self.created_by_type = None + self.last_modified_at = None + + +class VersionInfo(msrest.serialization.Model): + """Next version definition. + + All required parameters must be populated in order to send to Azure. + + :ivar next_version: Next version as defined by the server. The server keeps track of all + versions that are string-representations of integers. If one exists, the nextVersion will be a + string representation of the highest integer value + 1. Otherwise, the nextVersion will default + to '1'. + :vartype next_version: long + :ivar latest_version: Required. Current latest version of the resource. + :vartype latest_version: str + """ + + _validation = { + 'latest_version': {'required': True}, + } + + _attribute_map = { + 'next_version': {'key': 'nextVersion', 'type': 'long'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword next_version: Next version as defined by the server. The server keeps track of all + versions that are string-representations of integers. If one exists, the nextVersion will be a + string representation of the highest integer value + 1. Otherwise, the nextVersion will default + to '1'. + :paramtype next_version: long + :keyword latest_version: Required. Current latest version of the resource. + :paramtype latest_version: str + """ + super(VersionInfo, self).__init__(**kwargs) + self.next_version = kwargs.get('next_version', None) + self.latest_version = kwargs['latest_version'] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/models/_models_py3.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/models/_models_py3.py new file mode 100644 index 000000000000..a00139cf0e85 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/models/_models_py3.py @@ -0,0 +1,753 @@ +# 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 datetime +from typing import Dict, List, Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AssetVersion(msrest.serialization.Model): + """AssetVersion Definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Fully qualified resource Id: + azureml://workspace/{workspaceName}/indexes/{name}/versions/{version} of the index. + :vartype id: str + :ivar stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :vartype stage: str + :ivar description: Description information of the asset. + :vartype description: str + :ivar system_data: Metadata containing createdBy and modifiedBy information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :vartype tags: dict[str, str] + :ivar properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :vartype properties: dict[str, str] + """ + + _validation = { + 'id': {'required': True, 'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + } + + def __init__( + self, + *, + stage: Optional[str] = "Development", + description: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :paramtype stage: str + :keyword description: Description information of the asset. + :paramtype description: str + :keyword tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :paramtype tags: dict[str, str] + :keyword properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :paramtype properties: dict[str, str] + """ + super(AssetVersion, self).__init__(**kwargs) + self.id = None + self.stage = stage + self.description = description + self.system_data = None + self.tags = tags + self.properties = properties + + +class AzureCoreFoundationsError(msrest.serialization.Model): + """The error object. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. One of a server-defined set of error codes. + :vartype code: str + :ivar message: Required. A human-readable representation of the error. + :vartype message: str + :ivar target: The target of the error. + :vartype target: str + :ivar details: An array of details about specific errors that led to this reported error. + :vartype details: list[~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsError] + :ivar innererror: An object containing more specific information than the current object about + the error. + :vartype innererror: ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsInnerError + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[AzureCoreFoundationsError]'}, + 'innererror': {'key': 'innererror', 'type': 'AzureCoreFoundationsInnerError'}, + } + + def __init__( + self, + *, + code: str, + message: str, + target: Optional[str] = None, + details: Optional[List["AzureCoreFoundationsError"]] = None, + innererror: Optional["AzureCoreFoundationsInnerError"] = None, + **kwargs + ): + """ + :keyword code: Required. One of a server-defined set of error codes. + :paramtype code: str + :keyword message: Required. A human-readable representation of the error. + :paramtype message: str + :keyword target: The target of the error. + :paramtype target: str + :keyword details: An array of details about specific errors that led to this reported error. + :paramtype details: list[~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsError] + :keyword innererror: An object containing more specific information than the current object + about the error. + :paramtype innererror: + ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsInnerError + """ + super(AzureCoreFoundationsError, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + self.innererror = innererror + + +class AzureCoreFoundationsErrorResponse(msrest.serialization.Model): + """A response containing error details. + + All required parameters must be populated in order to send to Azure. + + :ivar error: Required. The error object. + :vartype error: ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsError + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'AzureCoreFoundationsError'}, + } + + def __init__( + self, + *, + error: "AzureCoreFoundationsError", + **kwargs + ): + """ + :keyword error: Required. The error object. + :paramtype error: ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsError + """ + super(AzureCoreFoundationsErrorResponse, self).__init__(**kwargs) + self.error = error + + +class AzureCoreFoundationsInnerError(msrest.serialization.Model): + """An object containing more specific information about the error. As per Azure REST API guidelines - https://aka.ms/AzureRestApiGuidelines#handling-errors. + + :ivar code: One of a server-defined set of error codes. + :vartype code: str + :ivar innererror: Inner error. + :vartype innererror: ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsInnerError + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'innererror': {'key': 'innererror', 'type': 'AzureCoreFoundationsInnerError'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + innererror: Optional["AzureCoreFoundationsInnerError"] = None, + **kwargs + ): + """ + :keyword code: One of a server-defined set of error codes. + :paramtype code: str + :keyword innererror: Inner error. + :paramtype innererror: + ~azure.mgmt.machinelearningservices.models.AzureCoreFoundationsInnerError + """ + super(AzureCoreFoundationsInnerError, self).__init__(**kwargs) + self.code = code + self.innererror = innererror + + +class DeploymentTemplate(msrest.serialization.Model): + """DeploymentTemplate resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Fully qualified resource Id: + azureml://workspace/{workspaceName}/indexes/{name}/versions/{version} of the index. + :vartype id: str + :ivar stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :vartype stage: str + :ivar description: Description information of the asset. + :vartype description: str + :ivar system_data: Metadata containing createdBy and modifiedBy information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :vartype tags: dict[str, str] + :ivar properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :vartype properties: dict[str, str] + :ivar deployment_template_type: Required. The type of deployment template. + :vartype deployment_template_type: str + :ivar environment_id: Required. The ID of the environment asset. + :vartype environment_id: str + :ivar environment_variables: Environment variables for the deployment. + :vartype environment_variables: dict[str, str] + :ivar allowed_environment_variable_overrides: List of environment variable names that can be + overridden. + :vartype allowed_environment_variable_overrides: list[str] + :ivar model_mount_path: Path where the model will be mounted. + :vartype model_mount_path: str + :ivar request_settings: Request settings for online deployment. + :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :ivar liveness_probe: Liveness probe settings. + :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar readiness_probe: Readiness probe settings. + :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar allowed_instance_type: Required. List of allowed instance types for the deployment. + :vartype allowed_instance_type: list[str] + :ivar default_instance_type: Required. Default instance type for the deployment. + :vartype default_instance_type: str + :ivar instance_count: Required. Number of instances for the deployment. + :vartype instance_count: int + :ivar scoring_path: Path for scoring requests. + :vartype scoring_path: str + :ivar scoring_port: Port for scoring requests. + :vartype scoring_port: int + """ + + _validation = { + 'id': {'required': True, 'readonly': True}, + 'system_data': {'readonly': True}, + 'deployment_template_type': {'required': True}, + 'environment_id': {'required': True}, + 'allowed_instance_type': {'required': True}, + 'default_instance_type': {'required': True}, + 'instance_count': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'deployment_template_type': {'key': 'deploymentTemplateType', 'type': 'str'}, + 'environment_id': {'key': 'environmentId', 'type': 'str'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'allowed_environment_variable_overrides': {'key': 'allowedEnvironmentVariableOverrides', 'type': '[str]'}, + 'model_mount_path': {'key': 'modelMountPath', 'type': 'str'}, + 'request_settings': {'key': 'requestSettings', 'type': 'OnlineRequestSettings'}, + 'liveness_probe': {'key': 'livenessProbe', 'type': 'ProbeSettings'}, + 'readiness_probe': {'key': 'readinessProbe', 'type': 'ProbeSettings'}, + 'allowed_instance_type': {'key': 'allowedInstanceType', 'type': '[str]'}, + 'default_instance_type': {'key': 'defaultInstanceType', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + 'scoring_path': {'key': 'scoringPath', 'type': 'str'}, + 'scoring_port': {'key': 'scoringPort', 'type': 'int'}, + } + + def __init__( + self, + *, + deployment_template_type: str, + environment_id: str, + allowed_instance_type: List[str], + default_instance_type: str, + instance_count: int, + stage: Optional[str] = "Development", + description: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional[Dict[str, str]] = None, + environment_variables: Optional[Dict[str, str]] = None, + allowed_environment_variable_overrides: Optional[List[str]] = None, + model_mount_path: Optional[str] = None, + request_settings: Optional["OnlineRequestSettings"] = None, + liveness_probe: Optional["ProbeSettings"] = None, + readiness_probe: Optional["ProbeSettings"] = None, + scoring_path: Optional[str] = None, + scoring_port: Optional[int] = None, + **kwargs + ): + """ + :keyword stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :paramtype stage: str + :keyword description: Description information of the asset. + :paramtype description: str + :keyword tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :paramtype tags: dict[str, str] + :keyword properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :paramtype properties: dict[str, str] + :keyword deployment_template_type: Required. The type of deployment template. + :paramtype deployment_template_type: str + :keyword environment_id: Required. The ID of the environment asset. + :paramtype environment_id: str + :keyword environment_variables: Environment variables for the deployment. + :paramtype environment_variables: dict[str, str] + :keyword allowed_environment_variable_overrides: List of environment variable names that can be + overridden. + :paramtype allowed_environment_variable_overrides: list[str] + :keyword model_mount_path: Path where the model will be mounted. + :paramtype model_mount_path: str + :keyword request_settings: Request settings for online deployment. + :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :keyword liveness_probe: Liveness probe settings. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword readiness_probe: Readiness probe settings. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword allowed_instance_type: Required. List of allowed instance types for the deployment. + :paramtype allowed_instance_type: list[str] + :keyword default_instance_type: Required. Default instance type for the deployment. + :paramtype default_instance_type: str + :keyword instance_count: Required. Number of instances for the deployment. + :paramtype instance_count: int + :keyword scoring_path: Path for scoring requests. + :paramtype scoring_path: str + :keyword scoring_port: Port for scoring requests. + :paramtype scoring_port: int + """ + super(DeploymentTemplate, self).__init__(**kwargs) + self.id = None + self.stage = stage + self.description = description + self.system_data = None + self.tags = tags + self.properties = properties + self.deployment_template_type = deployment_template_type + self.environment_id = environment_id + self.environment_variables = environment_variables + self.allowed_environment_variable_overrides = allowed_environment_variable_overrides + self.model_mount_path = model_mount_path + self.request_settings = request_settings + self.liveness_probe = liveness_probe + self.readiness_probe = readiness_probe + self.allowed_instance_type = allowed_instance_type + self.default_instance_type = default_instance_type + self.instance_count = instance_count + self.scoring_path = scoring_path + self.scoring_port = scoring_port + + +class Index(msrest.serialization.Model): + """Index resource Definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Fully qualified resource Id: + azureml://workspace/{workspaceName}/indexes/{name}/versions/{version} of the index. + :vartype id: str + :ivar stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :vartype stage: str + :ivar description: Description information of the asset. + :vartype description: str + :ivar system_data: Metadata containing createdBy and modifiedBy information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :vartype tags: dict[str, str] + :ivar properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :vartype properties: dict[str, str] + :ivar storage_uri: Required. Default workspace blob storage Uri. Should work across storage + types and auth scenarios. + :vartype storage_uri: str + """ + + _validation = { + 'id': {'required': True, 'readonly': True}, + 'system_data': {'readonly': True}, + 'storage_uri': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'stage': {'key': 'stage', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': '{str}'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + } + + def __init__( + self, + *, + storage_uri: str, + stage: Optional[str] = "Development", + description: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword stage: Update stage to 'Archive' to archive the asset. Default is Development, which + means the asset is under development. + :paramtype stage: str + :keyword description: Description information of the asset. + :paramtype description: str + :keyword tags: A set of tags. Asset's tags. Unlike properties, tags are fully mutable. + :paramtype tags: dict[str, str] + :keyword properties: Asset's properties. Unlike tags, properties are add-only. Once added, a + property cannot be removed. + :paramtype properties: dict[str, str] + :keyword storage_uri: Required. Default workspace blob storage Uri. Should work across storage + types and auth scenarios. + :paramtype storage_uri: str + """ + super(Index, self).__init__(**kwargs) + self.id = None + self.stage = stage + self.description = description + self.system_data = None + self.tags = tags + self.properties = properties + self.storage_uri = storage_uri + + +class OnlineRequestSettings(msrest.serialization.Model): + """Settings for online request configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar request_timeout: Required. The timeout duration for requests. + :vartype request_timeout: ~datetime.timedelta + :ivar max_concurrent_requests_per_instance: Required. The maximum number of concurrent requests + per instance. + :vartype max_concurrent_requests_per_instance: int + """ + + _validation = { + 'request_timeout': {'required': True}, + 'max_concurrent_requests_per_instance': {'required': True}, + } + + _attribute_map = { + 'request_timeout': {'key': 'requestTimeout', 'type': 'duration'}, + 'max_concurrent_requests_per_instance': {'key': 'maxConcurrentRequestsPerInstance', 'type': 'int'}, + } + + def __init__( + self, + *, + request_timeout: datetime.timedelta, + max_concurrent_requests_per_instance: int, + **kwargs + ): + """ + :keyword request_timeout: Required. The timeout duration for requests. + :paramtype request_timeout: ~datetime.timedelta + :keyword max_concurrent_requests_per_instance: Required. The maximum number of concurrent + requests per instance. + :paramtype max_concurrent_requests_per_instance: int + """ + super(OnlineRequestSettings, self).__init__(**kwargs) + self.request_timeout = request_timeout + self.max_concurrent_requests_per_instance = max_concurrent_requests_per_instance + + +class PagedDeploymentTemplate(msrest.serialization.Model): + """Paged collection of DeploymentTemplate items. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of Deployment Templates. + :vartype value: list[~azure.mgmt.machinelearningservices.models.DeploymentTemplate] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentTemplate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DeploymentTemplate"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of Deployment Templates. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.DeploymentTemplate] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super(PagedDeploymentTemplate, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PagedIndex(msrest.serialization.Model): + """Paged collection of IndexVersion items. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. The list of Indexes. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Index] + :ivar next_link: The link to the next page of items. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Index]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Index"], + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Required. The list of Indexes. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.Index] + :keyword next_link: The link to the next page of items. + :paramtype next_link: str + """ + super(PagedIndex, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ProbeSettings(msrest.serialization.Model): + """Settings for probe configuration. + + All required parameters must be populated in order to send to Azure. + + :ivar initial_delay: The initial delay before starting probes. + :vartype initial_delay: ~datetime.timedelta + :ivar period: Required. The period between probe executions. + :vartype period: ~datetime.timedelta + :ivar timeout: Required. The timeout duration for each probe. + :vartype timeout: ~datetime.timedelta + :ivar failure_threshold: Required. The number of consecutive failures required to consider the + probe as failed. + :vartype failure_threshold: int + :ivar success_threshold: Required. The number of consecutive successes required to consider the + probe as successful. + :vartype success_threshold: int + :ivar path: Required. The path for the probe request. + :vartype path: str + :ivar port: Required. The port number for the probe. + :vartype port: int + :ivar scheme: Required. The scheme for the probe (e.g., HTTP, HTTPS). + :vartype scheme: str + :ivar http_method: Required. The HTTP method for the probe request. + :vartype http_method: str + """ + + _validation = { + 'period': {'required': True}, + 'timeout': {'required': True}, + 'failure_threshold': {'required': True}, + 'success_threshold': {'required': True}, + 'path': {'required': True}, + 'port': {'required': True}, + 'scheme': {'required': True}, + 'http_method': {'required': True}, + } + + _attribute_map = { + 'initial_delay': {'key': 'initialDelay', 'type': 'duration'}, + 'period': {'key': 'period', 'type': 'duration'}, + 'timeout': {'key': 'timeout', 'type': 'duration'}, + 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, + 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, + 'path': {'key': 'path', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'scheme': {'key': 'scheme', 'type': 'str'}, + 'http_method': {'key': 'httpMethod', 'type': 'str'}, + } + + def __init__( + self, + *, + period: datetime.timedelta, + timeout: datetime.timedelta, + failure_threshold: int, + success_threshold: int, + path: str, + port: int, + scheme: str, + http_method: str, + initial_delay: Optional[datetime.timedelta] = None, + **kwargs + ): + """ + :keyword initial_delay: The initial delay before starting probes. + :paramtype initial_delay: ~datetime.timedelta + :keyword period: Required. The period between probe executions. + :paramtype period: ~datetime.timedelta + :keyword timeout: Required. The timeout duration for each probe. + :paramtype timeout: ~datetime.timedelta + :keyword failure_threshold: Required. The number of consecutive failures required to consider + the probe as failed. + :paramtype failure_threshold: int + :keyword success_threshold: Required. The number of consecutive successes required to consider + the probe as successful. + :paramtype success_threshold: int + :keyword path: Required. The path for the probe request. + :paramtype path: str + :keyword port: Required. The port number for the probe. + :paramtype port: int + :keyword scheme: Required. The scheme for the probe (e.g., HTTP, HTTPS). + :paramtype scheme: str + :keyword http_method: Required. The HTTP method for the probe request. + :paramtype http_method: str + """ + super(ProbeSettings, self).__init__(**kwargs) + self.initial_delay = initial_delay + self.period = period + self.timeout = timeout + self.failure_threshold = failure_threshold + self.success_threshold = success_threshold + self.path = path + self.port = port + self.scheme = scheme + self.http_method = http_method + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_at: The timestamp the resource was created at. + :vartype created_at: ~datetime.datetime + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The identity type that created the resource. + :vartype created_by_type: str + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _validation = { + 'created_at': {'readonly': True}, + 'created_by': {'readonly': True}, + 'created_by_type': {'readonly': True}, + 'last_modified_at': {'readonly': True}, + } + + _attribute_map = { + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(SystemData, self).__init__(**kwargs) + self.created_at = None + self.created_by = None + self.created_by_type = None + self.last_modified_at = None + + +class VersionInfo(msrest.serialization.Model): + """Next version definition. + + All required parameters must be populated in order to send to Azure. + + :ivar next_version: Next version as defined by the server. The server keeps track of all + versions that are string-representations of integers. If one exists, the nextVersion will be a + string representation of the highest integer value + 1. Otherwise, the nextVersion will default + to '1'. + :vartype next_version: long + :ivar latest_version: Required. Current latest version of the resource. + :vartype latest_version: str + """ + + _validation = { + 'latest_version': {'required': True}, + } + + _attribute_map = { + 'next_version': {'key': 'nextVersion', 'type': 'long'}, + 'latest_version': {'key': 'latestVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + latest_version: str, + next_version: Optional[int] = None, + **kwargs + ): + """ + :keyword next_version: Next version as defined by the server. The server keeps track of all + versions that are string-representations of integers. If one exists, the nextVersion will be a + string representation of the highest integer value + 1. Otherwise, the nextVersion will default + to '1'. + :paramtype next_version: long + :keyword latest_version: Required. Current latest version of the resource. + :paramtype latest_version: str + """ + super(VersionInfo, self).__init__(**kwargs) + self.next_version = next_version + self.latest_version = latest_version diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/operations/__init__.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/operations/__init__.py new file mode 100644 index 000000000000..f5baa9e7ddee --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/operations/__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 ._deployment_templates_operations import DeploymentTemplatesOperations +from ._indexes_operations import IndexesOperations + +__all__ = [ + 'DeploymentTemplatesOperations', + 'IndexesOperations', +] diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/operations/_deployment_templates_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/operations/_deployment_templates_operations.py new file mode 100644 index 000000000000..aa1ea569d5f8 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/operations/_deployment_templates_operations.py @@ -0,0 +1,598 @@ +# pylint: disable=too-many-lines +# 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 TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + registry_name, # type: str + name, # type: str + version, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/registries/{registryName}/{name}/versions/{version}") + path_format_arguments = { + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str', max_length=254, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9-_]*$'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_deployment_templates_request( + registry_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + name = kwargs.pop('name', None) # type: Optional[str] + tags = kwargs.pop('tags', None) # type: Optional[str] + continuation_token_parameter = kwargs.pop('continuation_token_parameter', None) # type: Optional[str] + continuation_token_from_header = kwargs.pop('continuation_token_from_header', None) # type: Optional[str] + count = kwargs.pop('count', None) # type: Optional[int] + stage = kwargs.pop('stage', None) # type: Optional[str] + list_view_type = kwargs.pop('list_view_type', "ActiveOnly") # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/registries/{registryName}/deploymenttemplates") + path_format_arguments = { + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if name is not None: + _query_parameters['name'] = _SERIALIZER.query("name", name, 'str') + if tags is not None: + _query_parameters['tags'] = _SERIALIZER.query("tags", tags, 'str') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + if count is not None: + _query_parameters['count'] = _SERIALIZER.query("count", count, 'int') + if stage is not None: + _query_parameters['stage'] = _SERIALIZER.query("stage", stage, 'str') + if list_view_type is not None: + _query_parameters['listViewType'] = _SERIALIZER.query("list_view_type", list_view_type, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if continuation_token_from_header is not None: + _header_parameters['continuation-token-from-header'] = _SERIALIZER.header("continuation_token_from_header", continuation_token_from_header, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + registry_name, # type: str + name, # type: str + version, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + asset_resource_tenant_id = kwargs.pop('asset_resource_tenant_id', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/registries/{registryName}/deploymenttemplates/{name}/versions/{version}") + path_format_arguments = { + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str', max_length=254, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9-_]*$'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if asset_resource_tenant_id is not None: + _query_parameters['assetResourceTenantId'] = _SERIALIZER.query("asset_resource_tenant_id", asset_resource_tenant_id, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_deployment_template_request( + registry_name, # type: str + name, # type: str + version, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/registries/{registryName}/deploymenttemplates/{name}/versions/{version}") + path_format_arguments = { + "registryName": _SERIALIZER.url("registry_name", registry_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str', max_length=254, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9-_]*$'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class DeploymentTemplatesOperations(object): + """DeploymentTemplatesOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + registry_name, # type: str + name, # type: str + version, # type: str + body, # type: "_models.DeploymentTemplate" + **kwargs # type: Any + ): + # type: (...) -> None + """Creates a deployment template version. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param registry_name: The name of the AzureML registry. + :type registry_name: str + :param name: Name of the deployment template. + :type name: str + :param version: Version of the deployment template. + :type version: str + :param body: Properties of a Deployment Template Version. + :type body: ~azure.mgmt.machinelearningservices.models.DeploymentTemplate + :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', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'DeploymentTemplate') + + request = build_create_request( + registry_name=registry_name, + name=name, + version=version, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + create.metadata = {'url': "/registries/{registryName}/{name}/versions/{version}"} # type: ignore + + + @distributed_trace + def list_deployment_templates( + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + registry_name, # type: str + name=None, # type: Optional[str] + tags=None, # type: Optional[str] + continuation_token_parameter=None, # type: Optional[str] + continuation_token_from_header=None, # type: Optional[str] + count=None, # type: Optional[int] + stage=None, # type: Optional[str] + list_view_type="ActiveOnly", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PagedDeploymentTemplate"] + """List deployment templates. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param registry_name: The name of the AzureML registry. + :type registry_name: str + :param name: Filter by deployment template name. + :type name: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. + :type tags: str + :param continuation_token_parameter: Continuation token for pagination. + :type continuation_token_parameter: str + :param continuation_token_from_header: Continuation token for pagination (from header). + :type continuation_token_from_header: str + :param count: Maximum number of items to return. + :type count: int + :param stage: Filter by deployment template stage. + :type stage: str + :param list_view_type: View type for including/excluding (for example) archived entities. + :type list_view_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedDeploymentTemplate or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PagedDeploymentTemplate] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedDeploymentTemplate"] + 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_deployment_templates_request( + registry_name=registry_name, + api_version=api_version, + name=name, + tags=tags, + continuation_token_parameter=continuation_token_parameter, + continuation_token_from_header=continuation_token_from_header, + count=count, + stage=stage, + list_view_type=list_view_type, + template_url=self.list_deployment_templates.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_deployment_templates_request( + registry_name=registry_name, + api_version=api_version, + name=name, + tags=tags, + continuation_token_parameter=continuation_token_parameter, + continuation_token_from_header=continuation_token_from_header, + count=count, + stage=stage, + list_view_type=list_view_type, + template_url=next_link, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PagedDeploymentTemplate", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_deployment_templates.metadata = {'url': "/registries/{registryName}/deploymenttemplates"} # type: ignore + + @distributed_trace + def get( + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + registry_name, # type: str + name, # type: str + version, # type: str + asset_resource_tenant_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentTemplate" + """Get a specific version of a deployment template. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param registry_name: The name of the AzureML registry. + :type registry_name: str + :param name: Name of the deployment template. + :type name: str + :param version: Version of the deployment template. + :type version: str + :param asset_resource_tenant_id: Asset resource tenant ID. + :type asset_resource_tenant_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentTemplate, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeploymentTemplate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentTemplate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_get_request( + registry_name=registry_name, + name=name, + version=version, + api_version=api_version, + asset_resource_tenant_id=asset_resource_tenant_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentTemplate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/registries/{registryName}/deploymenttemplates/{name}/versions/{version}"} # type: ignore + + + @distributed_trace + def delete_deployment_template( # pylint: disable=inconsistent-return-statements + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + registry_name, # type: str + name, # type: str + version, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a specific version of a deployment template. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param registry_name: The name of the AzureML registry. + :type registry_name: str + :param name: Name of the deployment template. + :type name: str + :param version: Version of the deployment template. + :type version: 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', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_delete_deployment_template_request( + registry_name=registry_name, + name=name, + version=version, + api_version=api_version, + template_url=self.delete_deployment_template.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete_deployment_template.metadata = {'url': "/registries/{registryName}/deploymenttemplates/{name}/versions/{version}"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/operations/_indexes_operations.py b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/operations/_indexes_operations.py new file mode 100644 index 000000000000..07517fafe8f6 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/operations/_indexes_operations.py @@ -0,0 +1,863 @@ +# pylint: disable=too-many-lines +# 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 TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_latest_request( + workspace_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', 0) # type: Optional[int] + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[int] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/workspaces/{workspaceName}/indexes") + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if top is not None: + _query_parameters['top'] = _SERIALIZER.query("top", top, 'int') + if skip is not None: + _query_parameters['skip'] = _SERIALIZER.query("skip", skip, 'int') + if maxpagesize is not None: + _query_parameters['maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'int') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_latest_request( + workspace_name, # type: str + name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/workspaces/{workspaceName}/indexes/{name}") + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str', max_length=254, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9-_]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_next_version_request( + workspace_name, # type: str + name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/workspaces/{workspaceName}/indexes/{name}:getNextVersion") + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str', max_length=254, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9-_]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + workspace_name, # type: str + name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + list_view_type = kwargs.pop('list_view_type', "ActiveOnly") # type: str + order_by = kwargs.pop('order_by', None) # type: Optional[str] + tags = kwargs.pop('tags', None) # type: Optional[str] + top = kwargs.pop('top', None) # type: Optional[int] + skip = kwargs.pop('skip', 0) # type: Optional[int] + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[int] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/workspaces/{workspaceName}/indexes/{name}/versions") + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str', max_length=254, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9-_]*$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters['listViewType'] = _SERIALIZER.query("list_view_type", list_view_type, 'str') + if order_by is not None: + _query_parameters['orderBy'] = _SERIALIZER.query("order_by", order_by, 'str') + if tags is not None: + _query_parameters['tags'] = _SERIALIZER.query("tags", tags, 'str') + if top is not None: + _query_parameters['top'] = _SERIALIZER.query("top", top, 'int') + if skip is not None: + _query_parameters['skip'] = _SERIALIZER.query("skip", skip, 'int') + if maxpagesize is not None: + _query_parameters['maxpagesize'] = _SERIALIZER.query("maxpagesize", maxpagesize, 'int') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + workspace_name, # type: str + name, # type: str + version, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/workspaces/{workspaceName}/indexes/{name}/versions/{version}") + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str', max_length=254, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9-_]*$'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + workspace_name, # type: str + name, # type: str + version, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/workspaces/{workspaceName}/indexes/{name}/versions/{version}") + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str', max_length=254, min_length=0, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9-_]*$'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class IndexesOperations(object): + """IndexesOperations 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): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_latest( + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + top=None, # type: Optional[int] + skip=0, # type: Optional[int] + maxpagesize=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PagedIndex"] + """List the latest version of each index. Latest is defined by most recent created by date. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param top: The number of result items to return. + :type top: int + :param skip: The number of result items to skip. + :type skip: int + :param maxpagesize: The maximum number of result items per page. + :type maxpagesize: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedIndex or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PagedIndex] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedIndex"] + 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_latest_request( + workspace_name=workspace_name, + api_version=api_version, + top=top, + skip=skip, + maxpagesize=maxpagesize, + template_url=self.list_latest.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_latest_request( + workspace_name=workspace_name, + api_version=api_version, + top=top, + skip=skip, + maxpagesize=maxpagesize, + template_url=next_link, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PagedIndex", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_latest.metadata = {'url': "/workspaces/{workspaceName}/indexes"} # type: ignore + + @distributed_trace + def get_latest( + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Index" + """Get latest version of the Index. Latest is defined by most recent created by date. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Index, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Index + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Index"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_get_latest_request( + workspace_name=workspace_name, + name=name, + api_version=api_version, + template_url=self.get_latest.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Index', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_latest.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}"} # type: ignore + + + @distributed_trace + def get_next_version( + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VersionInfo" + """Get next Index version as defined by the server. The server keeps track of all versions that + are string-representations of integers. If one exists, the nextVersion will be a string + representation of the highest integer value + 1. Otherwise, the nextVersion will default to + '1'. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VersionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.VersionInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VersionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_get_next_version_request( + workspace_name=workspace_name, + name=name, + api_version=api_version, + template_url=self.get_next_version.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VersionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_next_version.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}:getNextVersion"} # type: ignore + + + @distributed_trace + def list( + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + name, # type: str + list_view_type="ActiveOnly", # type: str + order_by=None, # type: Optional[str] + tags=None, # type: Optional[str] + top=None, # type: Optional[int] + skip=0, # type: Optional[int] + maxpagesize=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PagedIndex"] + """List the versions of an Index given the name. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :param list_view_type: View type for including/excluding (for example) archived entities. + :type list_view_type: str + :param order_by: Ordering of list: Please choose orderby value from ['createdAt', + 'lastModifiedAt']. + :type order_by: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. + :type tags: str + :param top: The number of result items to return. + :type top: int + :param skip: The number of result items to skip. + :type skip: int + :param maxpagesize: The maximum number of result items per page. + :type maxpagesize: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PagedIndex or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PagedIndex] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.PagedIndex"] + 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( + workspace_name=workspace_name, + name=name, + api_version=api_version, + list_view_type=list_view_type, + order_by=order_by, + tags=tags, + top=top, + skip=skip, + maxpagesize=maxpagesize, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + else: + + request = build_list_request( + workspace_name=workspace_name, + name=name, + api_version=api_version, + list_view_type=list_view_type, + order_by=order_by, + tags=tags, + top=top, + skip=skip, + maxpagesize=maxpagesize, + template_url=next_link, + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PagedIndex", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}/versions"} # type: ignore + + @distributed_trace + def get( + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + name, # type: str + version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Index" + """Get a specific version of an Index. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :param version: Version of the index. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Index, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Index + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Index"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + + + request = build_get_request( + workspace_name=workspace_name, + name=name, + version=version, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Index', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}/versions/{version}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + endpoint, # type: str + subscription_id, # type: str + resource_group_name, # type: str + workspace_name, # type: str + name, # type: str + version, # type: str + body, # type: "_models.Index" + **kwargs # type: Any + ): + # type: (...) -> "_models.Index" + """Creates or updates a IndexVersion. + + :param endpoint: Supported Azure-AI asset endpoints. + :type endpoint: str + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param resource_group_name: The name of the Resource Group. + :type resource_group_name: str + :param workspace_name: The name of the AzureML workspace or AI project. + :type workspace_name: str + :param name: Name of the index. + :type name: str + :param version: Version of the index. + :type version: str + :param body: Properties of an Index Version. + :type body: ~azure.mgmt.machinelearningservices.models.Index + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Index, or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Index + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Index"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2024-04-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'Index') + + request = build_create_or_update_request( + workspace_name=workspace_name, + name=name, + version=version, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("endpoint", endpoint, 'str', skip_quote=True), + "subscriptionId": self._serialize.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.AzureCoreFoundationsErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Index', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Index', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/workspaces/{workspaceName}/indexes/{name}/versions/{version}"} # type: ignore + diff --git a/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/py.typed b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/v2024-04-01-dataplanepreview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-04-01-dataplanepreview/azure-ai-assets.json b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-04-01-dataplanepreview/azure-ai-assets.json index 3770d1f60557..6736f024719a 100644 --- a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-04-01-dataplanepreview/azure-ai-assets.json +++ b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-04-01-dataplanepreview/azure-ai-assets.json @@ -13,7 +13,7 @@ "https" ], "x-ms-parameterized-host": { - "hostTemplate": "{endpoint}/genericasset/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", + "hostTemplate": "{endpoint}/genericasset/v2.0/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices", "useSchemePrefix": false, "parameters": [ { @@ -38,13 +38,6 @@ "description": "The name of the Resource Group.", "required": true, "type": "string" - }, - { - "name": "workspaceName", - "in": "path", - "description": "The name of the AzureML workspace or AI project.", - "required": true, - "type": "string" } ] }, @@ -133,6 +126,99 @@ } } }, + "/registries/{registryName}/deploymenttemplates": { + "get": { + "operationId": "DeploymentTemplates_ListDeploymentTemplates", + "description": "List deployment templates.", + "parameters": [ + { + "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" + }, + { + "name": "registryName", + "in": "path", + "description": "The name of the AzureML registry.", + "required": true, + "type": "string" + }, + { + "name": "name", + "in": "query", + "description": "Filter by deployment template name.", + "required": false, + "type": "string" + }, + { + "name": "tags", + "in": "query", + "description": "Comma-separated list of tag names (and optionally values). Example: tag1,tag2=value2.", + "required": false, + "type": "string" + }, + { + "name": "continuationToken", + "in": "query", + "description": "Continuation token for pagination.", + "required": false, + "type": "string" + }, + { + "name": "continuation-token-from-header", + "in": "header", + "description": "Continuation token for pagination (from header).", + "required": false, + "type": "string", + "x-ms-client-name": "continuationTokenFromHeader" + }, + { + "name": "count", + "in": "query", + "description": "Maximum number of items to return.", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "stage", + "in": "query", + "description": "Filter by deployment template stage.", + "required": false, + "type": "string" + }, + { + "name": "listViewType", + "in": "query", + "description": "View type for including/excluding (for example) archived entities.", + "required": false, + "type": "string", + "default": "ActiveOnly" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/PagedDeploymentTemplate" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse" + }, + "headers": { + "x-ms-error-code": { + "type": "string", + "description": "String error code indicating what went wrong." + } + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, "/registries/{registryName}/deploymenttemplates/{name}/versions/{version}": { "get": { "operationId": "DeploymentTemplates_Get", @@ -192,11 +278,9 @@ } } } - } - }, - "/registries/{registryName}/deploymenttemplates/{name}/versions/{version}/{type}": { + }, "delete": { - "operationId": "DeploymentTemplates_DeleteGenericAsset", + "operationId": "DeploymentTemplates_DeleteDeploymentTemplate", "description": "Delete a specific version of a deployment template.", "parameters": [ { @@ -209,13 +293,6 @@ "required": true, "type": "string" }, - { - "name": "type", - "in": "path", - "description": "The type of the deployment template.", - "required": true, - "type": "string" - }, { "name": "name", "in": "path", @@ -912,6 +989,28 @@ "maxConcurrentRequestsPerInstance" ] }, + "PagedDeploymentTemplate": { + "type": "object", + "description": "Paged collection of DeploymentTemplate items.", + "properties": { + "value": { + "type": "array", + "description": "The list of Deployment Templates.", + "items": { + "$ref": "#/definitions/DeploymentTemplate" + }, + "x-ms-identifiers": [] + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "PagedIndex": { "type": "object", "description": "Paged collection of IndexVersion items.", diff --git a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/readme.md b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/readme.md index ffa770161e45..66ec6384229d 100644 --- a/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/readme.md +++ b/sdk/ml/azure-ai-ml/swagger/machinelearningservices/resource-manager/readme.md @@ -311,7 +311,7 @@ output-folder: $(python-sdks-folder)/v2025_01_01_preview These settings apply only when `--tag=v2024-04-01-dataplanepreview` is specified on the command line. -```yaml +```yaml $(tag) == 'v2024-04-01-dataplanepreview' input-file: - Microsoft.MachineLearningServices/preview/2024-04-01-dataplanepreview/azure-ai-assets.json output-folder: $(python-sdks-folder)/v2024-04-01-dataplanepreview