From 9ebbcf9aa4c22ca00f6b1cbfac80e3e413b45fad Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 28 Dec 2022 19:38:14 +0000 Subject: [PATCH] CodeGen from PR 22005 in Azure/azure-rest-api-specs Merge 7798a18bbd15234681db50e05e10a5f9a758b5df into 43a9ffbee26e6128d4db6d84115c8ce469cade3d --- .../_meta.json | 4 +- .../machinelearningservices/_configuration.py | 6 +- .../_machine_learning_services_mgmt_client.py | 68 +- .../mgmt/machinelearningservices/_version.py | 2 +- .../aio/_configuration.py | 6 +- .../_machine_learning_services_mgmt_client.py | 69 +- .../aio/operations/__init__.py | 20 + .../_batch_deployments_operations.py | 16 +- .../operations/_batch_endpoints_operations.py | 18 +- .../operations/_code_containers_operations.py | 8 +- .../operations/_code_versions_operations.py | 8 +- .../_component_containers_operations.py | 8 +- .../_component_versions_operations.py | 8 +- .../aio/operations/_compute_operations.py | 338 +- .../operations/_data_containers_operations.py | 8 +- .../operations/_data_versions_operations.py | 8 +- .../aio/operations/_datastores_operations.py | 10 +- .../_environment_containers_operations.py | 8 +- .../_environment_versions_operations.py | 8 +- .../aio/operations/_jobs_operations.py | 22 +- .../operations/_labeling_jobs_operations.py | 1036 ++++ .../_model_containers_operations.py | 8 +- .../operations/_model_versions_operations.py | 8 +- .../_online_deployments_operations.py | 20 +- .../_online_endpoints_operations.py | 24 +- .../aio/operations/_operations.py | 4 +- ...private_endpoint_connections_operations.py | 8 +- .../_private_link_resources_operations.py | 2 +- .../aio/operations/_quotas_operations.py | 4 +- .../aio/operations/_registries_operations.py | 920 ++++ .../_registry_code_containers_operations.py | 630 +++ .../_registry_code_versions_operations.py | 664 +++ ...egistry_component_containers_operations.py | 630 +++ ..._registry_component_versions_operations.py | 664 +++ ...istry_environment_containers_operations.py | 640 +++ ...egistry_environment_versions_operations.py | 669 +++ .../_registry_model_containers_operations.py | 639 +++ .../_registry_model_versions_operations.py | 687 +++ .../aio/operations/_schedules_operations.py | 12 +- .../aio/operations/_usages_operations.py | 2 +- .../_virtual_machine_sizes_operations.py | 2 +- .../_workspace_connections_operations.py | 8 +- .../_workspace_features_operations.py | 2 +- .../aio/operations/_workspaces_operations.py | 40 +- .../models/__init__.py | 180 + ...ine_learning_services_mgmt_client_enums.py | 195 +- .../models/_models_py3.py | 4895 +++++++++++++++-- .../operations/__init__.py | 20 + .../_batch_deployments_operations.py | 36 +- .../operations/_batch_endpoints_operations.py | 42 +- .../operations/_code_containers_operations.py | 24 +- .../operations/_code_versions_operations.py | 24 +- .../_component_containers_operations.py | 24 +- .../_component_versions_operations.py | 24 +- .../operations/_compute_operations.py | 454 +- .../operations/_data_containers_operations.py | 24 +- .../operations/_data_versions_operations.py | 24 +- .../operations/_datastores_operations.py | 30 +- .../_environment_containers_operations.py | 24 +- .../_environment_versions_operations.py | 24 +- .../operations/_jobs_operations.py | 48 +- .../operations/_labeling_jobs_operations.py | 1303 +++++ .../_model_containers_operations.py | 24 +- .../operations/_model_versions_operations.py | 24 +- .../_online_deployments_operations.py | 48 +- .../_online_endpoints_operations.py | 56 +- .../operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 24 +- .../_private_link_resources_operations.py | 6 +- .../operations/_quotas_operations.py | 12 +- .../operations/_registries_operations.py | 1122 ++++ .../_registry_code_containers_operations.py | 768 +++ .../_registry_code_versions_operations.py | 820 +++ ...egistry_component_containers_operations.py | 776 +++ ..._registry_component_versions_operations.py | 826 +++ ...istry_environment_containers_operations.py | 794 +++ ...egistry_environment_versions_operations.py | 849 +++ .../_registry_model_containers_operations.py | 790 +++ .../_registry_model_versions_operations.py | 858 +++ .../operations/_schedules_operations.py | 28 +- .../operations/_usages_operations.py | 6 +- .../_virtual_machine_sizes_operations.py | 6 +- .../_workspace_connections_operations.py | 24 +- .../_workspace_features_operations.py | 6 +- .../operations/_workspaces_operations.py | 96 +- .../generated_samples/aks_compute.py | 2 +- .../generated_samples/aml_compute.py | 2 +- .../generated_samples/basic_aks_compute.py | 2 +- .../generated_samples/basic_aml_compute.py | 2 +- .../basic_data_factory_compute.py | 2 +- .../generated_samples/cancel.py | 2 +- .../generated_samples/compute_instance.py | 2 +- .../compute_instance_minimal.py | 2 +- .../compute_instance_with_schedules.py | 2 +- .../generated_samples/create.py | 2 +- .../generated_samples/create_or_update.py | 2 +- .../create_or_update_system_created.py | 76 + .../create_or_update_user_created.py | 62 + .../generated_samples/delete.py | 2 +- .../generated_samples/diagnose.py | 2 +- .../generated_samples/export_labels.py | 43 + .../generated_samples/get.py | 2 +- .../generated_samples/get_logs.py | 2 +- .../generated_samples/get_system_created.py | 41 + .../generated_samples/get_token.py | 2 +- .../generated_samples/get_user_created.py | 41 + .../generated_samples/kubernetes_compute.py | 2 +- .../generated_samples/list.py | 2 +- .../list_by_resource_group.py | 2 +- .../generated_samples/list_by_subscription.py | 2 +- .../generated_samples/list_keys.py | 2 +- .../generated_samples/list_nodes.py | 2 +- .../list_notebook_access_token.py | 2 +- .../generated_samples/list_secrets.py | 2 +- .../generated_samples/list_skus.py | 2 +- .../list_storage_account_keys.py | 2 +- .../generated_samples/list_system_created.py | 41 + .../generated_samples/list_user_created.py | 41 + .../generated_samples/operations_list.py | 2 +- .../generated_samples/patch.py | 2 +- .../generated_samples/pause.py | 42 + .../generated_samples/prepare.py | 2 +- .../generated_samples/regenerate_keys.py | 2 +- .../generated_samples/restart.py | 2 +- .../generated_samples/resume.py | 42 + .../generated_samples/resync_keys.py | 2 +- .../generated_samples/start.py | 2 +- .../generated_samples/stop.py | 2 +- .../generated_samples/update.py | 2 +- .../update_custom_services.py | 58 + .../update_idle_shutdown_setting.py | 43 + .../update_system_created.py | 48 + .../generated_samples/update_user_created.py | 48 + 133 files changed, 23242 insertions(+), 786 deletions(-) create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_labeling_jobs_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registries_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_code_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_code_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_component_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_component_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_environment_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_environment_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_model_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_model_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_labeling_jobs_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registries_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_code_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_code_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_component_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_component_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_environment_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_environment_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_model_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_model_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update_system_created.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update_user_created.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/export_labels.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_system_created.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_user_created.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_system_created.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_user_created.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/pause.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/resume.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_custom_services.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_idle_shutdown_setting.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_system_created.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_user_created.py diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json b/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json index 216b79b26570..ba5e3ff4ab68 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json @@ -1,11 +1,11 @@ { - "commit": "b32e1896f30e6ea155449cb49719a6286e32b961", + "commit": "49c2c5db0e83b80873b2759d456172dd85d15f3c", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/machinelearningservices/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/machinelearningservices/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/machinelearningservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_configuration.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_configuration.py index 12c43638a412..d0603e787826 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_configuration.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_configuration.py @@ -35,14 +35,14 @@ class MachineLearningServicesMgmtClientConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MachineLearningServicesMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", "2022-10-01") + api_version: Literal["2022-12-01-preview"] = kwargs.pop("api_version", "2022-12-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_machine_learning_services_mgmt_client.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_machine_learning_services_mgmt_client.py index feffb8cfc3ed..c3f13fc73618 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_machine_learning_services_mgmt_client.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_machine_learning_services_mgmt_client.py @@ -29,6 +29,7 @@ EnvironmentContainersOperations, EnvironmentVersionsOperations, JobsOperations, + LabelingJobsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, @@ -37,6 +38,15 @@ PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, + RegistriesOperations, + RegistryCodeContainersOperations, + RegistryCodeVersionsOperations, + RegistryComponentContainersOperations, + RegistryComponentVersionsOperations, + RegistryEnvironmentContainersOperations, + RegistryEnvironmentVersionsOperations, + RegistryModelContainersOperations, + RegistryModelVersionsOperations, SchedulesOperations, UsagesOperations, VirtualMachineSizesOperations, @@ -75,6 +85,30 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :ivar workspace_connections: WorkspaceConnectionsOperations operations :vartype workspace_connections: azure.mgmt.machinelearningservices.operations.WorkspaceConnectionsOperations + :ivar registry_code_containers: RegistryCodeContainersOperations operations + :vartype registry_code_containers: + azure.mgmt.machinelearningservices.operations.RegistryCodeContainersOperations + :ivar registry_code_versions: RegistryCodeVersionsOperations operations + :vartype registry_code_versions: + azure.mgmt.machinelearningservices.operations.RegistryCodeVersionsOperations + :ivar registry_component_containers: RegistryComponentContainersOperations operations + :vartype registry_component_containers: + azure.mgmt.machinelearningservices.operations.RegistryComponentContainersOperations + :ivar registry_component_versions: RegistryComponentVersionsOperations operations + :vartype registry_component_versions: + azure.mgmt.machinelearningservices.operations.RegistryComponentVersionsOperations + :ivar registry_environment_containers: RegistryEnvironmentContainersOperations operations + :vartype registry_environment_containers: + azure.mgmt.machinelearningservices.operations.RegistryEnvironmentContainersOperations + :ivar registry_environment_versions: RegistryEnvironmentVersionsOperations operations + :vartype registry_environment_versions: + azure.mgmt.machinelearningservices.operations.RegistryEnvironmentVersionsOperations + :ivar registry_model_containers: RegistryModelContainersOperations operations + :vartype registry_model_containers: + azure.mgmt.machinelearningservices.operations.RegistryModelContainersOperations + :ivar registry_model_versions: RegistryModelVersionsOperations operations + :vartype registry_model_versions: + azure.mgmt.machinelearningservices.operations.RegistryModelVersionsOperations :ivar batch_endpoints: BatchEndpointsOperations operations :vartype batch_endpoints: azure.mgmt.machinelearningservices.operations.BatchEndpointsOperations @@ -107,6 +141,8 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v azure.mgmt.machinelearningservices.operations.EnvironmentVersionsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.machinelearningservices.operations.JobsOperations + :ivar labeling_jobs: LabelingJobsOperations operations + :vartype labeling_jobs: azure.mgmt.machinelearningservices.operations.LabelingJobsOperations :ivar model_containers: ModelContainersOperations operations :vartype model_containers: azure.mgmt.machinelearningservices.operations.ModelContainersOperations @@ -120,6 +156,8 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v azure.mgmt.machinelearningservices.operations.OnlineDeploymentsOperations :ivar schedules: SchedulesOperations operations :vartype schedules: azure.mgmt.machinelearningservices.operations.SchedulesOperations + :ivar registries: RegistriesOperations operations + :vartype registries: azure.mgmt.machinelearningservices.operations.RegistriesOperations :ivar workspace_features: WorkspaceFeaturesOperations operations :vartype workspace_features: azure.mgmt.machinelearningservices.operations.WorkspaceFeaturesOperations @@ -129,8 +167,8 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -169,6 +207,30 @@ def __init__( self.workspace_connections = WorkspaceConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.registry_code_containers = RegistryCodeContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_code_versions = RegistryCodeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_component_containers = RegistryComponentContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_component_versions = RegistryComponentVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_environment_containers = RegistryEnvironmentContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_environment_versions = RegistryEnvironmentVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_model_containers = RegistryModelContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_model_versions = RegistryModelVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.batch_endpoints = BatchEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) self.batch_deployments = BatchDeploymentsOperations( self._client, self._config, self._serialize, self._deserialize @@ -191,6 +253,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.labeling_jobs = LabelingJobsOperations(self._client, self._config, self._serialize, self._deserialize) self.model_containers = ModelContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -202,6 +265,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) self.workspace_features = WorkspaceFeaturesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_version.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_version.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_configuration.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_configuration.py index 88eada53ff68..a17a6124d97c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_configuration.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_configuration.py @@ -35,14 +35,14 @@ class MachineLearningServicesMgmtClientConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(MachineLearningServicesMgmtClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", "2022-10-01") + api_version: Literal["2022-12-01-preview"] = kwargs.pop("api_version", "2022-12-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_machine_learning_services_mgmt_client.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_machine_learning_services_mgmt_client.py index 4c1c840cfff5..699b6758acf3 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_machine_learning_services_mgmt_client.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/_machine_learning_services_mgmt_client.py @@ -29,6 +29,7 @@ EnvironmentContainersOperations, EnvironmentVersionsOperations, JobsOperations, + LabelingJobsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, @@ -37,6 +38,15 @@ PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, + RegistriesOperations, + RegistryCodeContainersOperations, + RegistryCodeVersionsOperations, + RegistryComponentContainersOperations, + RegistryComponentVersionsOperations, + RegistryEnvironmentContainersOperations, + RegistryEnvironmentVersionsOperations, + RegistryModelContainersOperations, + RegistryModelVersionsOperations, SchedulesOperations, UsagesOperations, VirtualMachineSizesOperations, @@ -75,6 +85,30 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :ivar workspace_connections: WorkspaceConnectionsOperations operations :vartype workspace_connections: azure.mgmt.machinelearningservices.aio.operations.WorkspaceConnectionsOperations + :ivar registry_code_containers: RegistryCodeContainersOperations operations + :vartype registry_code_containers: + azure.mgmt.machinelearningservices.aio.operations.RegistryCodeContainersOperations + :ivar registry_code_versions: RegistryCodeVersionsOperations operations + :vartype registry_code_versions: + azure.mgmt.machinelearningservices.aio.operations.RegistryCodeVersionsOperations + :ivar registry_component_containers: RegistryComponentContainersOperations operations + :vartype registry_component_containers: + azure.mgmt.machinelearningservices.aio.operations.RegistryComponentContainersOperations + :ivar registry_component_versions: RegistryComponentVersionsOperations operations + :vartype registry_component_versions: + azure.mgmt.machinelearningservices.aio.operations.RegistryComponentVersionsOperations + :ivar registry_environment_containers: RegistryEnvironmentContainersOperations operations + :vartype registry_environment_containers: + azure.mgmt.machinelearningservices.aio.operations.RegistryEnvironmentContainersOperations + :ivar registry_environment_versions: RegistryEnvironmentVersionsOperations operations + :vartype registry_environment_versions: + azure.mgmt.machinelearningservices.aio.operations.RegistryEnvironmentVersionsOperations + :ivar registry_model_containers: RegistryModelContainersOperations operations + :vartype registry_model_containers: + azure.mgmt.machinelearningservices.aio.operations.RegistryModelContainersOperations + :ivar registry_model_versions: RegistryModelVersionsOperations operations + :vartype registry_model_versions: + azure.mgmt.machinelearningservices.aio.operations.RegistryModelVersionsOperations :ivar batch_endpoints: BatchEndpointsOperations operations :vartype batch_endpoints: azure.mgmt.machinelearningservices.aio.operations.BatchEndpointsOperations @@ -109,6 +143,9 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v azure.mgmt.machinelearningservices.aio.operations.EnvironmentVersionsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.machinelearningservices.aio.operations.JobsOperations + :ivar labeling_jobs: LabelingJobsOperations operations + :vartype labeling_jobs: + azure.mgmt.machinelearningservices.aio.operations.LabelingJobsOperations :ivar model_containers: ModelContainersOperations operations :vartype model_containers: azure.mgmt.machinelearningservices.aio.operations.ModelContainersOperations @@ -123,6 +160,8 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v azure.mgmt.machinelearningservices.aio.operations.OnlineDeploymentsOperations :ivar schedules: SchedulesOperations operations :vartype schedules: azure.mgmt.machinelearningservices.aio.operations.SchedulesOperations + :ivar registries: RegistriesOperations operations + :vartype registries: azure.mgmt.machinelearningservices.aio.operations.RegistriesOperations :ivar workspace_features: WorkspaceFeaturesOperations operations :vartype workspace_features: azure.mgmt.machinelearningservices.aio.operations.WorkspaceFeaturesOperations @@ -132,8 +171,8 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-12-01-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -172,6 +211,30 @@ def __init__( self.workspace_connections = WorkspaceConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.registry_code_containers = RegistryCodeContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_code_versions = RegistryCodeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_component_containers = RegistryComponentContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_component_versions = RegistryComponentVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_environment_containers = RegistryEnvironmentContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_environment_versions = RegistryEnvironmentVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_model_containers = RegistryModelContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.registry_model_versions = RegistryModelVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.batch_endpoints = BatchEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) self.batch_deployments = BatchDeploymentsOperations( self._client, self._config, self._serialize, self._deserialize @@ -194,6 +257,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.labeling_jobs = LabelingJobsOperations(self._client, self._config, self._serialize, self._deserialize) self.model_containers = ModelContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -205,6 +269,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) self.workspace_features = WorkspaceFeaturesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/__init__.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/__init__.py index 0065485916d9..60c27f074b69 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/__init__.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/__init__.py @@ -15,6 +15,14 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._workspace_connections_operations import WorkspaceConnectionsOperations +from ._registry_code_containers_operations import RegistryCodeContainersOperations +from ._registry_code_versions_operations import RegistryCodeVersionsOperations +from ._registry_component_containers_operations import RegistryComponentContainersOperations +from ._registry_component_versions_operations import RegistryComponentVersionsOperations +from ._registry_environment_containers_operations import RegistryEnvironmentContainersOperations +from ._registry_environment_versions_operations import RegistryEnvironmentVersionsOperations +from ._registry_model_containers_operations import RegistryModelContainersOperations +from ._registry_model_versions_operations import RegistryModelVersionsOperations from ._batch_endpoints_operations import BatchEndpointsOperations from ._batch_deployments_operations import BatchDeploymentsOperations from ._code_containers_operations import CodeContainersOperations @@ -27,11 +35,13 @@ from ._environment_containers_operations import EnvironmentContainersOperations from ._environment_versions_operations import EnvironmentVersionsOperations from ._jobs_operations import JobsOperations +from ._labeling_jobs_operations import LabelingJobsOperations from ._model_containers_operations import ModelContainersOperations from ._model_versions_operations import ModelVersionsOperations from ._online_endpoints_operations import OnlineEndpointsOperations from ._online_deployments_operations import OnlineDeploymentsOperations from ._schedules_operations import SchedulesOperations +from ._registries_operations import RegistriesOperations from ._workspace_features_operations import WorkspaceFeaturesOperations from ._patch import __all__ as _patch_all @@ -48,6 +58,14 @@ "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", "WorkspaceConnectionsOperations", + "RegistryCodeContainersOperations", + "RegistryCodeVersionsOperations", + "RegistryComponentContainersOperations", + "RegistryComponentVersionsOperations", + "RegistryEnvironmentContainersOperations", + "RegistryEnvironmentVersionsOperations", + "RegistryModelContainersOperations", + "RegistryModelVersionsOperations", "BatchEndpointsOperations", "BatchDeploymentsOperations", "CodeContainersOperations", @@ -60,11 +78,13 @@ "EnvironmentContainersOperations", "EnvironmentVersionsOperations", "JobsOperations", + "LabelingJobsOperations", "ModelContainersOperations", "ModelVersionsOperations", "OnlineEndpointsOperations", "OnlineDeploymentsOperations", "SchedulesOperations", + "RegistriesOperations", "WorkspaceFeaturesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_batch_deployments_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_batch_deployments_operations.py index 37950b084904..77824b3a87b3 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_batch_deployments_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_batch_deployments_operations.py @@ -103,7 +103,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.BatchDeploymentTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -195,7 +195,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -272,7 +272,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -349,7 +349,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.BatchDeployment] = kwargs.pop("cls", None) @@ -410,7 +410,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -612,7 +612,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -681,7 +681,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -882,7 +882,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_batch_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_batch_endpoints_operations.py index 848fe6dc7e27..db57e3efcdec 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_batch_endpoints_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_batch_endpoints_operations.py @@ -98,7 +98,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.BatchEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -188,7 +188,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -262,7 +262,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -336,7 +336,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.BatchEndpoint] = kwargs.pop("cls", None) @@ -395,7 +395,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -586,7 +586,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -653,7 +653,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -844,7 +844,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -923,7 +923,7 @@ async def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_code_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_code_containers_operations.py index c69213fa842c..a0605b161274 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_code_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_code_containers_operations.py @@ -87,7 +87,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CodeContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -193,7 +193,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -260,7 +260,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) @@ -408,7 +408,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_code_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_code_versions_operations.py index 473dec5348b9..b515dcd89083 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_code_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_code_versions_operations.py @@ -100,7 +100,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CodeVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -211,7 +211,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -281,7 +281,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) @@ -438,7 +438,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_component_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_component_containers_operations.py index 59f121afb4b1..d6a8f6d39613 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_component_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_component_containers_operations.py @@ -95,7 +95,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComponentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -202,7 +202,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -269,7 +269,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) @@ -417,7 +417,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_component_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_component_versions_operations.py index f217f6650def..1c5dbedb83bc 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_component_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_component_versions_operations.py @@ -104,7 +104,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComponentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -216,7 +216,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -286,7 +286,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) @@ -443,7 +443,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_compute_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_compute_operations.py index 382828847481..bbc88f56a4bf 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_compute_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_compute_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -41,6 +41,8 @@ build_restart_request, build_start_request, build_stop_request, + build_update_custom_services_request, + build_update_idle_shutdown_setting_request, build_update_request, ) @@ -93,7 +95,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PaginatedComputeResourcesList] = kwargs.pop("cls", None) @@ -198,7 +200,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComputeResource] = kwargs.pop("cls", None) @@ -257,7 +259,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -445,7 +447,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -512,7 +514,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -688,7 +690,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -755,7 +757,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -837,7 +839,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -881,6 +883,156 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" } + @overload + async def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: List[_models.CustomService], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Required. + :type custom_services: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: Union[List[_models.CustomService], IO], + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Is either a list type or a IO type. + Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_services, (IO, bytes)): + _content = custom_services + else: + _json = self._serialize.body(custom_services, "[CustomService]") + + request = build_update_custom_services_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_custom_services.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_custom_services.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/customServices" + } + @distributed_trace def list_nodes( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any @@ -904,7 +1056,7 @@ def list_nodes( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AmlComputeNodesInformation] = kwargs.pop("cls", None) @@ -1008,7 +1160,7 @@ async def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComputeSecrets] = kwargs.pop("cls", None) @@ -1062,7 +1214,7 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1126,7 +1278,7 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1183,7 +1335,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1247,7 +1399,7 @@ async def begin_stop( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1304,7 +1456,7 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1368,7 +1520,7 @@ async def begin_restart( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1410,3 +1562,155 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_restart.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart" } + + @overload + async def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: _models.IdleShutdownSetting, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + async def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace_async + async def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.IdleShutdownSetting, IO], + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "IdleShutdownSetting") + + request = build_update_idle_shutdown_setting_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_idle_shutdown_setting.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_idle_shutdown_setting.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateIdleShutdownSetting" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_data_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_data_containers_operations.py index 4c5aca387b8f..ed1552dacf4e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_data_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_data_containers_operations.py @@ -95,7 +95,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -202,7 +202,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -269,7 +269,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataContainer] = kwargs.pop("cls", None) @@ -417,7 +417,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_data_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_data_versions_operations.py index a9f90dd943ed..5d61eaf1c052 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_data_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_data_versions_operations.py @@ -112,7 +112,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataVersionBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -225,7 +225,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -295,7 +295,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataVersionBase] = kwargs.pop("cls", None) @@ -452,7 +452,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_datastores_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_datastores_operations.py index 293c073184e6..f054f830d800 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_datastores_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_datastores_operations.py @@ -110,7 +110,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatastoreResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -222,7 +222,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -287,7 +287,7 @@ async def get(self, resource_group_name: str, workspace_name: str, name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) @@ -444,7 +444,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -532,7 +532,7 @@ async def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatastoreSecrets] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_environment_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_environment_containers_operations.py index 0115c7250a43..ac6492f9f073 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_environment_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_environment_containers_operations.py @@ -96,7 +96,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EnvironmentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -203,7 +203,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -270,7 +270,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) @@ -418,7 +418,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_environment_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_environment_versions_operations.py index 8b4432552f55..c455fd3e04e8 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_environment_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_environment_versions_operations.py @@ -104,7 +104,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EnvironmentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -216,7 +216,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -286,7 +286,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) @@ -443,7 +443,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_jobs_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_jobs_operations.py index e8e3110d7004..7a39518a8d32 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_jobs_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_jobs_operations.py @@ -75,6 +75,8 @@ def list( job_type: Optional[str] = None, tag: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + scheduled: Optional[bool] = None, + schedule_id: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.JobBase"]: """Lists Jobs in the workspace. @@ -95,6 +97,10 @@ def list( :param list_view_type: View type for including/excluding (for example) archived entities. Known values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :param scheduled: Indicator whether the job is scheduled job. Default value is None. + :type scheduled: bool + :param schedule_id: The scheduled id for listing the job triggered from. Default value is None. + :type schedule_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobBase or the result of cls(response) :rtype: @@ -104,7 +110,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.JobBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -128,6 +134,8 @@ def prepare_request(next_link=None): job_type=job_type, tag=tag, list_view_type=list_view_type, + scheduled=scheduled, + schedule_id=schedule_id, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -196,7 +204,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -270,7 +278,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -342,7 +350,7 @@ async def get(self, resource_group_name: str, workspace_name: str, id: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.JobBase] = kwargs.pop("cls", None) @@ -484,7 +492,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -554,7 +562,7 @@ async def _cancel_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -625,7 +633,7 @@ async def begin_cancel( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_labeling_jobs_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_labeling_jobs_operations.py new file mode 100644 index 000000000000..693c18a7547d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_labeling_jobs_operations.py @@ -0,0 +1,1036 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._labeling_jobs_operations import ( + build_create_or_update_request, + build_delete_request, + build_export_labels_request, + build_get_request, + build_list_request, + build_pause_request, + build_resume_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LabelingJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`labeling_jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.LabelingJob"]: + """Lists labeling jobs in the workspace. + + Lists labeling jobs in the workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param top: Number of labeling jobs to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LabelingJob or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.LabelingJobResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("LabelingJobResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> None: + """Delete a labeling job. + + Delete a labeling job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + id: str, + include_job_instructions: bool = False, + include_label_categories: bool = False, + **kwargs: Any + ) -> _models.LabelingJob: + """Gets a labeling job by name/id. + + Gets a labeling job by name/id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param include_job_instructions: Boolean value to indicate whether to include JobInstructions + in response. Default value is False. + :type include_job_instructions: bool + :param include_label_categories: Boolean value to indicate Whether to include LabelCategories + in response. Default value is False. + :type include_label_categories: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LabelingJob or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.LabelingJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.LabelingJob] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + include_job_instructions=include_job_instructions, + include_label_categories=include_label_categories, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.LabelingJob, IO], + **kwargs: Any + ) -> _models.LabelingJob: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabelingJob] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "LabelingJob") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.LabelingJob, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Required. + :type body: ~azure.mgmt.machinelearningservices.models.LabelingJob + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.LabelingJob, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.LabelingJob or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabelingJob] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabelingJob", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + async def _export_labels_initial( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.ExportSummary, IO], + **kwargs: Any + ) -> Optional[_models.ExportSummary]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ExportSummary]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ExportSummary") + + request = build_export_labels_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._export_labels_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ExportSummary", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _export_labels_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels" + } + + @overload + async def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.ExportSummary, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). + + Export labels from a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ExportSummary + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). + + Export labels from a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.ExportSummary, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). + + Export labels from a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ExportSummary or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExportSummary] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._export_labels_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExportSummary", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_export_labels.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels" + } + + @distributed_trace_async + async def pause( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> None: + """Pause a labeling job. + + Pause a labeling job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_pause_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.pause.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + pause.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/pause" + } + + async def _resume_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_resume_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._resume_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _resume_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume" + } + + @distributed_trace_async + async def begin_resume( + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Resume a labeling job (asynchronous). + + Resume a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._resume_initial( # type: ignore + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_resume.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_model_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_model_containers_operations.py index 0f18875a197a..8f188ce138c6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_model_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_model_containers_operations.py @@ -98,7 +98,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ModelContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -206,7 +206,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -273,7 +273,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) @@ -421,7 +421,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_model_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_model_versions_operations.py index 68a4fd3be570..f46465aba2b0 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_model_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_model_versions_operations.py @@ -124,7 +124,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ModelVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -242,7 +242,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -312,7 +312,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) @@ -469,7 +469,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_online_deployments_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_online_deployments_operations.py index f78323104bda..9c2280c30538 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_online_deployments_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_online_deployments_operations.py @@ -105,7 +105,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OnlineDeploymentTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -197,7 +197,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -274,7 +274,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -351,7 +351,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OnlineDeployment] = kwargs.pop("cls", None) @@ -412,7 +412,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -612,7 +612,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -681,7 +681,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -882,7 +882,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1048,7 +1048,7 @@ async def get_logs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1138,7 +1138,7 @@ def list_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SkuResourceArmPaginatedResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_online_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_online_endpoints_operations.py index bb9f50e9e7b8..e2459a8b2baf 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_online_endpoints_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_online_endpoints_operations.py @@ -121,7 +121,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OnlineEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -216,7 +216,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -290,7 +290,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -364,7 +364,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OnlineEndpoint] = kwargs.pop("cls", None) @@ -423,7 +423,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -614,7 +614,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -681,7 +681,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -872,7 +872,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -951,7 +951,7 @@ async def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) @@ -1010,7 +1010,7 @@ async def _regenerate_keys_initial( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1183,7 +1183,7 @@ async def begin_regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1262,7 +1262,7 @@ async def get_token( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EndpointAuthToken] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_operations.py index ab8aec812cd0..d689fbd6f846 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_operations.py @@ -59,7 +59,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.AmlOperation"]: - """Lists all of the available Azure Machine Learning Workspaces REST API operations. + """Lists all of the available Azure Machine Learning Services REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AmlOperation or the result of cls(response) @@ -70,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AmlOperation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AmlOperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_private_endpoint_connections_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_private_endpoint_connections_operations.py index ca1d84b13c3e..11cede428537 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_private_endpoint_connections_operations.py @@ -84,7 +84,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) @@ -188,7 +188,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -333,7 +333,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -415,7 +415,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_private_link_resources_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_private_link_resources_operations.py index 8c30d300602a..08586b6c399d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_private_link_resources_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_private_link_resources_operations.py @@ -82,7 +82,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_quotas_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_quotas_operations.py index b101e920473f..3b6e62435a40 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_quotas_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_quotas_operations.py @@ -130,7 +130,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -195,7 +195,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ResourceQ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListWorkspaceQuotas] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registries_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registries_operations.py new file mode 100644 index 000000000000..564070ab6c68 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registries_operations.py @@ -0,0 +1,920 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registries_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_subscription_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, skip: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Registry"]: + """List registries by subscription. + + List registries by subscription. + + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Registry or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RegistryTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RegistryTrackedResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/registries" + } + + @distributed_trace + def list( + self, resource_group_name: str, skip: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.Registry"]: + """List registries. + + List registries. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Registry or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RegistryTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RegistryTrackedResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete registry. + + Delete registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + @distributed_trace_async + async def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> _models.Registry: + """Get registry. + + Get registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Registry or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Registry + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Registry", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + body: Union[_models.PartialRegistryPartialTrackedResource, IO], + **kwargs: Any + ) -> _models.Registry: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PartialRegistryPartialTrackedResource") + + request = build_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Registry", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Registry", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + body: _models.PartialRegistryPartialTrackedResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Update tags. + + Update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialRegistryPartialTrackedResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Update tags. + + Update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + body: Union[_models.PartialRegistryPartialTrackedResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Update tags. + + Update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialRegistryPartialTrackedResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Registry", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + async def _create_or_update_initial( + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any + ) -> Optional[_models.Registry]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Registry]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "Registry") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("Registry", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Registry", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + body: _models.Registry, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Create or update registry. + + Create or update registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Registry + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Create or update registry. + + Create or update registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Create or update registry. + + Create or update registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.Registry or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Registry or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Registry", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_code_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_code_containers_operations.py new file mode 100644 index 000000000000..b4bdff094f05 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_code_containers_operations.py @@ -0,0 +1,630 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registry_code_containers_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistryCodeContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registry_code_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, skip: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.CodeContainer"]: + """List containers. + + List containers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeContainer or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.CodeContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CodeContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CodeContainerResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, code_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, code_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete container. + + Delete container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, code_name: str, **kwargs: Any + ) -> _models.CodeContainer: + """Get container. + + Get container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CodeContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CodeContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + body: Union[_models.CodeContainer, IO], + **kwargs: Any + ) -> _models.CodeContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CodeContainer") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CodeContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("CodeContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + body: _models.CodeContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CodeContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CodeContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.CodeContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CodeContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param body: Container entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CodeContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.CodeContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + body: Union[_models.CodeContainer, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CodeContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param body: Container entity to create or update. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CodeContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.CodeContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CodeContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_code_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_code_versions_operations.py new file mode 100644 index 000000000000..e71127ae3819 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_code_versions_operations.py @@ -0,0 +1,664 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registry_code_versions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistryCodeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registry_code_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + order_by: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.CodeVersion"]: + """List versions. + + List versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param order_by: Ordering of list. Default value is None. + :type order_by: str + :param top: Maximum number of records to return. Default value is None. + :type top: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeVersion or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.CodeVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CodeVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + subscription_id=self._config.subscription_id, + order_by=order_by, + top=top, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CodeVersionResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, code_name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, code_name: str, version: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete version. + + Delete version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, code_name: str, version: str, **kwargs: Any + ) -> _models.CodeVersion: + """Get version. + + Get version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CodeVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + version: str, + body: Union[_models.CodeVersion, IO], + **kwargs: Any + ) -> _models.CodeVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CodeVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CodeVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("CodeVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + version: str, + body: _models.CodeVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CodeVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CodeVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.CodeVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CodeVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CodeVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.CodeVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + version: str, + body: Union[_models.CodeVersion, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.CodeVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CodeVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.CodeVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CodeVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_component_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_component_containers_operations.py new file mode 100644 index 000000000000..a59227b2d142 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_component_containers_operations.py @@ -0,0 +1,630 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registry_component_containers_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistryComponentContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registry_component_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, skip: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.ComponentContainer"]: + """List containers. + + List containers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComponentContainer or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ComponentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ComponentContainerResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, component_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, component_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete container. + + Delete container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, component_name: str, **kwargs: Any + ) -> _models.ComponentContainer: + """Get container. + + Get container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComponentContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ComponentContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + body: Union[_models.ComponentContainer, IO], + **kwargs: Any + ) -> _models.ComponentContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentContainer") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ComponentContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ComponentContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + body: _models.ComponentContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ComponentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ComponentContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ComponentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param body: Container entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ComponentContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + body: Union[_models.ComponentContainer, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ComponentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param body: Container entity to create or update. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ComponentContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ComponentContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_component_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_component_versions_operations.py new file mode 100644 index 000000000000..8f8040580d64 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_component_versions_operations.py @@ -0,0 +1,664 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registry_component_versions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistryComponentVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registry_component_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + order_by: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ComponentVersion"]: + """List versions. + + List versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param order_by: Ordering of list. Default value is None. + :type order_by: str + :param top: Maximum number of records to return. Default value is None. + :type top: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComponentVersion or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ComponentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + order_by=order_by, + top=top, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ComponentVersionResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, component_name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, component_name: str, version: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete version. + + Delete version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, component_name: str, version: str, **kwargs: Any + ) -> _models.ComponentVersion: + """Get version. + + Get version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComponentVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ComponentVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + version: str, + body: Union[_models.ComponentVersion, IO], + **kwargs: Any + ) -> _models.ComponentVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ComponentVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ComponentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + version: str, + body: _models.ComponentVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ComponentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ComponentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ComponentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ComponentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + version: str, + body: Union[_models.ComponentVersion, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ComponentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ComponentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ComponentVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_environment_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_environment_containers_operations.py new file mode 100644 index 000000000000..a47c8d9811f3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_environment_containers_operations.py @@ -0,0 +1,640 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registry_environment_containers_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistryEnvironmentContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registry_environment_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + skip: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EnvironmentContainer"]: + """List environment containers. + + List environment containers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param list_view_type: View type for including/excluding (for example) archived entities. Known + values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. + :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EnvironmentContainer or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.EnvironmentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + skip=skip, + list_view_type=list_view_type, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EnvironmentContainerResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, environment_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, environment_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete container. + + Delete container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, environment_name: str, **kwargs: Any + ) -> _models.EnvironmentContainer: + """Get container. + + Get container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. This is case-sensitive. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EnvironmentContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + body: Union[_models.EnvironmentContainer, IO], + **kwargs: Any + ) -> _models.EnvironmentContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnvironmentContainer") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + body: _models.EnvironmentContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EnvironmentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EnvironmentContainer or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EnvironmentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param body: Container entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EnvironmentContainer or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + body: Union[_models.EnvironmentContainer, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.EnvironmentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param body: Container entity to create or update. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EnvironmentContainer or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_environment_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_environment_versions_operations.py new file mode 100644 index 000000000000..30c7aeea9e56 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_environment_versions_operations.py @@ -0,0 +1,669 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registry_environment_versions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistryEnvironmentVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registry_environment_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + order_by: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EnvironmentVersion"]: + """List versions. + + List versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. This is case-sensitive. Required. + :type environment_name: str + :param order_by: Ordering of list. Default value is None. + :type order_by: str + :param top: Maximum number of records to return. Default value is None. + :type top: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param list_view_type: View type for including/excluding (for example) archived entities. Known + values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. + :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EnvironmentVersion or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.EnvironmentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + order_by=order_by, + top=top, + skip=skip, + list_view_type=list_view_type, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EnvironmentVersionResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, environment_name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, environment_name: str, version: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete version. + + Delete version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, environment_name: str, version: str, **kwargs: Any + ) -> _models.EnvironmentVersion: + """Get version. + + Get version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. This is case-sensitive. Required. + :type environment_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EnvironmentVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + body: Union[_models.EnvironmentVersion, IO], + **kwargs: Any + ) -> _models.EnvironmentVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnvironmentVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + body: _models.EnvironmentVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EnvironmentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EnvironmentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EnvironmentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EnvironmentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + body: Union[_models.EnvironmentVersion, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.EnvironmentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EnvironmentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_model_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_model_containers_operations.py new file mode 100644 index 000000000000..447d7b78ee51 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_model_containers_operations.py @@ -0,0 +1,639 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registry_model_containers_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistryModelContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registry_model_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + skip: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ModelContainer"]: + """List model containers. + + List model containers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param list_view_type: View type for including/excluding (for example) archived entities. Known + values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. + :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ModelContainer or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.ModelContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ModelContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + skip=skip, + list_view_type=list_view_type, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ModelContainerResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, model_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, model_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete container. + + Delete container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, model_name: str, **kwargs: Any + ) -> _models.ModelContainer: + """Get container. + + Get container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ModelContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ModelContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ModelContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + body: Union[_models.ModelContainer, IO], + **kwargs: Any + ) -> _models.ModelContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ModelContainer") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ModelContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ModelContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + body: _models.ModelContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ModelContainer]: + """Create or update model container. + + Create or update model container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ModelContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ModelContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ModelContainer]: + """Create or update model container. + + Create or update model container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param body: Container entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ModelContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ModelContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + body: Union[_models.ModelContainer, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ModelContainer]: + """Create or update model container. + + Create or update model container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param body: Container entity to create or update. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ModelContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ModelContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ModelContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_model_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_model_versions_operations.py new file mode 100644 index 000000000000..82f3e418ce52 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_model_versions_operations.py @@ -0,0 +1,687 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._registry_model_versions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistryModelVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registry_model_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + skip: Optional[str] = None, + order_by: Optional[str] = None, + top: Optional[int] = None, + version: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ModelVersion"]: + """List versions. + + List versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param order_by: Ordering of list. Default value is None. + :type order_by: str + :param top: Maximum number of records to return. Default value is None. + :type top: int + :param version: Version identifier. Default value is None. + :type version: str + :param description: Model description. Default value is None. + :type description: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param properties: Comma-separated list of property names (and optionally values). Example: + prop1,prop2=value2. Default value is None. + :type properties: str + :param list_view_type: View type for including/excluding (for example) archived entities. Known + values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. + :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ModelVersion or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.ModelVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ModelVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + subscription_id=self._config.subscription_id, + skip=skip, + order_by=order_by, + top=top, + version=version, + description=description, + tags=tags, + properties=properties, + list_view_type=list_view_type, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ModelVersionResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, model_name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, model_name: str, version: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete version. + + Delete version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, model_name: str, version: str, **kwargs: Any + ) -> _models.ModelVersion: + """Get version. + + Get version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ModelVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ModelVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ModelVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: Union[_models.ModelVersion, IO], + **kwargs: Any + ) -> _models.ModelVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ModelVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ModelVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ModelVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: _models.ModelVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ModelVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ModelVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ModelVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ModelVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ModelVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ModelVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: Union[_models.ModelVersion, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.ModelVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ModelVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ModelVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ModelVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_schedules_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_schedules_operations.py index 7e2d8fa6ae15..21f7e63629b6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_schedules_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_schedules_operations.py @@ -97,7 +97,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ScheduleResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -187,7 +187,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -261,7 +261,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -333,7 +333,7 @@ async def get(self, resource_group_name: str, workspace_name: str, name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) @@ -387,7 +387,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -569,7 +569,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_usages_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_usages_operations.py index f7db5ff755cf..1288b3d60947 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_usages_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_usages_operations.py @@ -73,7 +73,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_virtual_machine_sizes_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_virtual_machine_sizes_operations.py index e11949599426..d429c9356746 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_virtual_machine_sizes_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_virtual_machine_sizes_operations.py @@ -77,7 +77,7 @@ async def list(self, location: str, **kwargs: Any) -> _models.VirtualMachineSize _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspace_connections_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspace_connections_operations.py index d849184954e4..b86e2669d77f 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspace_connections_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspace_connections_operations.py @@ -167,7 +167,7 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -248,7 +248,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) @@ -317,7 +317,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -383,7 +383,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspace_features_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspace_features_operations.py index a968302c5446..d009b29a14a4 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspace_features_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspace_features_operations.py @@ -77,7 +77,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListAmlUserFeatureResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspaces_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspaces_operations.py index 5c6cf54fea4d..0e124bd81482 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspaces_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_workspaces_operations.py @@ -100,7 +100,7 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) @@ -153,7 +153,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -316,7 +316,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -377,7 +377,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -436,7 +436,7 @@ async def begin_delete(self, resource_group_name: str, workspace_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -496,7 +496,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -661,7 +661,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -728,7 +728,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) @@ -820,7 +820,7 @@ async def _diagnose_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -999,7 +999,7 @@ async def begin_diagnose( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1076,7 +1076,7 @@ async def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListWorkspaceKeysResult] = kwargs.pop("cls", None) @@ -1129,7 +1129,7 @@ async def _resync_keys_initial( # pylint: disable=inconsistent-return-statement _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1191,7 +1191,7 @@ async def begin_resync_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1248,7 +1248,7 @@ def list_by_subscription(self, skip: Optional[str] = None, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) @@ -1348,7 +1348,7 @@ async def list_notebook_access_token( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.NotebookAccessTokenResult] = kwargs.pop("cls", None) @@ -1401,7 +1401,7 @@ async def _prepare_notebook_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.NotebookResourceInfo]] = kwargs.pop("cls", None) @@ -1470,7 +1470,7 @@ async def begin_prepare_notebook( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.NotebookResourceInfo] = kwargs.pop("cls", None) @@ -1543,7 +1543,7 @@ async def list_storage_account_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListStorageAccountKeysResult] = kwargs.pop("cls", None) @@ -1609,7 +1609,7 @@ async def list_notebook_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListNotebookKeysResult] = kwargs.pop("cls", None) @@ -1679,7 +1679,7 @@ async def list_outbound_network_dependencies_endpoints( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ExternalFQDNResponse] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/__init__.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/__init__.py index 72bfcc9bc3c2..6719480a648c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/__init__.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/__init__.py @@ -9,11 +9,14 @@ from ._models_py3 import AKS from ._models_py3 import AKSSchema from ._models_py3 import AKSSchemaProperties +from ._models_py3 import AccessKeyAuthTypeWorkspaceConnectionProperties from ._models_py3 import AccountKeyDatastoreCredentials from ._models_py3 import AccountKeyDatastoreSecrets +from ._models_py3 import AcrDetails from ._models_py3 import AksComputeSecrets from ._models_py3 import AksComputeSecretsProperties from ._models_py3 import AksNetworkingConfiguration +from ._models_py3 import AllNodes from ._models_py3 import AmlCompute from ._models_py3 import AmlComputeNodeInformation from ._models_py3 import AmlComputeNodesInformation @@ -24,6 +27,7 @@ from ._models_py3 import AmlOperationListResult from ._models_py3 import AmlToken from ._models_py3 import AmlUserFeature +from ._models_py3 import ArmResourceId from ._models_py3 import AssetBase from ._models_py3 import AssetContainer from ._models_py3 import AssetJobInput @@ -39,9 +43,11 @@ from ._models_py3 import AutoSeasonality from ._models_py3 import AutoTargetLags from ._models_py3 import AutoTargetRollingWindowSize +from ._models_py3 import AutologgerSettings from ._models_py3 import AzureBlobDatastore from ._models_py3 import AzureDataLakeGen1Datastore from ._models_py3 import AzureDataLakeGen2Datastore +from ._models_py3 import AzureDatastore from ._models_py3 import AzureFileDatastore from ._models_py3 import BanditPolicy from ._models_py3 import BatchDeployment @@ -53,12 +59,14 @@ from ._models_py3 import BatchEndpointTrackedResourceArmPaginatedResult from ._models_py3 import BatchRetrySettings from ._models_py3 import BayesianSamplingAlgorithm +from ._models_py3 import BindOptions from ._models_py3 import BuildContext from ._models_py3 import CertificateDatastoreCredentials from ._models_py3 import CertificateDatastoreSecrets from ._models_py3 import Classification from ._models_py3 import ClassificationTrainingSettings from ._models_py3 import ClusterUpdateParameters +from ._models_py3 import CocoExportSummary from ._models_py3 import CodeConfiguration from ._models_py3 import CodeContainer from ._models_py3 import CodeContainerProperties @@ -78,6 +86,7 @@ from ._models_py3 import Compute from ._models_py3 import ComputeInstance from ._models_py3 import ComputeInstanceApplication +from ._models_py3 import ComputeInstanceAutologgerSettings from ._models_py3 import ComputeInstanceConnectivityEndpoints from ._models_py3 import ComputeInstanceContainer from ._models_py3 import ComputeInstanceCreatedBy @@ -98,11 +107,13 @@ from ._models_py3 import ContainerResourceSettings from ._models_py3 import CosmosDbSettings from ._models_py3 import CronTrigger +from ._models_py3 import CsvExportSummary from ._models_py3 import CustomForecastHorizon from ._models_py3 import CustomModelJobInput from ._models_py3 import CustomModelJobOutput from ._models_py3 import CustomNCrossValidations from ._models_py3 import CustomSeasonality +from ._models_py3 import CustomService from ._models_py3 import CustomTargetLags from ._models_py3 import CustomTargetRollingWindowSize from ._models_py3 import DataContainer @@ -121,6 +132,7 @@ from ._models_py3 import DatabricksComputeSecretsProperties from ._models_py3 import DatabricksProperties from ._models_py3 import DatabricksSchema +from ._models_py3 import DatasetExportSummary from ._models_py3 import Datastore from ._models_py3 import DatastoreCredentials from ._models_py3 import DatastoreProperties @@ -136,9 +148,13 @@ from ._models_py3 import DiagnoseResult from ._models_py3 import DiagnoseWorkspaceParameters from ._models_py3 import DistributionConfiguration +from ._models_py3 import Docker from ._models_py3 import EarlyTerminationPolicy from ._models_py3 import EncryptionKeyVaultProperties +from ._models_py3 import EncryptionKeyVaultUpdateProperties from ._models_py3 import EncryptionProperty +from ._models_py3 import EncryptionUpdateProperties +from ._models_py3 import Endpoint from ._models_py3 import EndpointAuthKeys from ._models_py3 import EndpointAuthToken from ._models_py3 import EndpointDeploymentPropertiesBase @@ -147,6 +163,7 @@ from ._models_py3 import EnvironmentContainer from ._models_py3 import EnvironmentContainerProperties from ._models_py3 import EnvironmentContainerResourceArmPaginatedResult +from ._models_py3 import EnvironmentVariable from ._models_py3 import EnvironmentVersion from ._models_py3 import EnvironmentVersionProperties from ._models_py3 import EnvironmentVersionResourceArmPaginatedResult @@ -155,6 +172,7 @@ from ._models_py3 import ErrorResponse from ._models_py3 import EstimatedVMPrice from ._models_py3 import EstimatedVMPrices +from ._models_py3 import ExportSummary from ._models_py3 import ExternalFQDNResponse from ._models_py3 import FQDNEndpoint from ._models_py3 import FQDNEndpointDetail @@ -170,14 +188,18 @@ from ._models_py3 import HDInsight from ._models_py3 import HDInsightProperties from ._models_py3 import HDInsightSchema +from ._models_py3 import HdfsDatastore from ._models_py3 import IdAssetReference from ._models_py3 import IdentityConfiguration from ._models_py3 import IdentityForCmk +from ._models_py3 import IdleShutdownSetting +from ._models_py3 import Image from ._models_py3 import ImageClassification from ._models_py3 import ImageClassificationBase from ._models_py3 import ImageClassificationMultilabel from ._models_py3 import ImageInstanceSegmentation from ._models_py3 import ImageLimitSettings +from ._models_py3 import ImageMetadata from ._models_py3 import ImageModelDistributionSettings from ._models_py3 import ImageModelDistributionSettingsClassification from ._models_py3 import ImageModelDistributionSettingsObjectDetection @@ -200,10 +222,25 @@ from ._models_py3 import JobResourceConfiguration from ._models_py3 import JobScheduleAction from ._models_py3 import JobService +from ._models_py3 import KerberosCredentials +from ._models_py3 import KerberosKeytabCredentials +from ._models_py3 import KerberosKeytabSecrets +from ._models_py3 import KerberosPasswordCredentials +from ._models_py3 import KerberosPasswordSecrets from ._models_py3 import Kubernetes from ._models_py3 import KubernetesOnlineDeployment from ._models_py3 import KubernetesProperties from ._models_py3 import KubernetesSchema +from ._models_py3 import LabelCategory +from ._models_py3 import LabelClass +from ._models_py3 import LabelingDataConfiguration +from ._models_py3 import LabelingJob +from ._models_py3 import LabelingJobImageProperties +from ._models_py3 import LabelingJobInstructions +from ._models_py3 import LabelingJobMediaProperties +from ._models_py3 import LabelingJobProperties +from ._models_py3 import LabelingJobResourceArmPaginatedResult +from ._models_py3 import LabelingJobTextProperties from ._models_py3 import ListAmlUserFeatureResult from ._models_py3 import ListNotebookKeysResult from ._models_py3 import ListStorageAccountKeysResult @@ -211,6 +248,9 @@ from ._models_py3 import ListWorkspaceKeysResult from ._models_py3 import ListWorkspaceQuotas from ._models_py3 import LiteralJobInput +from ._models_py3 import MLAssistConfiguration +from ._models_py3 import MLAssistConfigurationDisabled +from ._models_py3 import MLAssistConfigurationEnabled from ._models_py3 import MLFlowModelJobInput from ._models_py3 import MLFlowModelJobOutput from ._models_py3 import MLTableData @@ -229,10 +269,14 @@ from ._models_py3 import ModelVersionResourceArmPaginatedResult from ._models_py3 import Mpi from ._models_py3 import NCrossValidations +from ._models_py3 import NlpFixedParameters +from ._models_py3 import NlpParameterSubspace +from ._models_py3 import NlpSweepSettings from ._models_py3 import NlpVertical from ._models_py3 import NlpVerticalFeaturizationSettings from ._models_py3 import NlpVerticalLimitSettings from ._models_py3 import NodeStateCounts +from ._models_py3 import Nodes from ._models_py3 import NoneAuthTypeWorkspaceConnectionProperties from ._models_py3 import NoneDatastoreCredentials from ._models_py3 import NotebookAccessTokenResult @@ -256,6 +300,7 @@ from ._models_py3 import PartialMinimalTrackedResource from ._models_py3 import PartialMinimalTrackedResourceWithIdentity from ._models_py3 import PartialMinimalTrackedResourceWithSku +from ._models_py3 import PartialRegistryPartialTrackedResource from ._models_py3 import PartialSku from ._models_py3 import Password from ._models_py3 import PersonalComputeInstanceSettings @@ -267,6 +312,7 @@ from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProbeSettings +from ._models_py3 import ProgressMetrics from ._models_py3 import PyTorch from ._models_py3 import QuotaBaseProperties from ._models_py3 import QuotaUpdateParameters @@ -274,7 +320,11 @@ from ._models_py3 import RecurrenceSchedule from ._models_py3 import RecurrenceTrigger from ._models_py3 import RegenerateEndpointKeysRequest +from ._models_py3 import Registry from ._models_py3 import RegistryListCredentialsResult +from ._models_py3 import RegistryProperties +from ._models_py3 import RegistryRegionArmDetails +from ._models_py3 import RegistryTrackedResourceArmPaginatedResult from ._models_py3 import Regression from ._models_py3 import RegressionTrainingSettings from ._models_py3 import Resource @@ -299,6 +349,7 @@ from ._models_py3 import ScriptsToExecute from ._models_py3 import Seasonality from ._models_py3 import ServiceManagedResourcesSettings +from ._models_py3 import ServicePrincipalAuthTypeWorkspaceConnectionProperties from ._models_py3 import ServicePrincipalDatastoreCredentials from ._models_py3 import ServicePrincipalDatastoreSecrets from ._models_py3 import SetupScripts @@ -308,14 +359,26 @@ from ._models_py3 import SkuResource from ._models_py3 import SkuResourceArmPaginatedResult from ._models_py3 import SkuSetting +from ._models_py3 import SparkJob +from ._models_py3 import SparkJobEntry +from ._models_py3 import SparkJobPythonEntry +from ._models_py3 import SparkJobScalaEntry +from ._models_py3 import SparkResourceConfiguration from ._models_py3 import SslConfiguration from ._models_py3 import StackEnsembleSettings +from ._models_py3 import StatusMessage +from ._models_py3 import StorageAccountDetails from ._models_py3 import SweepJob from ._models_py3 import SweepJobLimits from ._models_py3 import SynapseSpark from ._models_py3 import SynapseSparkProperties +from ._models_py3 import SystemCreatedAcrAccount +from ._models_py3 import SystemCreatedStorageAccount from ._models_py3 import SystemData from ._models_py3 import SystemService +from ._models_py3 import TableFixedParameters +from ._models_py3 import TableParameterSubspace +from ._models_py3 import TableSweepSettings from ._models_py3 import TableVertical from ._models_py3 import TableVerticalFeaturizationSettings from ._models_py3 import TableVerticalLimitSettings @@ -326,6 +389,7 @@ from ._models_py3 import TextClassification from ._models_py3 import TextClassificationMultilabel from ._models_py3 import TextNer +from ._models_py3 import TmpfsOptions from ._models_py3 import TrackedResource from ._models_py3 import TrainingSettings from ._models_py3 import TrialComponent @@ -345,6 +409,8 @@ from ._models_py3 import UsageName from ._models_py3 import UserAccountCredentials from ._models_py3 import UserAssignedIdentity +from ._models_py3 import UserCreatedAcrAccount +from ._models_py3 import UserCreatedStorageAccount from ._models_py3 import UserIdentity from ._models_py3 import UsernamePasswordAuthTypeWorkspaceConnectionProperties from ._models_py3 import VirtualMachine @@ -356,12 +422,16 @@ from ._models_py3 import VirtualMachineSize from ._models_py3 import VirtualMachineSizeListResult from ._models_py3 import VirtualMachineSshCredentials +from ._models_py3 import VolumeDefinition +from ._models_py3 import VolumeOptions from ._models_py3 import Workspace +from ._models_py3 import WorkspaceConnectionAccessKey from ._models_py3 import WorkspaceConnectionManagedIdentity from ._models_py3 import WorkspaceConnectionPersonalAccessToken from ._models_py3 import WorkspaceConnectionPropertiesV2 from ._models_py3 import WorkspaceConnectionPropertiesV2BasicResource from ._models_py3 import WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult +from ._models_py3 import WorkspaceConnectionServicePrincipal from ._models_py3 import WorkspaceConnectionSharedAccessSignature from ._models_py3 import WorkspaceConnectionUsernamePassword from ._models_py3 import WorkspaceListResult @@ -369,6 +439,7 @@ from ._machine_learning_services_mgmt_client_enums import AllocationState from ._machine_learning_services_mgmt_client_enums import ApplicationSharingPolicy +from ._machine_learning_services_mgmt_client_enums import AssetProvisioningState from ._machine_learning_services_mgmt_client_enums import AutoRebuildSetting from ._machine_learning_services_mgmt_client_enums import Autosave from ._machine_learning_services_mgmt_client_enums import BatchLoggingLevel @@ -401,6 +472,8 @@ from ._machine_learning_services_mgmt_client_enums import EndpointComputeType from ._machine_learning_services_mgmt_client_enums import EndpointProvisioningState from ._machine_learning_services_mgmt_client_enums import EnvironmentType +from ._machine_learning_services_mgmt_client_enums import EnvironmentVariableType +from ._machine_learning_services_mgmt_client_enums import ExportFormatType from ._machine_learning_services_mgmt_client_enums import FeatureLags from ._machine_learning_services_mgmt_client_enums import FeaturizationMode from ._machine_learning_services_mgmt_client_enums import ForecastHorizonMode @@ -408,11 +481,15 @@ from ._machine_learning_services_mgmt_client_enums import ForecastingPrimaryMetrics from ._machine_learning_services_mgmt_client_enums import Goal from ._machine_learning_services_mgmt_client_enums import IdentityConfigurationType +from ._machine_learning_services_mgmt_client_enums import ImageAnnotationType +from ._machine_learning_services_mgmt_client_enums import ImageType +from ._machine_learning_services_mgmt_client_enums import IncrementalDataRefresh from ._machine_learning_services_mgmt_client_enums import InputDeliveryMode from ._machine_learning_services_mgmt_client_enums import InstanceSegmentationPrimaryMetrics from ._machine_learning_services_mgmt_client_enums import JobInputType from ._machine_learning_services_mgmt_client_enums import JobLimitsType from ._machine_learning_services_mgmt_client_enums import JobOutputType +from ._machine_learning_services_mgmt_client_enums import JobProvisioningState from ._machine_learning_services_mgmt_client_enums import JobStatus from ._machine_learning_services_mgmt_client_enums import JobType from ._machine_learning_services_mgmt_client_enums import KeyType @@ -420,13 +497,20 @@ from ._machine_learning_services_mgmt_client_enums import ListViewType from ._machine_learning_services_mgmt_client_enums import LoadBalancerType from ._machine_learning_services_mgmt_client_enums import LogVerbosity +from ._machine_learning_services_mgmt_client_enums import MLAssistConfigurationType +from ._machine_learning_services_mgmt_client_enums import MLFlowAutologgerState from ._machine_learning_services_mgmt_client_enums import ManagedServiceIdentityType +from ._machine_learning_services_mgmt_client_enums import MediaType +from ._machine_learning_services_mgmt_client_enums import MlflowAutologger from ._machine_learning_services_mgmt_client_enums import ModelSize from ._machine_learning_services_mgmt_client_enums import MountAction from ._machine_learning_services_mgmt_client_enums import MountState +from ._machine_learning_services_mgmt_client_enums import MultiSelect from ._machine_learning_services_mgmt_client_enums import NCrossValidationsMode from ._machine_learning_services_mgmt_client_enums import Network +from ._machine_learning_services_mgmt_client_enums import NlpLearningRateScheduler from ._machine_learning_services_mgmt_client_enums import NodeState +from ._machine_learning_services_mgmt_client_enums import NodesValueType from ._machine_learning_services_mgmt_client_enums import ObjectDetectionPrimaryMetrics from ._machine_learning_services_mgmt_client_enums import OperatingSystemType from ._machine_learning_services_mgmt_client_enums import OperationName @@ -437,6 +521,7 @@ from ._machine_learning_services_mgmt_client_enums import OutputDeliveryMode from ._machine_learning_services_mgmt_client_enums import PrivateEndpointConnectionProvisioningState from ._machine_learning_services_mgmt_client_enums import PrivateEndpointServiceConnectionStatus +from ._machine_learning_services_mgmt_client_enums import Protocol from ._machine_learning_services_mgmt_client_enums import ProvisioningState from ._machine_learning_services_mgmt_client_enums import ProvisioningStatus from ._machine_learning_services_mgmt_client_enums import PublicNetworkAccess @@ -462,16 +547,20 @@ from ._machine_learning_services_mgmt_client_enums import SkuScaleType from ._machine_learning_services_mgmt_client_enums import SkuTier from ._machine_learning_services_mgmt_client_enums import SourceType +from ._machine_learning_services_mgmt_client_enums import SparkJobEntryType from ._machine_learning_services_mgmt_client_enums import SshPublicAccess from ._machine_learning_services_mgmt_client_enums import SslConfigStatus from ._machine_learning_services_mgmt_client_enums import StackMetaLearnerType from ._machine_learning_services_mgmt_client_enums import Status +from ._machine_learning_services_mgmt_client_enums import StatusMessageLevel from ._machine_learning_services_mgmt_client_enums import StochasticOptimizer from ._machine_learning_services_mgmt_client_enums import StorageAccountType from ._machine_learning_services_mgmt_client_enums import TargetAggregationFunction from ._machine_learning_services_mgmt_client_enums import TargetLagsMode from ._machine_learning_services_mgmt_client_enums import TargetRollingWindowSizeMode from ._machine_learning_services_mgmt_client_enums import TaskType +from ._machine_learning_services_mgmt_client_enums import TextAnnotationType +from ._machine_learning_services_mgmt_client_enums import TrainingMode from ._machine_learning_services_mgmt_client_enums import TriggerType from ._machine_learning_services_mgmt_client_enums import UnderlyingResourceAction from ._machine_learning_services_mgmt_client_enums import UnitOfMeasure @@ -482,6 +571,7 @@ from ._machine_learning_services_mgmt_client_enums import ValidationMetricType from ._machine_learning_services_mgmt_client_enums import ValueFormat from ._machine_learning_services_mgmt_client_enums import VmPriority +from ._machine_learning_services_mgmt_client_enums import VolumeDefinitionType from ._machine_learning_services_mgmt_client_enums import WeekDay from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -491,11 +581,14 @@ "AKS", "AKSSchema", "AKSSchemaProperties", + "AccessKeyAuthTypeWorkspaceConnectionProperties", "AccountKeyDatastoreCredentials", "AccountKeyDatastoreSecrets", + "AcrDetails", "AksComputeSecrets", "AksComputeSecretsProperties", "AksNetworkingConfiguration", + "AllNodes", "AmlCompute", "AmlComputeNodeInformation", "AmlComputeNodesInformation", @@ -506,6 +599,7 @@ "AmlOperationListResult", "AmlToken", "AmlUserFeature", + "ArmResourceId", "AssetBase", "AssetContainer", "AssetJobInput", @@ -521,9 +615,11 @@ "AutoSeasonality", "AutoTargetLags", "AutoTargetRollingWindowSize", + "AutologgerSettings", "AzureBlobDatastore", "AzureDataLakeGen1Datastore", "AzureDataLakeGen2Datastore", + "AzureDatastore", "AzureFileDatastore", "BanditPolicy", "BatchDeployment", @@ -535,12 +631,14 @@ "BatchEndpointTrackedResourceArmPaginatedResult", "BatchRetrySettings", "BayesianSamplingAlgorithm", + "BindOptions", "BuildContext", "CertificateDatastoreCredentials", "CertificateDatastoreSecrets", "Classification", "ClassificationTrainingSettings", "ClusterUpdateParameters", + "CocoExportSummary", "CodeConfiguration", "CodeContainer", "CodeContainerProperties", @@ -560,6 +658,7 @@ "Compute", "ComputeInstance", "ComputeInstanceApplication", + "ComputeInstanceAutologgerSettings", "ComputeInstanceConnectivityEndpoints", "ComputeInstanceContainer", "ComputeInstanceCreatedBy", @@ -580,11 +679,13 @@ "ContainerResourceSettings", "CosmosDbSettings", "CronTrigger", + "CsvExportSummary", "CustomForecastHorizon", "CustomModelJobInput", "CustomModelJobOutput", "CustomNCrossValidations", "CustomSeasonality", + "CustomService", "CustomTargetLags", "CustomTargetRollingWindowSize", "DataContainer", @@ -603,6 +704,7 @@ "DatabricksComputeSecretsProperties", "DatabricksProperties", "DatabricksSchema", + "DatasetExportSummary", "Datastore", "DatastoreCredentials", "DatastoreProperties", @@ -618,9 +720,13 @@ "DiagnoseResult", "DiagnoseWorkspaceParameters", "DistributionConfiguration", + "Docker", "EarlyTerminationPolicy", "EncryptionKeyVaultProperties", + "EncryptionKeyVaultUpdateProperties", "EncryptionProperty", + "EncryptionUpdateProperties", + "Endpoint", "EndpointAuthKeys", "EndpointAuthToken", "EndpointDeploymentPropertiesBase", @@ -629,6 +735,7 @@ "EnvironmentContainer", "EnvironmentContainerProperties", "EnvironmentContainerResourceArmPaginatedResult", + "EnvironmentVariable", "EnvironmentVersion", "EnvironmentVersionProperties", "EnvironmentVersionResourceArmPaginatedResult", @@ -637,6 +744,7 @@ "ErrorResponse", "EstimatedVMPrice", "EstimatedVMPrices", + "ExportSummary", "ExternalFQDNResponse", "FQDNEndpoint", "FQDNEndpointDetail", @@ -652,14 +760,18 @@ "HDInsight", "HDInsightProperties", "HDInsightSchema", + "HdfsDatastore", "IdAssetReference", "IdentityConfiguration", "IdentityForCmk", + "IdleShutdownSetting", + "Image", "ImageClassification", "ImageClassificationBase", "ImageClassificationMultilabel", "ImageInstanceSegmentation", "ImageLimitSettings", + "ImageMetadata", "ImageModelDistributionSettings", "ImageModelDistributionSettingsClassification", "ImageModelDistributionSettingsObjectDetection", @@ -682,10 +794,25 @@ "JobResourceConfiguration", "JobScheduleAction", "JobService", + "KerberosCredentials", + "KerberosKeytabCredentials", + "KerberosKeytabSecrets", + "KerberosPasswordCredentials", + "KerberosPasswordSecrets", "Kubernetes", "KubernetesOnlineDeployment", "KubernetesProperties", "KubernetesSchema", + "LabelCategory", + "LabelClass", + "LabelingDataConfiguration", + "LabelingJob", + "LabelingJobImageProperties", + "LabelingJobInstructions", + "LabelingJobMediaProperties", + "LabelingJobProperties", + "LabelingJobResourceArmPaginatedResult", + "LabelingJobTextProperties", "ListAmlUserFeatureResult", "ListNotebookKeysResult", "ListStorageAccountKeysResult", @@ -693,6 +820,9 @@ "ListWorkspaceKeysResult", "ListWorkspaceQuotas", "LiteralJobInput", + "MLAssistConfiguration", + "MLAssistConfigurationDisabled", + "MLAssistConfigurationEnabled", "MLFlowModelJobInput", "MLFlowModelJobOutput", "MLTableData", @@ -711,10 +841,14 @@ "ModelVersionResourceArmPaginatedResult", "Mpi", "NCrossValidations", + "NlpFixedParameters", + "NlpParameterSubspace", + "NlpSweepSettings", "NlpVertical", "NlpVerticalFeaturizationSettings", "NlpVerticalLimitSettings", "NodeStateCounts", + "Nodes", "NoneAuthTypeWorkspaceConnectionProperties", "NoneDatastoreCredentials", "NotebookAccessTokenResult", @@ -738,6 +872,7 @@ "PartialMinimalTrackedResource", "PartialMinimalTrackedResourceWithIdentity", "PartialMinimalTrackedResourceWithSku", + "PartialRegistryPartialTrackedResource", "PartialSku", "Password", "PersonalComputeInstanceSettings", @@ -749,6 +884,7 @@ "PrivateLinkResourceListResult", "PrivateLinkServiceConnectionState", "ProbeSettings", + "ProgressMetrics", "PyTorch", "QuotaBaseProperties", "QuotaUpdateParameters", @@ -756,7 +892,11 @@ "RecurrenceSchedule", "RecurrenceTrigger", "RegenerateEndpointKeysRequest", + "Registry", "RegistryListCredentialsResult", + "RegistryProperties", + "RegistryRegionArmDetails", + "RegistryTrackedResourceArmPaginatedResult", "Regression", "RegressionTrainingSettings", "Resource", @@ -781,6 +921,7 @@ "ScriptsToExecute", "Seasonality", "ServiceManagedResourcesSettings", + "ServicePrincipalAuthTypeWorkspaceConnectionProperties", "ServicePrincipalDatastoreCredentials", "ServicePrincipalDatastoreSecrets", "SetupScripts", @@ -790,14 +931,26 @@ "SkuResource", "SkuResourceArmPaginatedResult", "SkuSetting", + "SparkJob", + "SparkJobEntry", + "SparkJobPythonEntry", + "SparkJobScalaEntry", + "SparkResourceConfiguration", "SslConfiguration", "StackEnsembleSettings", + "StatusMessage", + "StorageAccountDetails", "SweepJob", "SweepJobLimits", "SynapseSpark", "SynapseSparkProperties", + "SystemCreatedAcrAccount", + "SystemCreatedStorageAccount", "SystemData", "SystemService", + "TableFixedParameters", + "TableParameterSubspace", + "TableSweepSettings", "TableVertical", "TableVerticalFeaturizationSettings", "TableVerticalLimitSettings", @@ -808,6 +961,7 @@ "TextClassification", "TextClassificationMultilabel", "TextNer", + "TmpfsOptions", "TrackedResource", "TrainingSettings", "TrialComponent", @@ -827,6 +981,8 @@ "UsageName", "UserAccountCredentials", "UserAssignedIdentity", + "UserCreatedAcrAccount", + "UserCreatedStorageAccount", "UserIdentity", "UsernamePasswordAuthTypeWorkspaceConnectionProperties", "VirtualMachine", @@ -838,18 +994,23 @@ "VirtualMachineSize", "VirtualMachineSizeListResult", "VirtualMachineSshCredentials", + "VolumeDefinition", + "VolumeOptions", "Workspace", + "WorkspaceConnectionAccessKey", "WorkspaceConnectionManagedIdentity", "WorkspaceConnectionPersonalAccessToken", "WorkspaceConnectionPropertiesV2", "WorkspaceConnectionPropertiesV2BasicResource", "WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", + "WorkspaceConnectionServicePrincipal", "WorkspaceConnectionSharedAccessSignature", "WorkspaceConnectionUsernamePassword", "WorkspaceListResult", "WorkspaceUpdateParameters", "AllocationState", "ApplicationSharingPolicy", + "AssetProvisioningState", "AutoRebuildSetting", "Autosave", "BatchLoggingLevel", @@ -882,6 +1043,8 @@ "EndpointComputeType", "EndpointProvisioningState", "EnvironmentType", + "EnvironmentVariableType", + "ExportFormatType", "FeatureLags", "FeaturizationMode", "ForecastHorizonMode", @@ -889,11 +1052,15 @@ "ForecastingPrimaryMetrics", "Goal", "IdentityConfigurationType", + "ImageAnnotationType", + "ImageType", + "IncrementalDataRefresh", "InputDeliveryMode", "InstanceSegmentationPrimaryMetrics", "JobInputType", "JobLimitsType", "JobOutputType", + "JobProvisioningState", "JobStatus", "JobType", "KeyType", @@ -901,13 +1068,20 @@ "ListViewType", "LoadBalancerType", "LogVerbosity", + "MLAssistConfigurationType", + "MLFlowAutologgerState", "ManagedServiceIdentityType", + "MediaType", + "MlflowAutologger", "ModelSize", "MountAction", "MountState", + "MultiSelect", "NCrossValidationsMode", "Network", + "NlpLearningRateScheduler", "NodeState", + "NodesValueType", "ObjectDetectionPrimaryMetrics", "OperatingSystemType", "OperationName", @@ -918,6 +1092,7 @@ "OutputDeliveryMode", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", + "Protocol", "ProvisioningState", "ProvisioningStatus", "PublicNetworkAccess", @@ -943,16 +1118,20 @@ "SkuScaleType", "SkuTier", "SourceType", + "SparkJobEntryType", "SshPublicAccess", "SslConfigStatus", "StackMetaLearnerType", "Status", + "StatusMessageLevel", "StochasticOptimizer", "StorageAccountType", "TargetAggregationFunction", "TargetLagsMode", "TargetRollingWindowSizeMode", "TaskType", + "TextAnnotationType", + "TrainingMode", "TriggerType", "UnderlyingResourceAction", "UnitOfMeasure", @@ -963,6 +1142,7 @@ "ValidationMetricType", "ValueFormat", "VmPriority", + "VolumeDefinitionType", "WeekDay", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_machine_learning_services_mgmt_client_enums.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_machine_learning_services_mgmt_client_enums.py index 640b9b12a650..2ab0df1532bd 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_machine_learning_services_mgmt_client_enums.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_machine_learning_services_mgmt_client_enums.py @@ -32,6 +32,17 @@ class ApplicationSharingPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): SHARED = "Shared" +class AssetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of registry asset.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + class AutoRebuildSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutoRebuild setting for the derived image.""" @@ -249,7 +260,7 @@ class ComputeInstanceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ComputePowerAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The compute power action.""" + """[Required] The compute power action.""" START = "Start" STOP = "Stop" @@ -278,6 +289,8 @@ class ConnectionAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USERNAME_PASSWORD = "UsernamePassword" NONE = "None" SAS = "SAS" + SERVICE_PRINCIPAL = "ServicePrincipal" + ACCESS_KEY = "AccessKey" class ConnectionCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -286,13 +299,22 @@ class ConnectionCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): PYTHON_FEED = "PythonFeed" CONTAINER_REGISTRY = "ContainerRegistry" GIT = "Git" + FEATURE_STORE = "FeatureStore" + S3 = "S3" + SNOWFLAKE = "Snowflake" + AZURE_SQL_DB = "AzureSqlDb" + AZURE_SYNAPSE_ANALYTICS = "AzureSynapseAnalytics" class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ContainerType.""" + """The type of container to retrieve logs from.""" + #: The container used to download models and score script. STORAGE_INITIALIZER = "StorageInitializer" + #: The container used to serve user's request. INFERENCE_SERVER = "InferenceServer" + #: The container used to collect payload and custom logging when mdc is enabled. + MODEL_DATA_COLLECTOR = "ModelDataCollector" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -312,6 +334,8 @@ class CredentialsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" SAS = "Sas" SERVICE_PRINCIPAL = "ServicePrincipal" + KERBEROS_KEYTAB = "KerberosKeytab" + KERBEROS_PASSWORD = "KerberosPassword" class DatastoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -321,6 +345,7 @@ class DatastoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_DATA_LAKE_GEN1 = "AzureDataLakeGen1" AZURE_DATA_LAKE_GEN2 = "AzureDataLakeGen2" AZURE_FILE = "AzureFile" + HDFS = "Hdfs" class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -417,6 +442,20 @@ class EnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_CREATED = "UserCreated" +class EnvironmentVariableType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the Environment Variable. Possible values are: local - For local variable.""" + + LOCAL = "local" + + +class ExportFormatType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The format of exported labels.""" + + DATASET = "Dataset" + COCO = "Coco" + CSV = "CSV" + + class FeatureLags(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Flag for generating lags for the numeric features.""" @@ -556,6 +595,30 @@ class IdentityConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_IDENTITY = "UserIdentity" +class ImageAnnotationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Annotation type of image data.""" + + CLASSIFICATION = "Classification" + BOUNDING_BOX = "BoundingBox" + INSTANCE_SEGMENTATION = "InstanceSegmentation" + + +class ImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the image. Possible values are: docker - For docker images. azureml - For AzureML + images. + """ + + DOCKER = "docker" + AZUREML = "azureml" + + +class IncrementalDataRefresh(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether IncrementalDataRefresh is enabled.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class InputDeliveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to determine the input data delivery mode.""" @@ -605,6 +668,15 @@ class JobOutputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): TRITON_MODEL = "triton_model" +class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the job provisioning state.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + IN_PROGRESS = "InProgress" + + class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of a job.""" @@ -641,6 +713,8 @@ class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): PAUSED = "Paused" #: Default job status if not mapped to all other statuses UNKNOWN = "Unknown" + #: The job is in a scheduled state. Job is not in any active state. + SCHEDULED = "Scheduled" class JobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -648,8 +722,10 @@ class JobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AUTO_ML = "AutoML" COMMAND = "Command" + LABELING = "Labeling" SWEEP = "Sweep" PIPELINE = "Pipeline" + SPARK = "Spark" class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -713,6 +789,34 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" +class MediaType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Media type of data asset.""" + + IMAGE = "Image" + TEXT = "Text" + + +class MLAssistConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MLAssistConfigurationType.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class MlflowAutologger(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether mlflow autologger is enabled for notebooks.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class MLFlowAutologgerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the state of mlflow autologger.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class ModelSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Image model size.""" @@ -746,6 +850,13 @@ class MountState(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNMOUNTED = "Unmounted" +class MultiSelect(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Whether multiSelect is enabled.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class NCrossValidationsMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines how N-Cross validations value is determined.""" @@ -763,6 +874,25 @@ class Network(str, Enum, metaclass=CaseInsensitiveEnumMeta): HOST = "Host" +class NlpLearningRateScheduler(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum of learning rate schedulers that aligns with those supported by HF.""" + + #: No learning rate schedule. + NONE = "None" + #: Linear warmup and decay. + LINEAR = "Linear" + #: Linear warmup then cosine decay. + COSINE = "Cosine" + #: Linear warmup, cosine decay, then restart to initial LR. + COSINE_WITH_RESTARTS = "CosineWithRestarts" + #: Increase linearly then polynomially decay. + POLYNOMIAL = "Polynomial" + #: Constant learning rate. + CONSTANT = "Constant" + #: Linear warmup followed by constant value. + CONSTANT_WITH_WARMUP = "ConstantWithWarmup" + + class NodeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of the compute node. Values are idle, running, preparing, unusable, leaving and preempted. @@ -776,6 +906,13 @@ class NodeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): PREEMPTED = "preempted" +class NodesValueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The enumerated types for the nodes value.""" + + ALL = "All" + CUSTOM = "Custom" + + class ObjectDetectionPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Primary metrics for Image ObjectDetection task.""" @@ -844,6 +981,7 @@ class OutputDeliveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): READ_WRITE_MOUNT = "ReadWriteMount" UPLOAD = "Upload" + DIRECT = "Direct" class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -865,6 +1003,14 @@ class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiv TIMEOUT = "Timeout" +class Protocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Protocol over which communication will happen over this endpoint.""" + + TCP = "tcp" + UDP = "udp" + HTTP = "http" + + class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current deployment state of workspace resource. The provisioningState is to indicate states for resource provisioning. @@ -877,6 +1023,7 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): SUCCEEDED = "Succeeded" FAILED = "Failed" CANCELED = "Canceled" + SOFT_DELETED = "SoftDeleted" class ProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1083,6 +1230,8 @@ class SecretsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CERTIFICATE = "Certificate" SAS = "Sas" SERVICE_PRINCIPAL = "ServicePrincipal" + KERBEROS_PASSWORD = "KerberosPassword" + KERBEROS_KEYTAB = "KerberosKeytab" class ServiceDataAccessAuthIdentity(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1140,6 +1289,13 @@ class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): URI = "URI" +class SparkJobEntryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SparkJobEntryType.""" + + SPARK_JOB_PYTHON_ENTRY = "SparkJobPythonEntry" + SPARK_JOB_SCALA_ENTRY = "SparkJobScalaEntry" + + class SshPublicAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of the public SSH port. Possible values are: Disabled - Indicates that the public ssh port is closed on this instance. Enabled - Indicates that the public ssh port is open and @@ -1194,6 +1350,14 @@ class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): OPERATION_NOT_ENABLED_FOR_REGION = "OperationNotEnabledForRegion" +class StatusMessageLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """StatusMessageLevel.""" + + ERROR = "Error" + INFORMATION = "Information" + WARNING = "Warning" + + class StochasticOptimizer(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Stochastic optimizer for image models.""" @@ -1287,6 +1451,24 @@ class TaskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): TEXT_NER = "TextNER" +class TextAnnotationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Annotation type of text data.""" + + CLASSIFICATION = "Classification" + NAMED_ENTITY_RECOGNITION = "NamedEntityRecognition" + + +class TrainingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Training mode dictates whether to use distributed training or not.""" + + #: Auto mode + AUTO = "Auto" + #: Distributed training mode + DISTRIBUTED = "Distributed" + #: Non distributed training mode + NON_DISTRIBUTED = "NonDistributed" + + class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """TriggerType.""" @@ -1363,6 +1545,15 @@ class VMTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): SPOT = "Spot" +class VolumeDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of Volume Definition. Possible Values: bind,volume,tmpfs,npipe.""" + + BIND = "bind" + VOLUME = "volume" + TMPFS = "tmpfs" + NPIPE = "npipe" + + class WeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum of weekday.""" diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_models_py3.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_models_py3.py index a0c8196e7297..7246d427ff8d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_models_py3.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/models/_models_py3.py @@ -24,17 +24,166 @@ JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +class WorkspaceConnectionPropertiesV2(_serialization.Model): + """WorkspaceConnectionPropertiesV2. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AccessKeyAuthTypeWorkspaceConnectionProperties, + ManagedIdentityAuthTypeWorkspaceConnectionProperties, + NoneAuthTypeWorkspaceConnectionProperties, PATAuthTypeWorkspaceConnectionProperties, + SASAuthTypeWorkspaceConnectionProperties, + ServicePrincipalAuthTypeWorkspaceConnectionProperties, + UsernamePasswordAuthTypeWorkspaceConnectionProperties + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "ServicePrincipal", and + "AccessKey". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar target: + :vartype target: str + :ivar value: Value details of the workspace connection. + :vartype value: str + :ivar value_format: format for the workspace connection value. "JSON" + :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + """ + + _validation = { + "auth_type": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "value_format": {"key": "valueFormat", "type": "str"}, + } + + _subtype_map = { + "auth_type": { + "AccessKey": "AccessKeyAuthTypeWorkspaceConnectionProperties", + "ManagedIdentity": "ManagedIdentityAuthTypeWorkspaceConnectionProperties", + "None": "NoneAuthTypeWorkspaceConnectionProperties", + "PAT": "PATAuthTypeWorkspaceConnectionProperties", + "SAS": "SASAuthTypeWorkspaceConnectionProperties", + "ServicePrincipal": "ServicePrincipalAuthTypeWorkspaceConnectionProperties", + "UsernamePassword": "UsernamePasswordAuthTypeWorkspaceConnectionProperties", + } + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + target: Optional[str] = None, + value: Optional[str] = None, + value_format: Optional[Union[str, "_models.ValueFormat"]] = None, + **kwargs + ): + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword target: + :paramtype target: str + :keyword value: Value details of the workspace connection. + :paramtype value: str + :keyword value_format: format for the workspace connection value. "JSON" + :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + """ + super().__init__(**kwargs) + self.auth_type: Optional[str] = None + self.category = category + self.target = target + self.value = value + self.value_format = value_format + + +class AccessKeyAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """AccessKeyAuthTypeWorkspaceConnectionProperties. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "ServicePrincipal", and + "AccessKey". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar target: + :vartype target: str + :ivar value: Value details of the workspace connection. + :vartype value: str + :ivar value_format: format for the workspace connection value. "JSON" + :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar credentials: + :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccessKey + """ + + _validation = { + "auth_type": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "value_format": {"key": "valueFormat", "type": "str"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionAccessKey"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + target: Optional[str] = None, + value: Optional[str] = None, + value_format: Optional[Union[str, "_models.ValueFormat"]] = None, + credentials: Optional["_models.WorkspaceConnectionAccessKey"] = None, + **kwargs + ): + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword target: + :paramtype target: str + :keyword value: Value details of the workspace connection. + :paramtype value: str + :keyword value_format: format for the workspace connection value. "JSON" + :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword credentials: + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccessKey + """ + super().__init__(category=category, target=target, value=value, value_format=value_format, **kwargs) + self.auth_type: str = "AccessKey" + self.credentials = credentials + + class DatastoreCredentials(_serialization.Model): """Base definition for datastore credentials. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AccountKeyDatastoreCredentials, CertificateDatastoreCredentials, NoneDatastoreCredentials, - SasDatastoreCredentials, ServicePrincipalDatastoreCredentials + AccountKeyDatastoreCredentials, CertificateDatastoreCredentials, KerberosKeytabCredentials, + KerberosPasswordCredentials, NoneDatastoreCredentials, SasDatastoreCredentials, + ServicePrincipalDatastoreCredentials All required parameters must be populated in order to send to Azure. :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType """ @@ -50,6 +199,8 @@ class DatastoreCredentials(_serialization.Model): "credentials_type": { "AccountKey": "AccountKeyDatastoreCredentials", "Certificate": "CertificateDatastoreCredentials", + "KerberosKeytab": "KerberosKeytabCredentials", + "KerberosPassword": "KerberosPasswordCredentials", "None": "NoneDatastoreCredentials", "Sas": "SasDatastoreCredentials", "ServicePrincipal": "ServicePrincipalDatastoreCredentials", @@ -68,7 +219,8 @@ class AccountKeyDatastoreCredentials(DatastoreCredentials): All required parameters must be populated in order to send to Azure. :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType :ivar secrets: [Required] Storage account secrets. Required. :vartype secrets: ~azure.mgmt.machinelearningservices.models.AccountKeyDatastoreSecrets @@ -98,13 +250,14 @@ class DatastoreSecrets(_serialization.Model): """Base definition for datastore secrets. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AccountKeyDatastoreSecrets, CertificateDatastoreSecrets, SasDatastoreSecrets, - ServicePrincipalDatastoreSecrets + AccountKeyDatastoreSecrets, CertificateDatastoreSecrets, KerberosKeytabSecrets, + KerberosPasswordSecrets, SasDatastoreSecrets, ServicePrincipalDatastoreSecrets All required parameters must be populated in order to send to Azure. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType """ @@ -120,6 +273,8 @@ class DatastoreSecrets(_serialization.Model): "secrets_type": { "AccountKey": "AccountKeyDatastoreSecrets", "Certificate": "CertificateDatastoreSecrets", + "KerberosKeytab": "KerberosKeytabSecrets", + "KerberosPassword": "KerberosPasswordSecrets", "Sas": "SasDatastoreSecrets", "ServicePrincipal": "ServicePrincipalDatastoreSecrets", } @@ -137,7 +292,8 @@ class AccountKeyDatastoreSecrets(DatastoreSecrets): All required parameters must be populated in order to send to Azure. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType :ivar key: Storage account key. :vartype key: str @@ -162,6 +318,42 @@ def __init__(self, *, key: Optional[str] = None, **kwargs): self.key = key +class AcrDetails(_serialization.Model): + """Details of ACR account to be used for the Registry. + + :ivar system_created_acr_account: + :vartype system_created_acr_account: + ~azure.mgmt.machinelearningservices.models.SystemCreatedAcrAccount + :ivar user_created_acr_account: + :vartype user_created_acr_account: + ~azure.mgmt.machinelearningservices.models.UserCreatedAcrAccount + """ + + _attribute_map = { + "system_created_acr_account": {"key": "systemCreatedAcrAccount", "type": "SystemCreatedAcrAccount"}, + "user_created_acr_account": {"key": "userCreatedAcrAccount", "type": "UserCreatedAcrAccount"}, + } + + def __init__( + self, + *, + system_created_acr_account: Optional["_models.SystemCreatedAcrAccount"] = None, + user_created_acr_account: Optional["_models.UserCreatedAcrAccount"] = None, + **kwargs + ): + """ + :keyword system_created_acr_account: + :paramtype system_created_acr_account: + ~azure.mgmt.machinelearningservices.models.SystemCreatedAcrAccount + :keyword user_created_acr_account: + :paramtype user_created_acr_account: + ~azure.mgmt.machinelearningservices.models.UserCreatedAcrAccount + """ + super().__init__(**kwargs) + self.system_created_acr_account = system_created_acr_account + self.user_created_acr_account = user_created_acr_account + + class AKSSchema(_serialization.Model): """AKSSchema. @@ -201,7 +393,7 @@ class Compute(_serialization.Model): :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -309,7 +501,7 @@ class AKS(Compute, AKSSchema): # pylint: disable=too-many-instance-attributes :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -688,6 +880,59 @@ def __init__( self.load_balancer_subnet = load_balancer_subnet +class Nodes(_serialization.Model): + """Abstract Nodes definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AllNodes + + All required parameters must be populated in order to send to Azure. + + :ivar nodes_value_type: [Required] Type of the Nodes value. Required. Known values are: "All" + and "Custom". + :vartype nodes_value_type: str or ~azure.mgmt.machinelearningservices.models.NodesValueType + """ + + _validation = { + "nodes_value_type": {"required": True}, + } + + _attribute_map = { + "nodes_value_type": {"key": "nodesValueType", "type": "str"}, + } + + _subtype_map = {"nodes_value_type": {"All": "AllNodes"}} + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.nodes_value_type: Optional[str] = None + + +class AllNodes(Nodes): + """All nodes means the service will be running on all of the nodes of the job. + + All required parameters must be populated in order to send to Azure. + + :ivar nodes_value_type: [Required] Type of the Nodes value. Required. Known values are: "All" + and "Custom". + :vartype nodes_value_type: str or ~azure.mgmt.machinelearningservices.models.NodesValueType + """ + + _validation = { + "nodes_value_type": {"required": True}, + } + + _attribute_map = { + "nodes_value_type": {"key": "nodesValueType", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.nodes_value_type: str = "All" + + class AmlComputeSchema(_serialization.Model): """Properties(top level) of AmlCompute. @@ -725,7 +970,7 @@ class AmlCompute(Compute, AmlComputeSchema): # pylint: disable=too-many-instanc :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -1057,7 +1302,7 @@ def __init__( class AmlOperation(_serialization.Model): - """Azure Machine Learning workspace REST API operation. + """Azure Machine Learning REST API operation. :ivar name: Operation name: {provider}/{resource}/{operation}. :vartype name: str @@ -1144,7 +1389,7 @@ def __init__( class AmlOperationListResult(_serialization.Model): """An array of operations supported by the resource provider. - :ivar value: List of AML workspace operations supported by the AML workspace resource provider. + :ivar value: List of AML operations supported by the AML resource provider. :vartype value: list[~azure.mgmt.machinelearningservices.models.AmlOperation] """ @@ -1154,8 +1399,7 @@ class AmlOperationListResult(_serialization.Model): def __init__(self, *, value: Optional[List["_models.AmlOperation"]] = None, **kwargs): """ - :keyword value: List of AML workspace operations supported by the AML workspace resource - provider. + :keyword value: List of AML operations supported by the AML resource provider. :paramtype value: list[~azure.mgmt.machinelearningservices.models.AmlOperation] """ super().__init__(**kwargs) @@ -1258,6 +1502,32 @@ def __init__( self.description = description +class ArmResourceId(_serialization.Model): + """ARM ResourceId of a resource. + + :ivar resource_id: Arm ResourceId is in the format + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{StorageAccountName}" + or + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs): + """ + :keyword resource_id: Arm ResourceId is in the format + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{StorageAccountName}" + or + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + class ResourceBase(_serialization.Model): """ResourceBase. @@ -1442,27 +1712,47 @@ def __init__(self, *, uri: str, mode: Optional[Union[str, "_models.InputDelivery class AssetJobOutput(_serialization.Model): """Asset output type. - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :ivar uri: Output Asset URI. :vartype uri: str """ _attribute_map = { + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } def __init__( - self, *, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs + self, + *, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, + mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + uri: Optional[str] = None, + **kwargs ): """ - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :keyword uri: Output Asset URI. :paramtype uri: str """ super().__init__(**kwargs) + self.asset_name = asset_name + self.asset_version = asset_version self.mode = mode self.uri = uri @@ -1588,11 +1878,41 @@ def __init__(self, **kwargs): self.mode: str = "Auto" +class AutologgerSettings(_serialization.Model): + """Settings for Autologger. + + All required parameters must be populated in order to send to Azure. + + :ivar mlflow_autologger: [Required] Indicates whether mlflow autologger is enabled. Required. + Known values are: "Enabled" and "Disabled". + :vartype mlflow_autologger: str or + ~azure.mgmt.machinelearningservices.models.MLFlowAutologgerState + """ + + _validation = { + "mlflow_autologger": {"required": True}, + } + + _attribute_map = { + "mlflow_autologger": {"key": "mlflowAutologger", "type": "str"}, + } + + def __init__(self, *, mlflow_autologger: Union[str, "_models.MLFlowAutologgerState"], **kwargs): + """ + :keyword mlflow_autologger: [Required] Indicates whether mlflow autologger is enabled. + Required. Known values are: "Enabled" and "Disabled". + :paramtype mlflow_autologger: str or + ~azure.mgmt.machinelearningservices.models.MLFlowAutologgerState + """ + super().__init__(**kwargs) + self.mlflow_autologger = mlflow_autologger + + class JobBaseProperties(ResourceBase): # pylint: disable=too-many-instance-attributes """Base definition for a job. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AutoMLJob, CommandJob, PipelineJob, SweepJob + AutoMLJob, CommandJob, LabelingJobProperties, PipelineJob, SparkJob, SweepJob Variables are only populated by the server, and will be ignored when sending a request. @@ -1620,14 +1940,14 @@ class JobBaseProperties(ResourceBase): # pylint: disable=too-many-instance-attr :ivar is_archived: Is the asset archived?. :vartype is_archived: bool :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", - "Command", "Sweep", and "Pipeline". + "Command", "Labeling", "Sweep", "Pipeline", and "Spark". :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType :ivar services: List of JobEndpoints. For local jobs, a job endpoint will have an endpoint value of FileStreamObject. :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", - "Canceled", "NotResponding", "Paused", and "Unknown". + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus """ @@ -1652,7 +1972,14 @@ class JobBaseProperties(ResourceBase): # pylint: disable=too-many-instance-attr } _subtype_map = { - "job_type": {"AutoML": "AutoMLJob", "Command": "CommandJob", "Pipeline": "PipelineJob", "Sweep": "SweepJob"} + "job_type": { + "AutoML": "AutoMLJob", + "Command": "CommandJob", + "Labeling": "LabelingJobProperties", + "Pipeline": "PipelineJob", + "Spark": "SparkJob", + "Sweep": "SweepJob", + } } def __init__( @@ -1739,14 +2066,14 @@ class AutoMLJob(JobBaseProperties): # pylint: disable=too-many-instance-attribu :ivar is_archived: Is the asset archived?. :vartype is_archived: bool :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", - "Command", "Sweep", and "Pipeline". + "Command", "Labeling", "Sweep", "Pipeline", and "Spark". :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType :ivar services: List of JobEndpoints. For local jobs, a job endpoint will have an endpoint value of FileStreamObject. :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", - "Canceled", "NotResponding", "Paused", and "Unknown". + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus :ivar environment_id: The ARM resource ID of the Environment specification for the job. This is optional value to provide, if not provided, AutoML will default this to Production @@ -2226,7 +2553,8 @@ class DatastoreProperties(ResourceBase): """Base definition for datastore contents configuration. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AzureBlobDatastore, AzureDataLakeGen1Datastore, AzureDataLakeGen2Datastore, AzureFileDatastore + AzureBlobDatastore, AzureDataLakeGen1Datastore, AzureDataLakeGen2Datastore, AzureFileDatastore, + HdfsDatastore Variables are only populated by the server, and will be ignored when sending a request. @@ -2241,7 +2569,7 @@ class DatastoreProperties(ResourceBase): :ivar credentials: [Required] Account credentials. Required. :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials :ivar datastore_type: [Required] Storage type backing the datastore. Required. Known values - are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", and "AzureFile". + are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", "AzureFile", and "Hdfs". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType :ivar is_default: Readonly property to indicate if datastore is the workspace default datastore. @@ -2269,6 +2597,7 @@ class DatastoreProperties(ResourceBase): "AzureDataLakeGen1": "AzureDataLakeGen1Datastore", "AzureDataLakeGen2": "AzureDataLakeGen2Datastore", "AzureFile": "AzureFileDatastore", + "Hdfs": "HdfsDatastore", } } @@ -2297,7 +2626,33 @@ def __init__( self.is_default = None -class AzureBlobDatastore(DatastoreProperties): # pylint: disable=too-many-instance-attributes +class AzureDatastore(_serialization.Model): + """Base definition for Azure datastore contents configuration. + + :ivar resource_group: Azure Resource Group name. + :vartype resource_group: str + :ivar subscription_id: Azure Subscription Id. + :vartype subscription_id: str + """ + + _attribute_map = { + "resource_group": {"key": "resourceGroup", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + } + + def __init__(self, *, resource_group: Optional[str] = None, subscription_id: Optional[str] = None, **kwargs): + """ + :keyword resource_group: Azure Resource Group name. + :paramtype resource_group: str + :keyword subscription_id: Azure Subscription Id. + :paramtype subscription_id: str + """ + super().__init__(**kwargs) + self.resource_group = resource_group + self.subscription_id = subscription_id + + +class AzureBlobDatastore(AzureDatastore, DatastoreProperties): # pylint: disable=too-many-instance-attributes """Azure Blob datastore configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -2313,11 +2668,15 @@ class AzureBlobDatastore(DatastoreProperties): # pylint: disable=too-many-insta :ivar credentials: [Required] Account credentials. Required. :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials :ivar datastore_type: [Required] Storage type backing the datastore. Required. Known values - are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", and "AzureFile". + are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", "AzureFile", and "Hdfs". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType :ivar is_default: Readonly property to indicate if datastore is the workspace default datastore. :vartype is_default: bool + :ivar resource_group: Azure Resource Group name. + :vartype resource_group: str + :ivar subscription_id: Azure Subscription Id. + :vartype subscription_id: str :ivar account_name: Storage account name. :vartype account_name: str :ivar container_name: Storage account container name. @@ -2346,6 +2705,8 @@ class AzureBlobDatastore(DatastoreProperties): # pylint: disable=too-many-insta "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, "datastore_type": {"key": "datastoreType", "type": "str"}, "is_default": {"key": "isDefault", "type": "bool"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, "account_name": {"key": "accountName", "type": "str"}, "container_name": {"key": "containerName", "type": "str"}, "endpoint": {"key": "endpoint", "type": "str"}, @@ -2360,6 +2721,8 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + resource_group: Optional[str] = None, + subscription_id: Optional[str] = None, account_name: Optional[str] = None, container_name: Optional[str] = None, endpoint: Optional[str] = None, @@ -2376,6 +2739,10 @@ def __init__( :paramtype tags: dict[str, str] :keyword credentials: [Required] Account credentials. Required. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword resource_group: Azure Resource Group name. + :paramtype resource_group: str + :keyword subscription_id: Azure Subscription Id. + :paramtype subscription_id: str :keyword account_name: Storage account name. :paramtype account_name: str :keyword container_name: Storage account container name. @@ -2390,16 +2757,31 @@ def __init__( :paramtype service_data_access_auth_identity: str or ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity """ - super().__init__(description=description, properties=properties, tags=tags, credentials=credentials, **kwargs) + super().__init__( + resource_group=resource_group, + subscription_id=subscription_id, + description=description, + properties=properties, + tags=tags, + credentials=credentials, + **kwargs + ) + self.description = description + self.properties = properties + self.tags = tags + self.credentials = credentials self.datastore_type: str = "AzureBlob" + self.is_default = None self.account_name = account_name self.container_name = container_name self.endpoint = endpoint self.protocol = protocol self.service_data_access_auth_identity = service_data_access_auth_identity + self.resource_group = resource_group + self.subscription_id = subscription_id -class AzureDataLakeGen1Datastore(DatastoreProperties): +class AzureDataLakeGen1Datastore(AzureDatastore, DatastoreProperties): """Azure Data Lake Gen1 datastore configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -2415,12 +2797,16 @@ class AzureDataLakeGen1Datastore(DatastoreProperties): :ivar credentials: [Required] Account credentials. Required. :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials :ivar datastore_type: [Required] Storage type backing the datastore. Required. Known values - are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", and "AzureFile". + are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", "AzureFile", and "Hdfs". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType :ivar is_default: Readonly property to indicate if datastore is the workspace default datastore. :vartype is_default: bool - :ivar service_data_access_auth_identity: Indicates which identity to use to authenticate + :ivar resource_group: Azure Resource Group name. + :vartype resource_group: str + :ivar subscription_id: Azure Subscription Id. + :vartype subscription_id: str + :ivar service_data_access_auth_identity: Indicates which identity to use to authenticate service data access to customer's storage. Known values are: "None", "WorkspaceSystemAssignedIdentity", and "WorkspaceUserAssignedIdentity". :vartype service_data_access_auth_identity: str or @@ -2443,6 +2829,8 @@ class AzureDataLakeGen1Datastore(DatastoreProperties): "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, "datastore_type": {"key": "datastoreType", "type": "str"}, "is_default": {"key": "isDefault", "type": "bool"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, "service_data_access_auth_identity": {"key": "serviceDataAccessAuthIdentity", "type": "str"}, "store_name": {"key": "storeName", "type": "str"}, } @@ -2455,6 +2843,8 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + resource_group: Optional[str] = None, + subscription_id: Optional[str] = None, service_data_access_auth_identity: Optional[Union[str, "_models.ServiceDataAccessAuthIdentity"]] = None, **kwargs ): @@ -2467,6 +2857,10 @@ def __init__( :paramtype tags: dict[str, str] :keyword credentials: [Required] Account credentials. Required. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword resource_group: Azure Resource Group name. + :paramtype resource_group: str + :keyword subscription_id: Azure Subscription Id. + :paramtype subscription_id: str :keyword service_data_access_auth_identity: Indicates which identity to use to authenticate service data access to customer's storage. Known values are: "None", "WorkspaceSystemAssignedIdentity", and "WorkspaceUserAssignedIdentity". @@ -2475,13 +2869,28 @@ def __init__( :keyword store_name: [Required] Azure Data Lake store name. Required. :paramtype store_name: str """ - super().__init__(description=description, properties=properties, tags=tags, credentials=credentials, **kwargs) + super().__init__( + resource_group=resource_group, + subscription_id=subscription_id, + description=description, + properties=properties, + tags=tags, + credentials=credentials, + **kwargs + ) + self.description = description + self.properties = properties + self.tags = tags + self.credentials = credentials self.datastore_type: str = "AzureDataLakeGen1" + self.is_default = None self.service_data_access_auth_identity = service_data_access_auth_identity self.store_name = store_name + self.resource_group = resource_group + self.subscription_id = subscription_id -class AzureDataLakeGen2Datastore(DatastoreProperties): # pylint: disable=too-many-instance-attributes +class AzureDataLakeGen2Datastore(AzureDatastore, DatastoreProperties): # pylint: disable=too-many-instance-attributes """Azure Data Lake Gen2 datastore configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -2497,11 +2906,15 @@ class AzureDataLakeGen2Datastore(DatastoreProperties): # pylint: disable=too-ma :ivar credentials: [Required] Account credentials. Required. :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials :ivar datastore_type: [Required] Storage type backing the datastore. Required. Known values - are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", and "AzureFile". + are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", "AzureFile", and "Hdfs". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType :ivar is_default: Readonly property to indicate if datastore is the workspace default datastore. :vartype is_default: bool + :ivar resource_group: Azure Resource Group name. + :vartype resource_group: str + :ivar subscription_id: Azure Subscription Id. + :vartype subscription_id: str :ivar account_name: [Required] Storage account name. Required. :vartype account_name: str :ivar endpoint: Azure cloud endpoint for the storage account. @@ -2532,6 +2945,8 @@ class AzureDataLakeGen2Datastore(DatastoreProperties): # pylint: disable=too-ma "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, "datastore_type": {"key": "datastoreType", "type": "str"}, "is_default": {"key": "isDefault", "type": "bool"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, "account_name": {"key": "accountName", "type": "str"}, "endpoint": {"key": "endpoint", "type": "str"}, "filesystem": {"key": "filesystem", "type": "str"}, @@ -2548,6 +2963,8 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + resource_group: Optional[str] = None, + subscription_id: Optional[str] = None, endpoint: Optional[str] = None, protocol: Optional[str] = None, service_data_access_auth_identity: Optional[Union[str, "_models.ServiceDataAccessAuthIdentity"]] = None, @@ -2562,6 +2979,10 @@ def __init__( :paramtype tags: dict[str, str] :keyword credentials: [Required] Account credentials. Required. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword resource_group: Azure Resource Group name. + :paramtype resource_group: str + :keyword subscription_id: Azure Subscription Id. + :paramtype subscription_id: str :keyword account_name: [Required] Storage account name. Required. :paramtype account_name: str :keyword endpoint: Azure cloud endpoint for the storage account. @@ -2576,16 +2997,31 @@ def __init__( :paramtype service_data_access_auth_identity: str or ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity """ - super().__init__(description=description, properties=properties, tags=tags, credentials=credentials, **kwargs) + super().__init__( + resource_group=resource_group, + subscription_id=subscription_id, + description=description, + properties=properties, + tags=tags, + credentials=credentials, + **kwargs + ) + self.description = description + self.properties = properties + self.tags = tags + self.credentials = credentials self.datastore_type: str = "AzureDataLakeGen2" + self.is_default = None self.account_name = account_name self.endpoint = endpoint self.filesystem = filesystem self.protocol = protocol self.service_data_access_auth_identity = service_data_access_auth_identity + self.resource_group = resource_group + self.subscription_id = subscription_id -class AzureFileDatastore(DatastoreProperties): # pylint: disable=too-many-instance-attributes +class AzureFileDatastore(AzureDatastore, DatastoreProperties): # pylint: disable=too-many-instance-attributes """Azure File datastore configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -2601,11 +3037,15 @@ class AzureFileDatastore(DatastoreProperties): # pylint: disable=too-many-insta :ivar credentials: [Required] Account credentials. Required. :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials :ivar datastore_type: [Required] Storage type backing the datastore. Required. Known values - are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", and "AzureFile". + are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", "AzureFile", and "Hdfs". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType :ivar is_default: Readonly property to indicate if datastore is the workspace default datastore. :vartype is_default: bool + :ivar resource_group: Azure Resource Group name. + :vartype resource_group: str + :ivar subscription_id: Azure Subscription Id. + :vartype subscription_id: str :ivar account_name: [Required] Storage account name. Required. :vartype account_name: str :ivar endpoint: Azure cloud endpoint for the storage account. @@ -2637,6 +3077,8 @@ class AzureFileDatastore(DatastoreProperties): # pylint: disable=too-many-insta "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, "datastore_type": {"key": "datastoreType", "type": "str"}, "is_default": {"key": "isDefault", "type": "bool"}, + "resource_group": {"key": "resourceGroup", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, "account_name": {"key": "accountName", "type": "str"}, "endpoint": {"key": "endpoint", "type": "str"}, "file_share_name": {"key": "fileShareName", "type": "str"}, @@ -2653,6 +3095,8 @@ def __init__( description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, + resource_group: Optional[str] = None, + subscription_id: Optional[str] = None, endpoint: Optional[str] = None, protocol: Optional[str] = None, service_data_access_auth_identity: Optional[Union[str, "_models.ServiceDataAccessAuthIdentity"]] = None, @@ -2667,6 +3111,10 @@ def __init__( :paramtype tags: dict[str, str] :keyword credentials: [Required] Account credentials. Required. :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword resource_group: Azure Resource Group name. + :paramtype resource_group: str + :keyword subscription_id: Azure Subscription Id. + :paramtype subscription_id: str :keyword account_name: [Required] Storage account name. Required. :paramtype account_name: str :keyword endpoint: Azure cloud endpoint for the storage account. @@ -2682,13 +3130,28 @@ def __init__( :paramtype service_data_access_auth_identity: str or ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity """ - super().__init__(description=description, properties=properties, tags=tags, credentials=credentials, **kwargs) + super().__init__( + resource_group=resource_group, + subscription_id=subscription_id, + description=description, + properties=properties, + tags=tags, + credentials=credentials, + **kwargs + ) + self.description = description + self.properties = properties + self.tags = tags + self.credentials = credentials self.datastore_type: str = "AzureFile" + self.is_default = None self.account_name = account_name self.endpoint = endpoint self.file_share_name = file_share_name self.protocol = protocol self.service_data_access_auth_identity = service_data_access_auth_identity + self.resource_group = resource_group + self.subscription_id = subscription_id class EarlyTerminationPolicy(_serialization.Model): @@ -2985,8 +3448,8 @@ class EndpointDeploymentPropertiesBase(_serialization.Model): :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :ivar description: Description of the endpoint deployment. :vartype description: str - :ivar environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :ivar environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :vartype environment_id: str :ivar environment_variables: Environment variables configuration for the deployment. :vartype environment_variables: dict[str, str] @@ -3017,8 +3480,8 @@ def __init__( :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :keyword description: Description of the endpoint deployment. :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :keyword environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :paramtype environment_id: str :keyword environment_variables: Environment variables configuration for the deployment. :paramtype environment_variables: dict[str, str] @@ -3042,8 +3505,8 @@ class BatchDeploymentProperties(EndpointDeploymentPropertiesBase): # pylint: di :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :ivar description: Description of the endpoint deployment. :vartype description: str - :ivar environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :ivar environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :vartype environment_id: str :ivar environment_variables: Environment variables configuration for the deployment. :vartype environment_variables: dict[str, str] @@ -3134,8 +3597,8 @@ def __init__( :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :keyword description: Description of the endpoint deployment. :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :keyword environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :paramtype environment_id: str :keyword environment_variables: Environment variables configuration for the deployment. :paramtype environment_variables: dict[str, str] @@ -3607,6 +4070,45 @@ def __init__(self, **kwargs): self.sampling_algorithm_type: str = "Bayesian" +class BindOptions(_serialization.Model): + """BindOptions. + + :ivar propagation: Type of Bind Option. + :vartype propagation: str + :ivar create_host_path: Indicate whether to create host path. + :vartype create_host_path: bool + :ivar selinux: Mention the selinux options. + :vartype selinux: str + """ + + _attribute_map = { + "propagation": {"key": "propagation", "type": "str"}, + "create_host_path": {"key": "createHostPath", "type": "bool"}, + "selinux": {"key": "selinux", "type": "str"}, + } + + def __init__( + self, + *, + propagation: Optional[str] = None, + create_host_path: Optional[bool] = None, + selinux: Optional[str] = None, + **kwargs + ): + """ + :keyword propagation: Type of Bind Option. + :paramtype propagation: str + :keyword create_host_path: Indicate whether to create host path. + :paramtype create_host_path: bool + :keyword selinux: Mention the selinux options. + :paramtype selinux: str + """ + super().__init__(**kwargs) + self.propagation = propagation + self.create_host_path = create_host_path + self.selinux = selinux + + class BuildContext(_serialization.Model): """Configuration settings for Docker build context. @@ -3671,7 +4173,8 @@ class CertificateDatastoreCredentials(DatastoreCredentials): All required parameters must be populated in order to send to Azure. :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType :ivar authority_url: Authority URL used for authentication. :vartype authority_url: str @@ -3748,7 +4251,8 @@ class CertificateDatastoreSecrets(DatastoreSecrets): All required parameters must be populated in order to send to Azure. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType :ivar certificate: Service principal certificate. :vartype certificate: str @@ -3773,7 +4277,7 @@ def __init__(self, *, certificate: Optional[str] = None, **kwargs): self.certificate = certificate -class TableVertical(_serialization.Model): +class TableVertical(_serialization.Model): # pylint: disable=too-many-instance-attributes """Abstract class for AutoML tasks that use table dataset as input - such as Classification/Regression/Forecasting. :ivar cv_split_column_names: Columns to use for CVSplit data. @@ -3781,11 +4285,19 @@ class TableVertical(_serialization.Model): :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset when validation dataset is not provided. :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings :ivar test_data: Test data input. :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation @@ -3808,8 +4320,11 @@ class TableVertical(_serialization.Model): _attribute_map = { "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "TableFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "search_space": {"key": "searchSpace", "type": "[TableParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "TableSweepSettings"}, "test_data": {"key": "testData", "type": "MLTableJobInput"}, "test_data_size": {"key": "testDataSize", "type": "float"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, @@ -3822,8 +4337,11 @@ def __init__( *, cv_split_column_names: Optional[List[str]] = None, featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.TableFixedParameters"] = None, limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, n_cross_validations: Optional["_models.NCrossValidations"] = None, + search_space: Optional[List["_models.TableParameterSubspace"]] = None, + sweep_settings: Optional["_models.TableSweepSettings"] = None, test_data: Optional["_models.MLTableJobInput"] = None, test_data_size: Optional[float] = None, validation_data: Optional["_models.MLTableJobInput"] = None, @@ -3837,6 +4355,9 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings @@ -3844,6 +4365,12 @@ def __init__( dataset when validation dataset is not provided. :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings :keyword test_data: Test data input. :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation @@ -3865,8 +4392,11 @@ def __init__( super().__init__(**kwargs) self.cv_split_column_names = cv_split_column_names self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings self.n_cross_validations = n_cross_validations + self.search_space = search_space + self.sweep_settings = sweep_settings self.test_data = test_data self.test_data_size = test_data_size self.validation_data = validation_data @@ -3897,11 +4427,19 @@ class Classification(TableVertical, AutoMLVertical): # pylint: disable=too-many :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset when validation dataset is not provided. :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings :ivar test_data: Test data input. :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation @@ -3942,8 +4480,11 @@ class Classification(TableVertical, AutoMLVertical): # pylint: disable=too-many "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "TableFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "search_space": {"key": "searchSpace", "type": "[TableParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "TableSweepSettings"}, "test_data": {"key": "testData", "type": "MLTableJobInput"}, "test_data_size": {"key": "testDataSize", "type": "float"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, @@ -3962,8 +4503,11 @@ def __init__( target_column_name: Optional[str] = None, cv_split_column_names: Optional[List[str]] = None, featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.TableFixedParameters"] = None, limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, n_cross_validations: Optional["_models.NCrossValidations"] = None, + search_space: Optional[List["_models.TableParameterSubspace"]] = None, + sweep_settings: Optional["_models.TableSweepSettings"] = None, test_data: Optional["_models.MLTableJobInput"] = None, test_data_size: Optional[float] = None, validation_data: Optional["_models.MLTableJobInput"] = None, @@ -3988,6 +4532,9 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings @@ -3995,6 +4542,12 @@ def __init__( dataset when validation dataset is not provided. :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings :keyword test_data: Test data input. :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation @@ -4025,8 +4578,11 @@ def __init__( super().__init__( cv_split_column_names=cv_split_column_names, featurization_settings=featurization_settings, + fixed_parameters=fixed_parameters, limit_settings=limit_settings, n_cross_validations=n_cross_validations, + search_space=search_space, + sweep_settings=sweep_settings, test_data=test_data, test_data_size=test_data_size, validation_data=validation_data, @@ -4046,8 +4602,11 @@ def __init__( self.training_settings = training_settings self.cv_split_column_names = cv_split_column_names self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings self.n_cross_validations = n_cross_validations + self.search_space = search_space + self.sweep_settings = sweep_settings self.test_data = test_data self.test_data_size = test_data_size self.validation_data = validation_data @@ -4075,6 +4634,14 @@ class TrainingSettings(_serialization.Model): :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. :vartype stack_ensemble_settings: ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :ivar training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :vartype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode """ _attribute_map = { @@ -4085,6 +4652,7 @@ class TrainingSettings(_serialization.Model): "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, + "training_mode": {"key": "trainingMode", "type": "str"}, } def __init__( @@ -4097,6 +4665,7 @@ def __init__( enable_vote_ensemble: bool = True, ensemble_model_download_timeout: datetime.timedelta = "PT5M", stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, + training_mode: Optional[Union[str, "_models.TrainingMode"]] = None, **kwargs ): """ @@ -4117,6 +4686,14 @@ def __init__( :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. :paramtype stack_ensemble_settings: ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :keyword training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :paramtype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode """ super().__init__(**kwargs) self.enable_dnn_training = enable_dnn_training @@ -4126,6 +4703,7 @@ def __init__( self.enable_vote_ensemble = enable_vote_ensemble self.ensemble_model_download_timeout = ensemble_model_download_timeout self.stack_ensemble_settings = stack_ensemble_settings + self.training_mode = training_mode class ClassificationTrainingSettings(TrainingSettings): @@ -4148,6 +4726,14 @@ class ClassificationTrainingSettings(TrainingSettings): :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. :vartype stack_ensemble_settings: ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :ivar training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :vartype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode :ivar allowed_training_algorithms: Allowed models for classification task. :vartype allowed_training_algorithms: list[str or ~azure.mgmt.machinelearningservices.models.ClassificationModels] @@ -4164,6 +4750,7 @@ class ClassificationTrainingSettings(TrainingSettings): "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, + "training_mode": {"key": "trainingMode", "type": "str"}, "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, } @@ -4178,6 +4765,7 @@ def __init__( enable_vote_ensemble: bool = True, ensemble_model_download_timeout: datetime.timedelta = "PT5M", stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, + training_mode: Optional[Union[str, "_models.TrainingMode"]] = None, allowed_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = None, blocked_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = None, **kwargs @@ -4200,6 +4788,14 @@ def __init__( :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. :paramtype stack_ensemble_settings: ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :keyword training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :paramtype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode :keyword allowed_training_algorithms: Allowed models for classification task. :paramtype allowed_training_algorithms: list[str or ~azure.mgmt.machinelearningservices.models.ClassificationModels] @@ -4215,6 +4811,7 @@ def __init__( enable_vote_ensemble=enable_vote_ensemble, ensemble_model_download_timeout=ensemble_model_download_timeout, stack_ensemble_settings=stack_ensemble_settings, + training_mode=training_mode, **kwargs ) self.allowed_training_algorithms = allowed_training_algorithms @@ -4241,6 +4838,111 @@ def __init__(self, *, properties: Optional["_models.ScaleSettingsInformation"] = self.properties = properties +class ExportSummary(_serialization.Model): + """ExportSummary. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CsvExportSummary, CocoExportSummary, DatasetExportSummary + + 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 end_date_time: The time when the export was completed. + :vartype end_date_time: ~datetime.datetime + :ivar exported_row_count: The total number of labeled datapoints exported. + :vartype exported_row_count: int + :ivar format: [Required] The format of exported labels, also as the discriminator. Required. + Known values are: "Dataset", "Coco", and "CSV". + :vartype format: str or ~azure.mgmt.machinelearningservices.models.ExportFormatType + :ivar labeling_job_id: Name and identifier of the job containing exported labels. + :vartype labeling_job_id: str + :ivar start_date_time: The time when the export was requested. + :vartype start_date_time: ~datetime.datetime + """ + + _validation = { + "end_date_time": {"readonly": True}, + "exported_row_count": {"readonly": True}, + "format": {"required": True}, + "labeling_job_id": {"readonly": True}, + "start_date_time": {"readonly": True}, + } + + _attribute_map = { + "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, + "exported_row_count": {"key": "exportedRowCount", "type": "int"}, + "format": {"key": "format", "type": "str"}, + "labeling_job_id": {"key": "labelingJobId", "type": "str"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + } + + _subtype_map = { + "format": {"CSV": "CsvExportSummary", "Coco": "CocoExportSummary", "Dataset": "DatasetExportSummary"} + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.end_date_time = None + self.exported_row_count = None + self.format: Optional[str] = None + self.labeling_job_id = None + self.start_date_time = None + + +class CocoExportSummary(ExportSummary): + """CocoExportSummary. + + 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 end_date_time: The time when the export was completed. + :vartype end_date_time: ~datetime.datetime + :ivar exported_row_count: The total number of labeled datapoints exported. + :vartype exported_row_count: int + :ivar format: [Required] The format of exported labels, also as the discriminator. Required. + Known values are: "Dataset", "Coco", and "CSV". + :vartype format: str or ~azure.mgmt.machinelearningservices.models.ExportFormatType + :ivar labeling_job_id: Name and identifier of the job containing exported labels. + :vartype labeling_job_id: str + :ivar start_date_time: The time when the export was requested. + :vartype start_date_time: ~datetime.datetime + :ivar container_name: The container name to which the labels will be exported. + :vartype container_name: str + :ivar snapshot_path: The output path where the labels will be exported. + :vartype snapshot_path: str + """ + + _validation = { + "end_date_time": {"readonly": True}, + "exported_row_count": {"readonly": True}, + "format": {"required": True}, + "labeling_job_id": {"readonly": True}, + "start_date_time": {"readonly": True}, + "container_name": {"readonly": True}, + "snapshot_path": {"readonly": True}, + } + + _attribute_map = { + "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, + "exported_row_count": {"key": "exportedRowCount", "type": "int"}, + "format": {"key": "format", "type": "str"}, + "labeling_job_id": {"key": "labelingJobId", "type": "str"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + "container_name": {"key": "containerName", "type": "str"}, + "snapshot_path": {"key": "snapshotPath", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.format: str = "Coco" + self.container_name = None + self.snapshot_path = None + + class CodeConfiguration(_serialization.Model): """Configuration for a scoring code asset. @@ -4337,11 +5039,16 @@ class CodeContainerProperties(AssetContainer): :vartype latest_version: str :ivar next_version: The next auto incremental version. :vartype next_version: str + :ivar provisioning_state: Provisioning state for the code container. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { "latest_version": {"readonly": True}, "next_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -4351,6 +5058,7 @@ class CodeContainerProperties(AssetContainer): "is_archived": {"key": "isArchived", "type": "bool"}, "latest_version": {"key": "latestVersion", "type": "str"}, "next_version": {"key": "nextVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -4373,6 +5081,7 @@ def __init__( :paramtype is_archived: bool """ super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None class CodeContainerResourceArmPaginatedResult(_serialization.Model): @@ -4455,6 +5164,8 @@ def __init__(self, *, properties: "_models.CodeVersionProperties", **kwargs): class CodeVersionProperties(AssetBase): """Code asset version details. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar description: The asset description text. :vartype description: str :ivar properties: The asset property dictionary. @@ -4467,8 +5178,16 @@ class CodeVersionProperties(AssetBase): :vartype is_archived: bool :ivar code_uri: Uri where code is located. :vartype code_uri: str + :ivar provisioning_state: Provisioning state for the code version. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ + _validation = { + "provisioning_state": {"readonly": True}, + } + _attribute_map = { "description": {"key": "description", "type": "str"}, "properties": {"key": "properties", "type": "{str}"}, @@ -4476,6 +5195,7 @@ class CodeVersionProperties(AssetBase): "is_anonymous": {"key": "isAnonymous", "type": "bool"}, "is_archived": {"key": "isArchived", "type": "bool"}, "code_uri": {"key": "codeUri", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -4512,6 +5232,7 @@ def __init__( **kwargs ) self.code_uri = code_uri + self.provisioning_state = None class CodeVersionResourceArmPaginatedResult(_serialization.Model): @@ -4601,15 +5322,18 @@ class CommandJob(JobBaseProperties): # pylint: disable=too-many-instance-attrib :ivar is_archived: Is the asset archived?. :vartype is_archived: bool :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", - "Command", "Sweep", and "Pipeline". + "Command", "Labeling", "Sweep", "Pipeline", and "Spark". :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType :ivar services: List of JobEndpoints. For local jobs, a job endpoint will have an endpoint value of FileStreamObject. :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", - "Canceled", "NotResponding", "Paused", and "Unknown". + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar autologger_settings: Distribution configuration of the job. If set, this should be one of + Mpi, Tensorflow, PyTorch, or null. + :vartype autologger_settings: ~azure.mgmt.machinelearningservices.models.AutologgerSettings :ivar code_id: ARM resource ID of the code asset. :vartype code_id: str :ivar command: [Required] The command to execute on startup of the job. eg. "python train.py". @@ -4656,6 +5380,7 @@ class CommandJob(JobBaseProperties): # pylint: disable=too-many-instance-attrib "job_type": {"key": "jobType", "type": "str"}, "services": {"key": "services", "type": "{JobService}"}, "status": {"key": "status", "type": "str"}, + "autologger_settings": {"key": "autologgerSettings", "type": "AutologgerSettings"}, "code_id": {"key": "codeId", "type": "str"}, "command": {"key": "command", "type": "str"}, "distribution": {"key": "distribution", "type": "DistributionConfiguration"}, @@ -4683,6 +5408,7 @@ def __init__( identity: Optional["_models.IdentityConfiguration"] = None, is_archived: bool = False, services: Optional[Dict[str, "_models.JobService"]] = None, + autologger_settings: Optional["_models.AutologgerSettings"] = None, code_id: Optional[str] = None, distribution: Optional["_models.DistributionConfiguration"] = None, environment_variables: Optional[Dict[str, str]] = None, @@ -4717,6 +5443,9 @@ def __init__( :keyword services: List of JobEndpoints. For local jobs, a job endpoint will have an endpoint value of FileStreamObject. :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :keyword autologger_settings: Distribution configuration of the job. If set, this should be one + of Mpi, Tensorflow, PyTorch, or null. + :paramtype autologger_settings: ~azure.mgmt.machinelearningservices.models.AutologgerSettings :keyword code_id: ARM resource ID of the code asset. :paramtype code_id: str :keyword command: [Required] The command to execute on startup of the job. eg. "python @@ -4753,6 +5482,7 @@ def __init__( **kwargs ) self.job_type: str = "Command" + self.autologger_settings = autologger_settings self.code_id = code_id self.command = command self.distribution = distribution @@ -4904,11 +5634,16 @@ class ComponentContainerProperties(AssetContainer): :vartype latest_version: str :ivar next_version: The next auto incremental version. :vartype next_version: str + :ivar provisioning_state: Provisioning state for the component container. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { "latest_version": {"readonly": True}, "next_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -4918,6 +5653,7 @@ class ComponentContainerProperties(AssetContainer): "is_archived": {"key": "isArchived", "type": "bool"}, "latest_version": {"key": "latestVersion", "type": "str"}, "next_version": {"key": "nextVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -4940,6 +5676,7 @@ def __init__( :paramtype is_archived: bool """ super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None class ComponentContainerResourceArmPaginatedResult(_serialization.Model): @@ -5022,6 +5759,8 @@ def __init__(self, *, properties: "_models.ComponentVersionProperties", **kwargs class ComponentVersionProperties(AssetBase): """Definition of a component version: defines resources that span component types. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar description: The asset description text. :vartype description: str :ivar properties: The asset property dictionary. @@ -5041,8 +5780,16 @@ class ComponentVersionProperties(AssetBase): href="https://docs.microsoft.com/en-us/azure/machine-learning/reference-yaml-component-command" />. :vartype component_spec: JSON + :ivar provisioning_state: Provisioning state for the component version. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ + _validation = { + "provisioning_state": {"readonly": True}, + } + _attribute_map = { "description": {"key": "description", "type": "str"}, "properties": {"key": "properties", "type": "{str}"}, @@ -5050,6 +5797,7 @@ class ComponentVersionProperties(AssetBase): "is_anonymous": {"key": "isAnonymous", "type": "bool"}, "is_archived": {"key": "isArchived", "type": "bool"}, "component_spec": {"key": "componentSpec", "type": "object"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -5093,6 +5841,7 @@ def __init__( **kwargs ) self.component_spec = component_spec + self.provisioning_state = None class ComponentVersionResourceArmPaginatedResult(_serialization.Model): @@ -5162,7 +5911,7 @@ class ComputeInstance(Compute, ComputeInstanceSchema): # pylint: disable=too-ma :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -5276,6 +6025,29 @@ def __init__(self, *, display_name: Optional[str] = None, endpoint_uri: Optional self.endpoint_uri = endpoint_uri +class ComputeInstanceAutologgerSettings(_serialization.Model): + """Specifies settings for autologger. + + :ivar mlflow_autologger: Indicates whether mlflow autologger is enabled for notebooks. Known + values are: "Enabled" and "Disabled". + :vartype mlflow_autologger: str or ~azure.mgmt.machinelearningservices.models.MlflowAutologger + """ + + _attribute_map = { + "mlflow_autologger": {"key": "mlflowAutologger", "type": "str"}, + } + + def __init__(self, *, mlflow_autologger: Optional[Union[str, "_models.MlflowAutologger"]] = None, **kwargs): + """ + :keyword mlflow_autologger: Indicates whether mlflow autologger is enabled for notebooks. Known + values are: "Enabled" and "Disabled". + :paramtype mlflow_autologger: str or + ~azure.mgmt.machinelearningservices.models.MlflowAutologger + """ + super().__init__(**kwargs) + self.mlflow_autologger = mlflow_autologger + + class ComputeInstanceConnectivityEndpoints(_serialization.Model): """Defines all connectivity endpoints and properties for an ComputeInstance. @@ -5635,8 +6407,16 @@ class ComputeInstanceProperties(_serialization.Model): # pylint: disable=too-ma depending on his/her assigned role. Known values are: "Personal" and "Shared". :vartype application_sharing_policy: str or ~azure.mgmt.machinelearningservices.models.ApplicationSharingPolicy + :ivar autologger_settings: Specifies settings for autologger. + :vartype autologger_settings: + ~azure.mgmt.machinelearningservices.models.ComputeInstanceAutologgerSettings :ivar ssh_settings: Specifies policy and settings for SSH access. :vartype ssh_settings: ~azure.mgmt.machinelearningservices.models.ComputeInstanceSshSettings + :ivar custom_services: List of Custom Services added to the compute. + :vartype custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] + :ivar os_image_metadata: Returns metadata about the operating system image for this compute + instance. + :vartype os_image_metadata: ~azure.mgmt.machinelearningservices.models.ImageMetadata :ivar connectivity_endpoints: Describes all connectivity endpoints available for this ComputeInstance. :vartype connectivity_endpoints: @@ -5668,6 +6448,9 @@ class ComputeInstanceProperties(_serialization.Model): # pylint: disable=too-ma ~azure.mgmt.machinelearningservices.models.ComputeInstanceLastOperation :ivar schedules: The list of schedules to be applied on the computes. :vartype schedules: ~azure.mgmt.machinelearningservices.models.ComputeSchedules + :ivar idle_time_before_shutdown: Stops compute instance after user defined period of + inactivity. Time is defined in ISO8601 format. Minimum is 15 min, maximum is 3 days. + :vartype idle_time_before_shutdown: str :ivar enable_node_public_ip: Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no @@ -5684,13 +6467,13 @@ class ComputeInstanceProperties(_serialization.Model): # pylint: disable=too-ma """ _validation = { + "os_image_metadata": {"readonly": True}, "connectivity_endpoints": {"readonly": True}, "applications": {"readonly": True}, "created_by": {"readonly": True}, "errors": {"readonly": True}, "state": {"readonly": True}, "last_operation": {"readonly": True}, - "schedules": {"readonly": True}, "containers": {"readonly": True}, "data_disks": {"readonly": True}, "data_mounts": {"readonly": True}, @@ -5701,7 +6484,10 @@ class ComputeInstanceProperties(_serialization.Model): # pylint: disable=too-ma "vm_size": {"key": "vmSize", "type": "str"}, "subnet": {"key": "subnet", "type": "ResourceId"}, "application_sharing_policy": {"key": "applicationSharingPolicy", "type": "str"}, + "autologger_settings": {"key": "autologgerSettings", "type": "ComputeInstanceAutologgerSettings"}, "ssh_settings": {"key": "sshSettings", "type": "ComputeInstanceSshSettings"}, + "custom_services": {"key": "customServices", "type": "[CustomService]"}, + "os_image_metadata": {"key": "osImageMetadata", "type": "ImageMetadata"}, "connectivity_endpoints": {"key": "connectivityEndpoints", "type": "ComputeInstanceConnectivityEndpoints"}, "applications": {"key": "applications", "type": "[ComputeInstanceApplication]"}, "created_by": {"key": "createdBy", "type": "ComputeInstanceCreatedBy"}, @@ -5715,6 +6501,7 @@ class ComputeInstanceProperties(_serialization.Model): # pylint: disable=too-ma "setup_scripts": {"key": "setupScripts", "type": "SetupScripts"}, "last_operation": {"key": "lastOperation", "type": "ComputeInstanceLastOperation"}, "schedules": {"key": "schedules", "type": "ComputeSchedules"}, + "idle_time_before_shutdown": {"key": "idleTimeBeforeShutdown", "type": "str"}, "enable_node_public_ip": {"key": "enableNodePublicIp", "type": "bool"}, "containers": {"key": "containers", "type": "[ComputeInstanceContainer]"}, "data_disks": {"key": "dataDisks", "type": "[ComputeInstanceDataDisk]"}, @@ -5728,10 +6515,14 @@ def __init__( vm_size: Optional[str] = None, subnet: Optional["_models.ResourceId"] = None, application_sharing_policy: Union[str, "_models.ApplicationSharingPolicy"] = "Shared", + autologger_settings: Optional["_models.ComputeInstanceAutologgerSettings"] = None, ssh_settings: Optional["_models.ComputeInstanceSshSettings"] = None, + custom_services: Optional[List["_models.CustomService"]] = None, compute_instance_authorization_type: Union[str, "_models.ComputeInstanceAuthorizationType"] = "personal", personal_compute_instance_settings: Optional["_models.PersonalComputeInstanceSettings"] = None, setup_scripts: Optional["_models.SetupScripts"] = None, + schedules: Optional["_models.ComputeSchedules"] = None, + idle_time_before_shutdown: Optional[str] = None, enable_node_public_ip: Optional[bool] = None, **kwargs ): @@ -5746,8 +6537,13 @@ def __init__( depending on his/her assigned role. Known values are: "Personal" and "Shared". :paramtype application_sharing_policy: str or ~azure.mgmt.machinelearningservices.models.ApplicationSharingPolicy + :keyword autologger_settings: Specifies settings for autologger. + :paramtype autologger_settings: + ~azure.mgmt.machinelearningservices.models.ComputeInstanceAutologgerSettings :keyword ssh_settings: Specifies policy and settings for SSH access. :paramtype ssh_settings: ~azure.mgmt.machinelearningservices.models.ComputeInstanceSshSettings + :keyword custom_services: List of Custom Services added to the compute. + :paramtype custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] :keyword compute_instance_authorization_type: The Compute Instance Authorization type. Available values are personal (default). "personal" :paramtype compute_instance_authorization_type: str or @@ -5757,6 +6553,11 @@ def __init__( ~azure.mgmt.machinelearningservices.models.PersonalComputeInstanceSettings :keyword setup_scripts: Details of customized scripts to execute for setting up the cluster. :paramtype setup_scripts: ~azure.mgmt.machinelearningservices.models.SetupScripts + :keyword schedules: The list of schedules to be applied on the computes. + :paramtype schedules: ~azure.mgmt.machinelearningservices.models.ComputeSchedules + :keyword idle_time_before_shutdown: Stops compute instance after user defined period of + inactivity. Time is defined in ISO8601 format. Minimum is 15 min, maximum is 3 days. + :paramtype idle_time_before_shutdown: str :keyword enable_node_public_ip: Enable or disable node public IP address provisioning. Possible values are: Possible values are: true - Indicates that the compute nodes will have public IPs provisioned. false - Indicates that the compute nodes will have a private endpoint and no @@ -5767,7 +6568,10 @@ def __init__( self.vm_size = vm_size self.subnet = subnet self.application_sharing_policy = application_sharing_policy + self.autologger_settings = autologger_settings self.ssh_settings = ssh_settings + self.custom_services = custom_services + self.os_image_metadata = None self.connectivity_endpoints = None self.applications = None self.created_by = None @@ -5777,7 +6581,8 @@ def __init__( self.personal_compute_instance_settings = personal_compute_instance_settings self.setup_scripts = setup_scripts self.last_operation = None - self.schedules = None + self.schedules = schedules + self.idle_time_before_shutdown = idle_time_before_shutdown self.enable_node_public_ip = enable_node_public_ip self.containers = None self.data_disks = None @@ -6286,6 +7091,58 @@ def __init__( self.expression = expression +class CsvExportSummary(ExportSummary): + """CsvExportSummary. + + 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 end_date_time: The time when the export was completed. + :vartype end_date_time: ~datetime.datetime + :ivar exported_row_count: The total number of labeled datapoints exported. + :vartype exported_row_count: int + :ivar format: [Required] The format of exported labels, also as the discriminator. Required. + Known values are: "Dataset", "Coco", and "CSV". + :vartype format: str or ~azure.mgmt.machinelearningservices.models.ExportFormatType + :ivar labeling_job_id: Name and identifier of the job containing exported labels. + :vartype labeling_job_id: str + :ivar start_date_time: The time when the export was requested. + :vartype start_date_time: ~datetime.datetime + :ivar container_name: The container name to which the labels will be exported. + :vartype container_name: str + :ivar snapshot_path: The output path where the labels will be exported. + :vartype snapshot_path: str + """ + + _validation = { + "end_date_time": {"readonly": True}, + "exported_row_count": {"readonly": True}, + "format": {"required": True}, + "labeling_job_id": {"readonly": True}, + "start_date_time": {"readonly": True}, + "container_name": {"readonly": True}, + "snapshot_path": {"readonly": True}, + } + + _attribute_map = { + "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, + "exported_row_count": {"key": "exportedRowCount", "type": "int"}, + "format": {"key": "format", "type": "str"}, + "labeling_job_id": {"key": "labelingJobId", "type": "str"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + "container_name": {"key": "containerName", "type": "str"}, + "snapshot_path": {"key": "snapshotPath", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.format: str = "CSV" + self.container_name = None + self.snapshot_path = None + + class CustomForecastHorizon(ForecastHorizon): """The desired maximum forecast horizon in units of time-series frequency. @@ -6476,7 +7333,12 @@ class CustomModelJobOutput(AssetJobOutput, JobOutput): :ivar job_output_type: [Required] Specifies the type of job. Required. Known values are: "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and "triton_model". :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :ivar uri: Output Asset URI. :vartype uri: str @@ -6489,6 +7351,8 @@ class CustomModelJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -6497,6 +7361,8 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs @@ -6504,14 +7370,23 @@ def __init__( """ :keyword description: Description for the output. :paramtype description: str - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :keyword uri: Output Asset URI. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__( + asset_name=asset_name, asset_version=asset_version, mode=mode, uri=uri, description=description, **kwargs + ) self.description = description self.job_output_type: str = "custom_model" + self.asset_name = asset_name + self.asset_version = asset_version self.mode = mode self.uri = uri @@ -6579,6 +7454,77 @@ def __init__(self, *, value: int, **kwargs): self.value = value +class CustomService(_serialization.Model): + """Specifies the custom service configuration. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar name: Name of the Custom Service. + :vartype name: str + :ivar image: Describes the Image Specifications. + :vartype image: ~azure.mgmt.machinelearningservices.models.Image + :ivar environment_variables: Environment Variable for the container. + :vartype environment_variables: dict[str, + ~azure.mgmt.machinelearningservices.models.EnvironmentVariable] + :ivar docker: Describes the docker settings for the image. + :vartype docker: ~azure.mgmt.machinelearningservices.models.Docker + :ivar endpoints: Configuring the endpoints for the container. + :vartype endpoints: list[~azure.mgmt.machinelearningservices.models.Endpoint] + :ivar volumes: Configuring the volumes for the container. + :vartype volumes: list[~azure.mgmt.machinelearningservices.models.VolumeDefinition] + """ + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "name": {"key": "name", "type": "str"}, + "image": {"key": "image", "type": "Image"}, + "environment_variables": {"key": "environmentVariables", "type": "{EnvironmentVariable}"}, + "docker": {"key": "docker", "type": "Docker"}, + "endpoints": {"key": "endpoints", "type": "[Endpoint]"}, + "volumes": {"key": "volumes", "type": "[VolumeDefinition]"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + name: Optional[str] = None, + image: Optional["_models.Image"] = None, + environment_variables: Optional[Dict[str, "_models.EnvironmentVariable"]] = None, + docker: Optional["_models.Docker"] = None, + endpoints: Optional[List["_models.Endpoint"]] = None, + volumes: Optional[List["_models.VolumeDefinition"]] = None, + **kwargs + ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword name: Name of the Custom Service. + :paramtype name: str + :keyword image: Describes the Image Specifications. + :paramtype image: ~azure.mgmt.machinelearningservices.models.Image + :keyword environment_variables: Environment Variable for the container. + :paramtype environment_variables: dict[str, + ~azure.mgmt.machinelearningservices.models.EnvironmentVariable] + :keyword docker: Describes the docker settings for the image. + :paramtype docker: ~azure.mgmt.machinelearningservices.models.Docker + :keyword endpoints: Configuring the endpoints for the container. + :paramtype endpoints: list[~azure.mgmt.machinelearningservices.models.Endpoint] + :keyword volumes: Configuring the volumes for the container. + :paramtype volumes: list[~azure.mgmt.machinelearningservices.models.VolumeDefinition] + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.name = name + self.image = image + self.environment_variables = environment_variables + self.docker = docker + self.endpoints = endpoints + self.volumes = volumes + + class CustomTargetLags(TargetLags): """CustomTargetLags. @@ -6680,7 +7626,7 @@ class Databricks(Compute, DatabricksSchema): # pylint: disable=too-many-instanc :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -7005,7 +7951,7 @@ class DataFactory(Compute): :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -7118,7 +8064,7 @@ class DataLakeAnalytics(Compute, DataLakeAnalyticsSchema): # pylint: disable=to :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -7264,6 +8210,53 @@ def __init__(self, *, datastore_id: Optional[str] = None, path: Optional[str] = self.path = path +class DatasetExportSummary(ExportSummary): + """DatasetExportSummary. + + 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 end_date_time: The time when the export was completed. + :vartype end_date_time: ~datetime.datetime + :ivar exported_row_count: The total number of labeled datapoints exported. + :vartype exported_row_count: int + :ivar format: [Required] The format of exported labels, also as the discriminator. Required. + Known values are: "Dataset", "Coco", and "CSV". + :vartype format: str or ~azure.mgmt.machinelearningservices.models.ExportFormatType + :ivar labeling_job_id: Name and identifier of the job containing exported labels. + :vartype labeling_job_id: str + :ivar start_date_time: The time when the export was requested. + :vartype start_date_time: ~datetime.datetime + :ivar labeled_asset_name: The unique name of the labeled data asset. + :vartype labeled_asset_name: str + """ + + _validation = { + "end_date_time": {"readonly": True}, + "exported_row_count": {"readonly": True}, + "format": {"required": True}, + "labeling_job_id": {"readonly": True}, + "start_date_time": {"readonly": True}, + "labeled_asset_name": {"readonly": True}, + } + + _attribute_map = { + "end_date_time": {"key": "endDateTime", "type": "iso-8601"}, + "exported_row_count": {"key": "exportedRowCount", "type": "int"}, + "format": {"key": "format", "type": "str"}, + "labeling_job_id": {"key": "labelingJobId", "type": "str"}, + "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, + "labeled_asset_name": {"key": "labeledAssetName", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.format: str = "Dataset" + self.labeled_asset_name = None + + class Datastore(Resource): """Azure Resource Manager resource envelope. @@ -7407,9 +8400,8 @@ class DataVersionBaseProperties(AssetBase): :ivar data_type: [Required] Specifies the type of data. Required. Known values are: "uri_file", "uri_folder", and "mltable". :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType - :ivar data_uri: [Required] Uri of the data. Usage/meaning depends on - Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType. - Required. + :ivar data_uri: [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. :vartype data_uri: str """ @@ -7454,9 +8446,8 @@ def __init__( :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool - :keyword data_uri: [Required] Uri of the data. Usage/meaning depends on - Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType. - Required. + :keyword data_uri: [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. :paramtype data_uri: str """ super().__init__( @@ -7580,7 +8571,7 @@ class DeploymentLogsRequest(_serialization.Model): """DeploymentLogsRequest. :ivar container_type: The type of container to retrieve logs from. Known values are: - "StorageInitializer" and "InferenceServer". + "StorageInitializer", "InferenceServer", and "ModelDataCollector". :vartype container_type: str or ~azure.mgmt.machinelearningservices.models.ContainerType :ivar tail: The maximum number of lines to tail. :vartype tail: int @@ -7600,7 +8591,7 @@ def __init__( ): """ :keyword container_type: The type of container to retrieve logs from. Known values are: - "StorageInitializer" and "InferenceServer". + "StorageInitializer", "InferenceServer", and "ModelDataCollector". :paramtype container_type: str or ~azure.mgmt.machinelearningservices.models.ContainerType :keyword tail: The maximum number of lines to tail. :paramtype tail: int @@ -7963,18 +8954,48 @@ def __init__(self, **kwargs): self.distribution_type: Optional[str] = None -class EncryptionKeyVaultProperties(_serialization.Model): - """EncryptionKeyVaultProperties. +class Docker(_serialization.Model): + """Docker. - All required parameters must be populated in order to send to Azure. + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar privileged: Indicate whether container shall run in privileged or non-privileged mode. + :vartype privileged: bool + """ - :ivar key_vault_arm_id: The ArmId of the keyVault where the customer owned encryption key is - present. Required. - :vartype key_vault_arm_id: str - :ivar key_identifier: Key vault uri to access the encryption key. Required. - :vartype key_identifier: str - :ivar identity_client_id: For future use - The client id of the identity which will be used to - access key vault. + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "privileged": {"key": "privileged", "type": "bool"}, + } + + def __init__( + self, *, additional_properties: Optional[Dict[str, Any]] = None, privileged: Optional[bool] = None, **kwargs + ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword privileged: Indicate whether container shall run in privileged or non-privileged mode. + :paramtype privileged: bool + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.privileged = privileged + + +class EncryptionKeyVaultProperties(_serialization.Model): + """EncryptionKeyVaultProperties. + + All required parameters must be populated in order to send to Azure. + + :ivar key_vault_arm_id: The ArmId of the keyVault where the customer owned encryption key is + present. Required. + :vartype key_vault_arm_id: str + :ivar key_identifier: Key vault uri to access the encryption key. Required. + :vartype key_identifier: str + :ivar identity_client_id: For future use - The client id of the identity which will be used to + access key vault. :vartype identity_client_id: str """ @@ -8008,6 +9029,32 @@ def __init__( self.identity_client_id = identity_client_id +class EncryptionKeyVaultUpdateProperties(_serialization.Model): + """EncryptionKeyVaultUpdateProperties. + + All required parameters must be populated in order to send to Azure. + + :ivar key_identifier: Key Vault uri to access the encryption key. Required. + :vartype key_identifier: str + """ + + _validation = { + "key_identifier": {"required": True}, + } + + _attribute_map = { + "key_identifier": {"key": "keyIdentifier", "type": "str"}, + } + + def __init__(self, *, key_identifier: str, **kwargs): + """ + :keyword key_identifier: Key Vault uri to access the encryption key. Required. + :paramtype key_identifier: str + """ + super().__init__(**kwargs) + self.key_identifier = key_identifier + + class EncryptionProperty(_serialization.Model): """EncryptionProperty. @@ -8059,6 +9106,89 @@ def __init__( self.key_vault_properties = key_vault_properties +class EncryptionUpdateProperties(_serialization.Model): + """EncryptionUpdateProperties. + + All required parameters must be populated in order to send to Azure. + + :ivar key_vault_properties: Customer Key vault properties. Required. + :vartype key_vault_properties: + ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultUpdateProperties + """ + + _validation = { + "key_vault_properties": {"required": True}, + } + + _attribute_map = { + "key_vault_properties": {"key": "keyVaultProperties", "type": "EncryptionKeyVaultUpdateProperties"}, + } + + def __init__(self, *, key_vault_properties: "_models.EncryptionKeyVaultUpdateProperties", **kwargs): + """ + :keyword key_vault_properties: Customer Key vault properties. Required. + :paramtype key_vault_properties: + ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultUpdateProperties + """ + super().__init__(**kwargs) + self.key_vault_properties = key_vault_properties + + +class Endpoint(_serialization.Model): + """Endpoint. + + :ivar protocol: Protocol over which communication will happen over this endpoint. Known values + are: "tcp", "udp", and "http". + :vartype protocol: str or ~azure.mgmt.machinelearningservices.models.Protocol + :ivar name: Name of the Endpoint. + :vartype name: str + :ivar target: Application port inside the container. + :vartype target: int + :ivar published: Port over which the application is exposed from container. + :vartype published: int + :ivar host_ip: Host IP over which the application is exposed from the container. + :vartype host_ip: str + """ + + _attribute_map = { + "protocol": {"key": "protocol", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "target": {"key": "target", "type": "int"}, + "published": {"key": "published", "type": "int"}, + "host_ip": {"key": "hostIp", "type": "str"}, + } + + def __init__( + self, + *, + protocol: Union[str, "_models.Protocol"] = "tcp", + name: Optional[str] = None, + target: Optional[int] = None, + published: Optional[int] = None, + host_ip: Optional[str] = None, + **kwargs + ): + """ + :keyword protocol: Protocol over which communication will happen over this endpoint. Known + values are: "tcp", "udp", and "http". + :paramtype protocol: str or ~azure.mgmt.machinelearningservices.models.Protocol + :keyword name: Name of the Endpoint. + :paramtype name: str + :keyword target: Application port inside the container. + :paramtype target: int + :keyword published: Port over which the application is exposed from container. + :paramtype published: int + :keyword host_ip: Host IP over which the application is exposed from the container. + :paramtype host_ip: str + """ + super().__init__(**kwargs) + self.protocol = protocol + self.name = name + self.target = target + self.published = published + self.host_ip = host_ip + + class EndpointAuthKeys(_serialization.Model): """Keys for endpoint authentication. @@ -8267,11 +9397,16 @@ class EnvironmentContainerProperties(AssetContainer): :vartype latest_version: str :ivar next_version: The next auto incremental version. :vartype next_version: str + :ivar provisioning_state: Provisioning state for the environment container. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { "latest_version": {"readonly": True}, "next_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -8281,6 +9416,7 @@ class EnvironmentContainerProperties(AssetContainer): "is_archived": {"key": "isArchived", "type": "bool"}, "latest_version": {"key": "latestVersion", "type": "str"}, "next_version": {"key": "nextVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -8303,6 +9439,7 @@ def __init__( :paramtype is_archived: bool """ super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None class EnvironmentContainerResourceArmPaginatedResult(_serialization.Model): @@ -8335,6 +9472,49 @@ def __init__( self.value = value +class EnvironmentVariable(_serialization.Model): + """EnvironmentVariable. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar type: Type of the Environment Variable. Possible values are: local - For local variable. + "local" + :vartype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType + :ivar value: Value of the Environment variable. + :vartype value: str + """ + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + type: Union[str, "_models.EnvironmentVariableType"] = "local", + value: Optional[str] = None, + **kwargs + ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword type: Type of the Environment Variable. Possible values are: local - For local + variable. "local" + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentVariableType + :keyword value: Value of the Environment variable. + :paramtype value: str + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.type = type + self.value = value + + class EnvironmentVersion(Resource): """Azure Resource Manager resource envelope. @@ -8436,10 +9616,15 @@ class EnvironmentVersionProperties(AssetBase): # pylint: disable=too-many-insta ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties :ivar os_type: The OS type of the environment. Known values are: "Linux" and "Windows". :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType + :ivar provisioning_state: Provisioning state for the environment version. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { "environment_type": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -8455,6 +9640,7 @@ class EnvironmentVersionProperties(AssetBase): # pylint: disable=too-many-insta "image": {"key": "image", "type": "str"}, "inference_config": {"key": "inferenceConfig", "type": "InferenceContainerProperties"}, "os_type": {"key": "osType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -8529,6 +9715,7 @@ def __init__( self.image = image self.inference_config = inference_config self.os_type = os_type + self.provisioning_state = None class EnvironmentVersionResourceArmPaginatedResult(_serialization.Model): @@ -8839,11 +10026,19 @@ class Forecasting(TableVertical, AutoMLVertical): # pylint: disable=too-many-in :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset when validation dataset is not provided. :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings :ivar test_data: Test data input. :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation @@ -8885,8 +10080,11 @@ class Forecasting(TableVertical, AutoMLVertical): # pylint: disable=too-many-in "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "TableFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "search_space": {"key": "searchSpace", "type": "[TableParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "TableSweepSettings"}, "test_data": {"key": "testData", "type": "MLTableJobInput"}, "test_data_size": {"key": "testDataSize", "type": "float"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, @@ -8905,8 +10103,11 @@ def __init__( target_column_name: Optional[str] = None, cv_split_column_names: Optional[List[str]] = None, featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.TableFixedParameters"] = None, limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, n_cross_validations: Optional["_models.NCrossValidations"] = None, + search_space: Optional[List["_models.TableParameterSubspace"]] = None, + sweep_settings: Optional["_models.TableSweepSettings"] = None, test_data: Optional["_models.MLTableJobInput"] = None, test_data_size: Optional[float] = None, validation_data: Optional["_models.MLTableJobInput"] = None, @@ -8931,6 +10132,9 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings @@ -8938,6 +10142,12 @@ def __init__( dataset when validation dataset is not provided. :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings :keyword test_data: Test data input. :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation @@ -8969,8 +10179,11 @@ def __init__( super().__init__( cv_split_column_names=cv_split_column_names, featurization_settings=featurization_settings, + fixed_parameters=fixed_parameters, limit_settings=limit_settings, n_cross_validations=n_cross_validations, + search_space=search_space, + sweep_settings=sweep_settings, test_data=test_data, test_data_size=test_data_size, validation_data=validation_data, @@ -8990,8 +10203,11 @@ def __init__( self.training_settings = training_settings self.cv_split_column_names = cv_split_column_names self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings self.n_cross_validations = n_cross_validations + self.search_space = search_space + self.sweep_settings = sweep_settings self.test_data = test_data self.test_data_size = test_data_size self.validation_data = validation_data @@ -9176,6 +10392,14 @@ class ForecastingTrainingSettings(TrainingSettings): :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. :vartype stack_ensemble_settings: ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :ivar training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :vartype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode :ivar allowed_training_algorithms: Allowed models for forecasting task. :vartype allowed_training_algorithms: list[str or ~azure.mgmt.machinelearningservices.models.ForecastingModels] @@ -9192,6 +10416,7 @@ class ForecastingTrainingSettings(TrainingSettings): "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, + "training_mode": {"key": "trainingMode", "type": "str"}, "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, } @@ -9206,6 +10431,7 @@ def __init__( enable_vote_ensemble: bool = True, ensemble_model_download_timeout: datetime.timedelta = "PT5M", stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, + training_mode: Optional[Union[str, "_models.TrainingMode"]] = None, allowed_training_algorithms: Optional[List[Union[str, "_models.ForecastingModels"]]] = None, blocked_training_algorithms: Optional[List[Union[str, "_models.ForecastingModels"]]] = None, **kwargs @@ -9228,6 +10454,14 @@ def __init__( :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. :paramtype stack_ensemble_settings: ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :keyword training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :paramtype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode :keyword allowed_training_algorithms: Allowed models for forecasting task. :paramtype allowed_training_algorithms: list[str or ~azure.mgmt.machinelearningservices.models.ForecastingModels] @@ -9243,6 +10477,7 @@ def __init__( enable_vote_ensemble=enable_vote_ensemble, ensemble_model_download_timeout=ensemble_model_download_timeout, stack_ensemble_settings=stack_ensemble_settings, + training_mode=training_mode, **kwargs ) self.allowed_training_algorithms = allowed_training_algorithms @@ -9376,6 +10611,91 @@ def __init__(self, **kwargs): self.sampling_algorithm_type: str = "Grid" +class HdfsDatastore(DatastoreProperties): + """HdfsDatastore. + + 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 description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar credentials: [Required] Account credentials. Required. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :ivar datastore_type: [Required] Storage type backing the datastore. Required. Known values + are: "AzureBlob", "AzureDataLakeGen1", "AzureDataLakeGen2", "AzureFile", and "Hdfs". + :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType + :ivar is_default: Readonly property to indicate if datastore is the workspace default + datastore. + :vartype is_default: bool + :ivar hdfs_server_certificate: The TLS cert of the HDFS server. Needs to be a base64 encoded + string. Required if "Https" protocol is selected. + :vartype hdfs_server_certificate: str + :ivar name_node_address: [Required] IP Address or DNS HostName. Required. + :vartype name_node_address: str + :ivar protocol: Protocol used to communicate with the storage account (Https/Http). + :vartype protocol: str + """ + + _validation = { + "credentials": {"required": True}, + "datastore_type": {"required": True}, + "is_default": {"readonly": True}, + "name_node_address": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "credentials": {"key": "credentials", "type": "DatastoreCredentials"}, + "datastore_type": {"key": "datastoreType", "type": "str"}, + "is_default": {"key": "isDefault", "type": "bool"}, + "hdfs_server_certificate": {"key": "hdfsServerCertificate", "type": "str"}, + "name_node_address": {"key": "nameNodeAddress", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + } + + def __init__( + self, + *, + credentials: "_models.DatastoreCredentials", + name_node_address: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + hdfs_server_certificate: Optional[str] = None, + protocol: str = "http", + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword credentials: [Required] Account credentials. Required. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.DatastoreCredentials + :keyword hdfs_server_certificate: The TLS cert of the HDFS server. Needs to be a base64 encoded + string. Required if "Https" protocol is selected. + :paramtype hdfs_server_certificate: str + :keyword name_node_address: [Required] IP Address or DNS HostName. Required. + :paramtype name_node_address: str + :keyword protocol: Protocol used to communicate with the storage account (Https/Http). + :paramtype protocol: str + """ + super().__init__(description=description, properties=properties, tags=tags, credentials=credentials, **kwargs) + self.datastore_type: str = "Hdfs" + self.hdfs_server_certificate = hdfs_server_certificate + self.name_node_address = name_node_address + self.protocol = protocol + + class HDInsightSchema(_serialization.Model): """HDInsightSchema. @@ -9413,7 +10733,7 @@ class HDInsight(Compute, HDInsightSchema): # pylint: disable=too-many-instance- :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -9596,6 +10916,71 @@ def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs): self.user_assigned_identity = user_assigned_identity +class IdleShutdownSetting(_serialization.Model): + """Stops compute instance after user defined period of inactivity. + + :ivar idle_time_before_shutdown: Time is defined in ISO8601 format. Minimum is 15 min, maximum + is 3 days. + :vartype idle_time_before_shutdown: str + """ + + _attribute_map = { + "idle_time_before_shutdown": {"key": "idleTimeBeforeShutdown", "type": "str"}, + } + + def __init__(self, *, idle_time_before_shutdown: Optional[str] = None, **kwargs): + """ + :keyword idle_time_before_shutdown: Time is defined in ISO8601 format. Minimum is 15 min, + maximum is 3 days. + :paramtype idle_time_before_shutdown: str + """ + super().__init__(**kwargs) + self.idle_time_before_shutdown = idle_time_before_shutdown + + +class Image(_serialization.Model): + """Image. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar type: Type of the image. Possible values are: docker - For docker images. azureml - For + AzureML images. Known values are: "docker" and "azureml". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.ImageType + :ivar reference: Image reference URL. + :vartype reference: str + """ + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "reference": {"key": "reference", "type": "str"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + type: Union[str, "_models.ImageType"] = "docker", + reference: Optional[str] = None, + **kwargs + ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword type: Type of the image. Possible values are: docker - For docker images. azureml - + For AzureML images. Known values are: "docker" and "azureml". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ImageType + :keyword reference: Image reference URL. + :paramtype reference: str + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.type = type + self.reference = reference + + class ImageVertical(_serialization.Model): """Abstract class for AutoML tasks that train image (computer vision) models - such as Image Classification / Image Classification Multilabel / Image Object Detection / Image Instance Segmentation. @@ -10260,6 +11645,49 @@ def __init__( self.timeout = timeout +class ImageMetadata(_serialization.Model): + """Returns metadata about the operating system image for this compute instance. + + :ivar current_image_version: Specifies the current operating system image version this compute + instance is running on. + :vartype current_image_version: str + :ivar latest_image_version: Specifies the latest available operating system image version. + :vartype latest_image_version: str + :ivar is_latest_os_image_version: Specifies whether this compute instance is running on the + latest operating system image. + :vartype is_latest_os_image_version: bool + """ + + _attribute_map = { + "current_image_version": {"key": "currentImageVersion", "type": "str"}, + "latest_image_version": {"key": "latestImageVersion", "type": "str"}, + "is_latest_os_image_version": {"key": "isLatestOsImageVersion", "type": "bool"}, + } + + def __init__( + self, + *, + current_image_version: Optional[str] = None, + latest_image_version: Optional[str] = None, + is_latest_os_image_version: Optional[bool] = None, + **kwargs + ): + """ + :keyword current_image_version: Specifies the current operating system image version this + compute instance is running on. + :paramtype current_image_version: str + :keyword latest_image_version: Specifies the latest available operating system image version. + :paramtype latest_image_version: str + :keyword is_latest_os_image_version: Specifies whether this compute instance is running on the + latest operating system image. + :paramtype is_latest_os_image_version: bool + """ + super().__init__(**kwargs) + self.current_image_version = current_image_version + self.latest_image_version = latest_image_version + self.is_latest_os_image_version = is_latest_os_image_version + + class ImageModelDistributionSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes """Distribution expressions to sweep over values of model settings. @@ -12793,7 +14221,10 @@ class JobService(_serialization.Model): :vartype error_message: str :ivar job_service_type: Endpoint type. :vartype job_service_type: str - :ivar port: Port for endpoint. + :ivar nodes: Nodes that user would like to start the service on. + If Nodes is not set or set to null, the service will only be started on leader node. + :vartype nodes: ~azure.mgmt.machinelearningservices.models.Nodes + :ivar port: Port for endpoint set by user. :vartype port: int :ivar properties: Additional properties to set on the endpoint. :vartype properties: dict[str, str] @@ -12810,6 +14241,7 @@ class JobService(_serialization.Model): "endpoint": {"key": "endpoint", "type": "str"}, "error_message": {"key": "errorMessage", "type": "str"}, "job_service_type": {"key": "jobServiceType", "type": "str"}, + "nodes": {"key": "nodes", "type": "Nodes"}, "port": {"key": "port", "type": "int"}, "properties": {"key": "properties", "type": "{str}"}, "status": {"key": "status", "type": "str"}, @@ -12820,6 +14252,7 @@ def __init__( *, endpoint: Optional[str] = None, job_service_type: Optional[str] = None, + nodes: Optional["_models.Nodes"] = None, port: Optional[int] = None, properties: Optional[Dict[str, str]] = None, **kwargs @@ -12829,7 +14262,10 @@ def __init__( :paramtype endpoint: str :keyword job_service_type: Endpoint type. :paramtype job_service_type: str - :keyword port: Port for endpoint. + :keyword nodes: Nodes that user would like to start the service on. + If Nodes is not set or set to null, the service will only be started on leader node. + :paramtype nodes: ~azure.mgmt.machinelearningservices.models.Nodes + :keyword port: Port for endpoint set by user. :paramtype port: int :keyword properties: Additional properties to set on the endpoint. :paramtype properties: dict[str, str] @@ -12838,41 +14274,286 @@ def __init__( self.endpoint = endpoint self.error_message = None self.job_service_type = job_service_type + self.nodes = nodes self.port = port self.properties = properties self.status = None -class KubernetesSchema(_serialization.Model): - """Kubernetes Compute Schema. +class KerberosCredentials(_serialization.Model): + """KerberosCredentials. - :ivar properties: Properties of Kubernetes. - :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + All required parameters must be populated in order to send to Azure. + + :ivar kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :vartype kerberos_kdc_address: str + :ivar kerberos_principal: [Required] Kerberos Username. Required. + :vartype kerberos_principal: str + :ivar kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :vartype kerberos_realm: str """ + _validation = { + "kerberos_kdc_address": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_principal": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_realm": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + } + _attribute_map = { - "properties": {"key": "properties", "type": "KubernetesProperties"}, + "kerberos_kdc_address": {"key": "kerberosKdcAddress", "type": "str"}, + "kerberos_principal": {"key": "kerberosPrincipal", "type": "str"}, + "kerberos_realm": {"key": "kerberosRealm", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.KubernetesProperties"] = None, **kwargs): + def __init__(self, *, kerberos_kdc_address: str, kerberos_principal: str, kerberos_realm: str, **kwargs): """ - :keyword properties: Properties of Kubernetes. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + :keyword kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :paramtype kerberos_kdc_address: str + :keyword kerberos_principal: [Required] Kerberos Username. Required. + :paramtype kerberos_principal: str + :keyword kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :paramtype kerberos_realm: str """ super().__init__(**kwargs) - self.properties = properties - + self.kerberos_kdc_address = kerberos_kdc_address + self.kerberos_principal = kerberos_principal + self.kerberos_realm = kerberos_realm -class Kubernetes(Compute, KubernetesSchema): # pylint: disable=too-many-instance-attributes - """A Machine Learning compute based on Kubernetes Compute. - Variables are only populated by the server, and will be ignored when sending a request. +class KerberosKeytabCredentials(KerberosCredentials, DatastoreCredentials): + """KerberosKeytabCredentials. All required parameters must be populated in order to send to Azure. - :ivar properties: Properties of Kubernetes. - :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties - :ivar compute_type: The type of compute. Required. Known values are: "AKS", "Kubernetes", + :ivar credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :vartype kerberos_kdc_address: str + :ivar kerberos_principal: [Required] Kerberos Username. Required. + :vartype kerberos_principal: str + :ivar kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :vartype kerberos_realm: str + :ivar secrets: [Required] Keytab secrets. Required. + :vartype secrets: ~azure.mgmt.machinelearningservices.models.KerberosKeytabSecrets + """ + + _validation = { + "credentials_type": {"required": True}, + "kerberos_kdc_address": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_principal": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_realm": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "secrets": {"required": True}, + } + + _attribute_map = { + "credentials_type": {"key": "credentialsType", "type": "str"}, + "kerberos_kdc_address": {"key": "kerberosKdcAddress", "type": "str"}, + "kerberos_principal": {"key": "kerberosPrincipal", "type": "str"}, + "kerberos_realm": {"key": "kerberosRealm", "type": "str"}, + "secrets": {"key": "secrets", "type": "KerberosKeytabSecrets"}, + } + + def __init__( + self, + *, + kerberos_kdc_address: str, + kerberos_principal: str, + kerberos_realm: str, + secrets: "_models.KerberosKeytabSecrets", + **kwargs + ): + """ + :keyword kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :paramtype kerberos_kdc_address: str + :keyword kerberos_principal: [Required] Kerberos Username. Required. + :paramtype kerberos_principal: str + :keyword kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :paramtype kerberos_realm: str + :keyword secrets: [Required] Keytab secrets. Required. + :paramtype secrets: ~azure.mgmt.machinelearningservices.models.KerberosKeytabSecrets + """ + super().__init__( + kerberos_kdc_address=kerberos_kdc_address, + kerberos_principal=kerberos_principal, + kerberos_realm=kerberos_realm, + **kwargs + ) + self.credentials_type: str = "KerberosKeytab" + self.secrets = secrets + self.kerberos_kdc_address = kerberos_kdc_address + self.kerberos_principal = kerberos_principal + self.kerberos_realm = kerberos_realm + + +class KerberosKeytabSecrets(DatastoreSecrets): + """KerberosKeytabSecrets. + + All required parameters must be populated in order to send to Azure. + + :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". + :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType + :ivar kerberos_keytab: Kerberos keytab secret. + :vartype kerberos_keytab: str + """ + + _validation = { + "secrets_type": {"required": True}, + } + + _attribute_map = { + "secrets_type": {"key": "secretsType", "type": "str"}, + "kerberos_keytab": {"key": "kerberosKeytab", "type": "str"}, + } + + def __init__(self, *, kerberos_keytab: Optional[str] = None, **kwargs): + """ + :keyword kerberos_keytab: Kerberos keytab secret. + :paramtype kerberos_keytab: str + """ + super().__init__(**kwargs) + self.secrets_type: str = "KerberosKeytab" + self.kerberos_keytab = kerberos_keytab + + +class KerberosPasswordCredentials(KerberosCredentials, DatastoreCredentials): + """KerberosPasswordCredentials. + + All required parameters must be populated in order to send to Azure. + + :ivar credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :vartype kerberos_kdc_address: str + :ivar kerberos_principal: [Required] Kerberos Username. Required. + :vartype kerberos_principal: str + :ivar kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :vartype kerberos_realm: str + :ivar secrets: [Required] Kerberos password secrets. Required. + :vartype secrets: ~azure.mgmt.machinelearningservices.models.KerberosPasswordSecrets + """ + + _validation = { + "credentials_type": {"required": True}, + "kerberos_kdc_address": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_principal": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "kerberos_realm": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "secrets": {"required": True}, + } + + _attribute_map = { + "credentials_type": {"key": "credentialsType", "type": "str"}, + "kerberos_kdc_address": {"key": "kerberosKdcAddress", "type": "str"}, + "kerberos_principal": {"key": "kerberosPrincipal", "type": "str"}, + "kerberos_realm": {"key": "kerberosRealm", "type": "str"}, + "secrets": {"key": "secrets", "type": "KerberosPasswordSecrets"}, + } + + def __init__( + self, + *, + kerberos_kdc_address: str, + kerberos_principal: str, + kerberos_realm: str, + secrets: "_models.KerberosPasswordSecrets", + **kwargs + ): + """ + :keyword kerberos_kdc_address: [Required] IP Address or DNS HostName. Required. + :paramtype kerberos_kdc_address: str + :keyword kerberos_principal: [Required] Kerberos Username. Required. + :paramtype kerberos_principal: str + :keyword kerberos_realm: [Required] Domain over which a Kerberos authentication server has the + authority to authenticate a user, host or service. Required. + :paramtype kerberos_realm: str + :keyword secrets: [Required] Kerberos password secrets. Required. + :paramtype secrets: ~azure.mgmt.machinelearningservices.models.KerberosPasswordSecrets + """ + super().__init__( + kerberos_kdc_address=kerberos_kdc_address, + kerberos_principal=kerberos_principal, + kerberos_realm=kerberos_realm, + **kwargs + ) + self.credentials_type: str = "KerberosPassword" + self.secrets = secrets + self.kerberos_kdc_address = kerberos_kdc_address + self.kerberos_principal = kerberos_principal + self.kerberos_realm = kerberos_realm + + +class KerberosPasswordSecrets(DatastoreSecrets): + """KerberosPasswordSecrets. + + All required parameters must be populated in order to send to Azure. + + :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". + :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType + :ivar kerberos_password: Kerberos password secret. + :vartype kerberos_password: str + """ + + _validation = { + "secrets_type": {"required": True}, + } + + _attribute_map = { + "secrets_type": {"key": "secretsType", "type": "str"}, + "kerberos_password": {"key": "kerberosPassword", "type": "str"}, + } + + def __init__(self, *, kerberos_password: Optional[str] = None, **kwargs): + """ + :keyword kerberos_password: Kerberos password secret. + :paramtype kerberos_password: str + """ + super().__init__(**kwargs) + self.secrets_type: str = "KerberosPassword" + self.kerberos_password = kerberos_password + + +class KubernetesSchema(_serialization.Model): + """Kubernetes Compute Schema. + + :ivar properties: Properties of Kubernetes. + :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "KubernetesProperties"}, + } + + def __init__(self, *, properties: Optional["_models.KubernetesProperties"] = None, **kwargs): + """ + :keyword properties: Properties of Kubernetes. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class Kubernetes(Compute, KubernetesSchema): # pylint: disable=too-many-instance-attributes + """A Machine Learning compute based on Kubernetes Compute. + + 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 properties: Properties of Kubernetes. + :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + :ivar compute_type: The type of compute. Required. Known values are: "AKS", "Kubernetes", "AmlCompute", "ComputeInstance", "DataFactory", "VirtualMachine", "HDInsight", "Databricks", "DataLakeAnalytics", and "SynapseSpark". :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.ComputeType @@ -12880,7 +14561,7 @@ class Kubernetes(Compute, KubernetesSchema): # pylint: disable=too-many-instanc :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -12982,8 +14663,8 @@ class OnlineDeploymentProperties(EndpointDeploymentPropertiesBase): # pylint: d :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :ivar description: Description of the endpoint deployment. :vartype description: str - :ivar environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :ivar environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :vartype environment_id: str :ivar environment_variables: Environment variables configuration for the deployment. :vartype environment_variables: dict[str, str] @@ -13076,8 +14757,8 @@ def __init__( :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :keyword description: Description of the endpoint deployment. :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :keyword environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :paramtype environment_id: str :keyword environment_variables: Environment variables configuration for the deployment. :paramtype environment_variables: dict[str, str] @@ -13141,8 +14822,8 @@ class KubernetesOnlineDeployment(OnlineDeploymentProperties): # pylint: disable :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :ivar description: Description of the endpoint deployment. :vartype description: str - :ivar environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :ivar environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :vartype environment_id: str :ivar environment_variables: Environment variables configuration for the deployment. :vartype environment_variables: dict[str, str] @@ -13240,8 +14921,8 @@ def __init__( :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :keyword description: Description of the endpoint deployment. :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :keyword environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :paramtype environment_id: str :keyword environment_variables: Environment variables configuration for the deployment. :paramtype environment_variables: dict[str, str] @@ -13374,105 +15055,594 @@ def __init__( self.instance_types = instance_types -class ListAmlUserFeatureResult(_serialization.Model): - """The List Aml user feature operation response. +class LabelCategory(_serialization.Model): + """Label category definition. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar classes: Dictionary of label classes in this category. + :vartype classes: dict[str, ~azure.mgmt.machinelearningservices.models.LabelClass] + :ivar display_name: Display name of the label category. + :vartype display_name: str + :ivar multi_select: Indicates whether it is allowed to select multiple classes in this + category. Known values are: "Enabled" and "Disabled". + :vartype multi_select: str or ~azure.mgmt.machinelearningservices.models.MultiSelect + """ - :ivar value: The list of AML user facing features. - :vartype value: list[~azure.mgmt.machinelearningservices.models.AmlUserFeature] - :ivar next_link: The URI to fetch the next page of AML user features information. Call - ListNext() with this to fetch the next page of AML user features information. - :vartype next_link: str + _attribute_map = { + "classes": {"key": "classes", "type": "{LabelClass}"}, + "display_name": {"key": "displayName", "type": "str"}, + "multi_select": {"key": "multiSelect", "type": "str"}, + } + + def __init__( + self, + *, + classes: Optional[Dict[str, "_models.LabelClass"]] = None, + display_name: Optional[str] = None, + multi_select: Optional[Union[str, "_models.MultiSelect"]] = None, + **kwargs + ): + """ + :keyword classes: Dictionary of label classes in this category. + :paramtype classes: dict[str, ~azure.mgmt.machinelearningservices.models.LabelClass] + :keyword display_name: Display name of the label category. + :paramtype display_name: str + :keyword multi_select: Indicates whether it is allowed to select multiple classes in this + category. Known values are: "Enabled" and "Disabled". + :paramtype multi_select: str or ~azure.mgmt.machinelearningservices.models.MultiSelect + """ + super().__init__(**kwargs) + self.classes = classes + self.display_name = display_name + self.multi_select = multi_select + + +class LabelClass(_serialization.Model): + """Label class definition. + + :ivar display_name: Display name of the label class. + :vartype display_name: str + :ivar subclasses: Dictionary of subclasses of the label class. + :vartype subclasses: dict[str, ~azure.mgmt.machinelearningservices.models.LabelClass] """ - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + _attribute_map = { + "display_name": {"key": "displayName", "type": "str"}, + "subclasses": {"key": "subclasses", "type": "{LabelClass}"}, } + def __init__( + self, + *, + display_name: Optional[str] = None, + subclasses: Optional[Dict[str, "_models.LabelClass"]] = None, + **kwargs + ): + """ + :keyword display_name: Display name of the label class. + :paramtype display_name: str + :keyword subclasses: Dictionary of subclasses of the label class. + :paramtype subclasses: dict[str, ~azure.mgmt.machinelearningservices.models.LabelClass] + """ + super().__init__(**kwargs) + self.display_name = display_name + self.subclasses = subclasses + + +class LabelingDataConfiguration(_serialization.Model): + """Labeling data configuration definition. + + :ivar data_id: Resource Id of the data asset to perform labeling. + :vartype data_id: str + :ivar incremental_data_refresh: Indicates whether to enable incremental data refresh. Known + values are: "Enabled" and "Disabled". + :vartype incremental_data_refresh: str or + ~azure.mgmt.machinelearningservices.models.IncrementalDataRefresh + """ + _attribute_map = { - "value": {"key": "value", "type": "[AmlUserFeature]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "data_id": {"key": "dataId", "type": "str"}, + "incremental_data_refresh": {"key": "incrementalDataRefresh", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__( + self, + *, + data_id: Optional[str] = None, + incremental_data_refresh: Optional[Union[str, "_models.IncrementalDataRefresh"]] = None, + **kwargs + ): + """ + :keyword data_id: Resource Id of the data asset to perform labeling. + :paramtype data_id: str + :keyword incremental_data_refresh: Indicates whether to enable incremental data refresh. Known + values are: "Enabled" and "Disabled". + :paramtype incremental_data_refresh: str or + ~azure.mgmt.machinelearningservices.models.IncrementalDataRefresh + """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.data_id = data_id + self.incremental_data_refresh = incremental_data_refresh -class ListNotebookKeysResult(_serialization.Model): - """ListNotebookKeysResult. +class LabelingJob(Resource): + """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. - :ivar primary_access_key: - :vartype primary_access_key: str - :ivar secondary_access_key: - :vartype secondary_access_key: str + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.LabelingJobProperties """ _validation = { - "primary_access_key": {"readonly": True}, - "secondary_access_key": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { - "primary_access_key": {"key": "primaryAccessKey", "type": "str"}, - "secondary_access_key": {"key": "secondaryAccessKey", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "LabelingJobProperties"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, properties: "_models.LabelingJobProperties", **kwargs): + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.LabelingJobProperties + """ super().__init__(**kwargs) - self.primary_access_key = None - self.secondary_access_key = None + self.properties = properties -class ListStorageAccountKeysResult(_serialization.Model): - """ListStorageAccountKeysResult. +class LabelingJobMediaProperties(_serialization.Model): + """Properties of a labeling job. - Variables are only populated by the server, and will be ignored when sending a request. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + LabelingJobImageProperties, LabelingJobTextProperties - :ivar user_storage_key: - :vartype user_storage_key: str + All required parameters must be populated in order to send to Azure. + + :ivar media_type: [Required] Media type of the job. Required. Known values are: "Image" and + "Text". + :vartype media_type: str or ~azure.mgmt.machinelearningservices.models.MediaType """ _validation = { - "user_storage_key": {"readonly": True}, + "media_type": {"required": True}, } _attribute_map = { - "user_storage_key": {"key": "userStorageKey", "type": "str"}, + "media_type": {"key": "mediaType", "type": "str"}, } + _subtype_map = {"media_type": {"Image": "LabelingJobImageProperties", "Text": "LabelingJobTextProperties"}} + def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.user_storage_key = None + self.media_type: Optional[str] = None -class ListUsagesResult(_serialization.Model): - """The List Usages operation response. +class LabelingJobImageProperties(LabelingJobMediaProperties): + """Properties of a labeling job for image data. - 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 value: The list of AML resource usages. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Usage] - :ivar next_link: The URI to fetch the next page of AML resource usage information. Call - ListNext() with this to fetch the next page of AML resource usage information. - :vartype next_link: str + :ivar media_type: [Required] Media type of the job. Required. Known values are: "Image" and + "Text". + :vartype media_type: str or ~azure.mgmt.machinelearningservices.models.MediaType + :ivar annotation_type: Annotation type of image labeling job. Known values are: + "Classification", "BoundingBox", and "InstanceSegmentation". + :vartype annotation_type: str or ~azure.mgmt.machinelearningservices.models.ImageAnnotationType """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "media_type": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[Usage]"}, + "media_type": {"key": "mediaType", "type": "str"}, + "annotation_type": {"key": "annotationType", "type": "str"}, + } + + def __init__(self, *, annotation_type: Optional[Union[str, "_models.ImageAnnotationType"]] = None, **kwargs): + """ + :keyword annotation_type: Annotation type of image labeling job. Known values are: + "Classification", "BoundingBox", and "InstanceSegmentation". + :paramtype annotation_type: str or + ~azure.mgmt.machinelearningservices.models.ImageAnnotationType + """ + super().__init__(**kwargs) + self.media_type: str = "Image" + self.annotation_type = annotation_type + + +class LabelingJobInstructions(_serialization.Model): + """Instructions for labeling job. + + :ivar uri: The link to a page with detailed labeling instructions for labelers. + :vartype uri: str + """ + + _attribute_map = { + "uri": {"key": "uri", "type": "str"}, + } + + def __init__(self, *, uri: Optional[str] = None, **kwargs): + """ + :keyword uri: The link to a page with detailed labeling instructions for labelers. + :paramtype uri: str + """ + super().__init__(**kwargs) + self.uri = uri + + +class LabelingJobProperties(JobBaseProperties): # pylint: disable=too-many-instance-attributes + """Labeling job 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 description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar component_id: ARM resource ID of the component resource. + :vartype component_id: str + :ivar compute_id: ARM resource ID of the compute resource. + :vartype compute_id: str + :ivar display_name: Display name of job. + :vartype display_name: str + :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :vartype experiment_name: str + :ivar identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", + "Command", "Labeling", "Sweep", "Pipeline", and "Spark". + :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", + "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar created_date_time: Created time of the job in UTC timezone. + :vartype created_date_time: ~datetime.datetime + :ivar data_configuration: Configuration of data used in the job. + :vartype data_configuration: + ~azure.mgmt.machinelearningservices.models.LabelingDataConfiguration + :ivar job_instructions: Labeling instructions of the job. + :vartype job_instructions: ~azure.mgmt.machinelearningservices.models.LabelingJobInstructions + :ivar label_categories: Label categories of the job. + :vartype label_categories: dict[str, ~azure.mgmt.machinelearningservices.models.LabelCategory] + :ivar labeling_job_media_properties: Media type specific properties in the job. + :vartype labeling_job_media_properties: + ~azure.mgmt.machinelearningservices.models.LabelingJobMediaProperties + :ivar ml_assist_configuration: Configuration of MLAssist feature in the job. + :vartype ml_assist_configuration: + ~azure.mgmt.machinelearningservices.models.MLAssistConfiguration + :ivar progress_metrics: Progress metrics of the job. + :vartype progress_metrics: ~azure.mgmt.machinelearningservices.models.ProgressMetrics + :ivar project_id: Internal id of the job(Previously called project). + :vartype project_id: str + :ivar provisioning_state: Specifies the labeling job provisioning state. Known values are: + "Succeeded", "Failed", "Canceled", and "InProgress". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.JobProvisioningState + :ivar status_messages: Status messages of the job. + :vartype status_messages: list[~azure.mgmt.machinelearningservices.models.StatusMessage] + """ + + _validation = { + "job_type": {"required": True}, + "status": {"readonly": True}, + "created_date_time": {"readonly": True}, + "progress_metrics": {"readonly": True}, + "project_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "status_messages": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "component_id": {"key": "componentId", "type": "str"}, + "compute_id": {"key": "computeId", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "experiment_name": {"key": "experimentName", "type": "str"}, + "identity": {"key": "identity", "type": "IdentityConfiguration"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "job_type": {"key": "jobType", "type": "str"}, + "services": {"key": "services", "type": "{JobService}"}, + "status": {"key": "status", "type": "str"}, + "created_date_time": {"key": "createdDateTime", "type": "iso-8601"}, + "data_configuration": {"key": "dataConfiguration", "type": "LabelingDataConfiguration"}, + "job_instructions": {"key": "jobInstructions", "type": "LabelingJobInstructions"}, + "label_categories": {"key": "labelCategories", "type": "{LabelCategory}"}, + "labeling_job_media_properties": {"key": "labelingJobMediaProperties", "type": "LabelingJobMediaProperties"}, + "ml_assist_configuration": {"key": "mlAssistConfiguration", "type": "MLAssistConfiguration"}, + "progress_metrics": {"key": "progressMetrics", "type": "ProgressMetrics"}, + "project_id": {"key": "projectId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "status_messages": {"key": "statusMessages", "type": "[StatusMessage]"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + component_id: Optional[str] = None, + compute_id: Optional[str] = None, + display_name: Optional[str] = None, + experiment_name: str = "Default", + identity: Optional["_models.IdentityConfiguration"] = None, + is_archived: bool = False, + services: Optional[Dict[str, "_models.JobService"]] = None, + data_configuration: Optional["_models.LabelingDataConfiguration"] = None, + job_instructions: Optional["_models.LabelingJobInstructions"] = None, + label_categories: Optional[Dict[str, "_models.LabelCategory"]] = None, + labeling_job_media_properties: Optional["_models.LabelingJobMediaProperties"] = None, + ml_assist_configuration: Optional["_models.MLAssistConfiguration"] = None, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword component_id: ARM resource ID of the component resource. + :paramtype component_id: str + :keyword compute_id: ARM resource ID of the compute resource. + :paramtype compute_id: str + :keyword display_name: Display name of job. + :paramtype display_name: str + :keyword experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :paramtype experiment_name: str + :keyword identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :keyword data_configuration: Configuration of data used in the job. + :paramtype data_configuration: + ~azure.mgmt.machinelearningservices.models.LabelingDataConfiguration + :keyword job_instructions: Labeling instructions of the job. + :paramtype job_instructions: ~azure.mgmt.machinelearningservices.models.LabelingJobInstructions + :keyword label_categories: Label categories of the job. + :paramtype label_categories: dict[str, + ~azure.mgmt.machinelearningservices.models.LabelCategory] + :keyword labeling_job_media_properties: Media type specific properties in the job. + :paramtype labeling_job_media_properties: + ~azure.mgmt.machinelearningservices.models.LabelingJobMediaProperties + :keyword ml_assist_configuration: Configuration of MLAssist feature in the job. + :paramtype ml_assist_configuration: + ~azure.mgmt.machinelearningservices.models.MLAssistConfiguration + """ + super().__init__( + description=description, + properties=properties, + tags=tags, + component_id=component_id, + compute_id=compute_id, + display_name=display_name, + experiment_name=experiment_name, + identity=identity, + is_archived=is_archived, + services=services, + **kwargs + ) + self.job_type: str = "Labeling" + self.created_date_time = None + self.data_configuration = data_configuration + self.job_instructions = job_instructions + self.label_categories = label_categories + self.labeling_job_media_properties = labeling_job_media_properties + self.ml_assist_configuration = ml_assist_configuration + self.progress_metrics = None + self.project_id = None + self.provisioning_state = None + self.status_messages = None + + +class LabelingJobResourceArmPaginatedResult(_serialization.Model): + """A paginated list of LabelingJob entities. + + :ivar next_link: The link to the next page of LabelingJob objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type LabelingJob. + :vartype value: list[~azure.mgmt.machinelearningservices.models.LabelingJob] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[LabelingJob]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.LabelingJob"]] = None, **kwargs + ): + """ + :keyword next_link: The link to the next page of LabelingJob objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type LabelingJob. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.LabelingJob] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class LabelingJobTextProperties(LabelingJobMediaProperties): + """Properties of a labeling job for text data. + + All required parameters must be populated in order to send to Azure. + + :ivar media_type: [Required] Media type of the job. Required. Known values are: "Image" and + "Text". + :vartype media_type: str or ~azure.mgmt.machinelearningservices.models.MediaType + :ivar annotation_type: Annotation type of text labeling job. Known values are: "Classification" + and "NamedEntityRecognition". + :vartype annotation_type: str or ~azure.mgmt.machinelearningservices.models.TextAnnotationType + """ + + _validation = { + "media_type": {"required": True}, + } + + _attribute_map = { + "media_type": {"key": "mediaType", "type": "str"}, + "annotation_type": {"key": "annotationType", "type": "str"}, + } + + def __init__(self, *, annotation_type: Optional[Union[str, "_models.TextAnnotationType"]] = None, **kwargs): + """ + :keyword annotation_type: Annotation type of text labeling job. Known values are: + "Classification" and "NamedEntityRecognition". + :paramtype annotation_type: str or + ~azure.mgmt.machinelearningservices.models.TextAnnotationType + """ + super().__init__(**kwargs) + self.media_type: str = "Text" + self.annotation_type = annotation_type + + +class ListAmlUserFeatureResult(_serialization.Model): + """The List Aml user feature operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of AML user facing features. + :vartype value: list[~azure.mgmt.machinelearningservices.models.AmlUserFeature] + :ivar next_link: The URI to fetch the next page of AML user features information. Call + ListNext() with this to fetch the next page of AML user features information. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[AmlUserFeature]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class ListNotebookKeysResult(_serialization.Model): + """ListNotebookKeysResult. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar primary_access_key: + :vartype primary_access_key: str + :ivar secondary_access_key: + :vartype secondary_access_key: str + """ + + _validation = { + "primary_access_key": {"readonly": True}, + "secondary_access_key": {"readonly": True}, + } + + _attribute_map = { + "primary_access_key": {"key": "primaryAccessKey", "type": "str"}, + "secondary_access_key": {"key": "secondaryAccessKey", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.primary_access_key = None + self.secondary_access_key = None + + +class ListStorageAccountKeysResult(_serialization.Model): + """ListStorageAccountKeysResult. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar user_storage_key: + :vartype user_storage_key: str + """ + + _validation = { + "user_storage_key": {"readonly": True}, + } + + _attribute_map = { + "user_storage_key": {"key": "userStorageKey", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.user_storage_key = None + + +class ListUsagesResult(_serialization.Model): + """The List Usages operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of AML resource usages. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Usage] + :ivar next_link: The URI to fetch the next page of AML resource usage information. Call + ListNext() with this to fetch the next page of AML resource usage information. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Usage]"}, "next_link": {"key": "nextLink", "type": "str"}, } @@ -13640,93 +15810,19 @@ def __init__( """ :keyword client_id: Specifies a user-assigned identity by client ID. For system-assigned, do not set this field. - :paramtype client_id: str - :keyword object_id: Specifies a user-assigned identity by object ID. For system-assigned, do - not set this field. - :paramtype object_id: str - :keyword resource_id: Specifies a user-assigned identity by ARM resource ID. For - system-assigned, do not set this field. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.identity_type: str = "Managed" - self.client_id = client_id - self.object_id = object_id - self.resource_id = resource_id - - -class WorkspaceConnectionPropertiesV2(_serialization.Model): - """WorkspaceConnectionPropertiesV2. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ManagedIdentityAuthTypeWorkspaceConnectionProperties, - NoneAuthTypeWorkspaceConnectionProperties, PATAuthTypeWorkspaceConnectionProperties, - SASAuthTypeWorkspaceConnectionProperties, UsernamePasswordAuthTypeWorkspaceConnectionProperties - - All required parameters must be populated in order to send to Azure. - - :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". - :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType - :ivar category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". - :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :ivar target: - :vartype target: str - :ivar value: Value details of the workspace connection. - :vartype value: str - :ivar value_format: format for the workspace connection value. "JSON" - :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat - """ - - _validation = { - "auth_type": {"required": True}, - } - - _attribute_map = { - "auth_type": {"key": "authType", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "value_format": {"key": "valueFormat", "type": "str"}, - } - - _subtype_map = { - "auth_type": { - "ManagedIdentity": "ManagedIdentityAuthTypeWorkspaceConnectionProperties", - "None": "NoneAuthTypeWorkspaceConnectionProperties", - "PAT": "PATAuthTypeWorkspaceConnectionProperties", - "SAS": "SASAuthTypeWorkspaceConnectionProperties", - "UsernamePassword": "UsernamePasswordAuthTypeWorkspaceConnectionProperties", - } - } - - def __init__( - self, - *, - category: Optional[Union[str, "_models.ConnectionCategory"]] = None, - target: Optional[str] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "_models.ValueFormat"]] = None, - **kwargs - ): - """ - :keyword category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". - :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory - :keyword target: - :paramtype target: str - :keyword value: Value details of the workspace connection. - :paramtype value: str - :keyword value_format: format for the workspace connection value. "JSON" - :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :paramtype client_id: str + :keyword object_id: Specifies a user-assigned identity by object ID. For system-assigned, do + not set this field. + :paramtype object_id: str + :keyword resource_id: Specifies a user-assigned identity by ARM resource ID. For + system-assigned, do not set this field. + :paramtype resource_id: str """ super().__init__(**kwargs) - self.auth_type: Optional[str] = None - self.category = category - self.target = target - self.value = value - self.value_format = value_format + self.identity_type: str = "Managed" + self.client_id = client_id + self.object_id = object_id + self.resource_id = resource_id class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): @@ -13735,10 +15831,12 @@ class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPr All required parameters must be populated in order to send to Azure. :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "ServicePrincipal", and + "AccessKey". :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar target: :vartype target: str @@ -13776,7 +15874,8 @@ def __init__( ): """ :keyword category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :keyword target: :paramtype target: str @@ -13804,8 +15903,8 @@ class ManagedOnlineDeployment(OnlineDeploymentProperties): # pylint: disable=to :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :ivar description: Description of the endpoint deployment. :vartype description: str - :ivar environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :ivar environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :vartype environment_id: str :ivar environment_variables: Environment variables configuration for the deployment. :vartype environment_variables: dict[str, str] @@ -13894,8 +15993,8 @@ def __init__( :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration :keyword description: Description of the endpoint deployment. :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId of the environment specification for the - endpoint deployment. + :keyword environment_id: ARM resource ID of the environment specification for the endpoint + deployment. :paramtype environment_id: str :keyword environment_variables: Environment variables configuration for the deployment. :paramtype environment_variables: dict[str, str] @@ -14047,6 +16146,102 @@ def __init__(self, *, delay_evaluation: int = 0, evaluation_interval: int = 0, * self.policy_type: str = "MedianStopping" +class MLAssistConfiguration(_serialization.Model): + """Labeling MLAssist configuration definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + MLAssistConfigurationDisabled, MLAssistConfigurationEnabled + + All required parameters must be populated in order to send to Azure. + + :ivar ml_assist: [Required] Indicates whether MLAssist feature is enabled. Required. Known + values are: "Enabled" and "Disabled". + :vartype ml_assist: str or ~azure.mgmt.machinelearningservices.models.MLAssistConfigurationType + """ + + _validation = { + "ml_assist": {"required": True}, + } + + _attribute_map = { + "ml_assist": {"key": "mlAssist", "type": "str"}, + } + + _subtype_map = { + "ml_assist": {"Disabled": "MLAssistConfigurationDisabled", "Enabled": "MLAssistConfigurationEnabled"} + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.ml_assist: Optional[str] = None + + +class MLAssistConfigurationDisabled(MLAssistConfiguration): + """Labeling MLAssist configuration definition when MLAssist is disabled. + + All required parameters must be populated in order to send to Azure. + + :ivar ml_assist: [Required] Indicates whether MLAssist feature is enabled. Required. Known + values are: "Enabled" and "Disabled". + :vartype ml_assist: str or ~azure.mgmt.machinelearningservices.models.MLAssistConfigurationType + """ + + _validation = { + "ml_assist": {"required": True}, + } + + _attribute_map = { + "ml_assist": {"key": "mlAssist", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.ml_assist: str = "Disabled" + + +class MLAssistConfigurationEnabled(MLAssistConfiguration): + """Labeling MLAssist configuration definition when MLAssist is enabled. + + All required parameters must be populated in order to send to Azure. + + :ivar ml_assist: [Required] Indicates whether MLAssist feature is enabled. Required. Known + values are: "Enabled" and "Disabled". + :vartype ml_assist: str or ~azure.mgmt.machinelearningservices.models.MLAssistConfigurationType + :ivar inferencing_compute_binding: [Required] AML compute binding used in inferencing. + Required. + :vartype inferencing_compute_binding: str + :ivar training_compute_binding: [Required] AML compute binding used in training. Required. + :vartype training_compute_binding: str + """ + + _validation = { + "ml_assist": {"required": True}, + "inferencing_compute_binding": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "training_compute_binding": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "ml_assist": {"key": "mlAssist", "type": "str"}, + "inferencing_compute_binding": {"key": "inferencingComputeBinding", "type": "str"}, + "training_compute_binding": {"key": "trainingComputeBinding", "type": "str"}, + } + + def __init__(self, *, inferencing_compute_binding: str, training_compute_binding: str, **kwargs): + """ + :keyword inferencing_compute_binding: [Required] AML compute binding used in inferencing. + Required. + :paramtype inferencing_compute_binding: str + :keyword training_compute_binding: [Required] AML compute binding used in training. Required. + :paramtype training_compute_binding: str + """ + super().__init__(**kwargs) + self.ml_assist: str = "Enabled" + self.inferencing_compute_binding = inferencing_compute_binding + self.training_compute_binding = training_compute_binding + + class MLFlowModelJobInput(AssetJobInput, JobInput): """MLFlowModelJobInput. @@ -14111,7 +16306,12 @@ class MLFlowModelJobOutput(AssetJobOutput, JobOutput): :ivar job_output_type: [Required] Specifies the type of job. Required. Known values are: "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and "triton_model". :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :ivar uri: Output Asset URI. :vartype uri: str @@ -14124,6 +16324,8 @@ class MLFlowModelJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -14132,6 +16334,8 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs @@ -14139,14 +16343,23 @@ def __init__( """ :keyword description: Description for the output. :paramtype description: str - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :keyword uri: Output Asset URI. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__( + asset_name=asset_name, asset_version=asset_version, mode=mode, uri=uri, description=description, **kwargs + ) self.description = description self.job_output_type: str = "mlflow_model" + self.asset_name = asset_name + self.asset_version = asset_version self.mode = mode self.uri = uri @@ -14169,9 +16382,8 @@ class MLTableData(DataVersionBaseProperties): :ivar data_type: [Required] Specifies the type of data. Required. Known values are: "uri_file", "uri_folder", and "mltable". :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType - :ivar data_uri: [Required] Uri of the data. Usage/meaning depends on - Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType. - Required. + :ivar data_uri: [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. :vartype data_uri: str :ivar referenced_uris: Uris referenced in the MLTable definition (required for lineage). :vartype referenced_uris: list[str] @@ -14216,9 +16428,8 @@ def __init__( :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool - :keyword data_uri: [Required] Uri of the data. Usage/meaning depends on - Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType. - Required. + :keyword data_uri: [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. :paramtype data_uri: str :keyword referenced_uris: Uris referenced in the MLTable definition (required for lineage). :paramtype referenced_uris: list[str] @@ -14300,7 +16511,12 @@ class MLTableJobOutput(AssetJobOutput, JobOutput): :ivar job_output_type: [Required] Specifies the type of job. Required. Known values are: "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and "triton_model". :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :ivar uri: Output Asset URI. :vartype uri: str @@ -14313,6 +16529,8 @@ class MLTableJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -14321,6 +16539,8 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs @@ -14328,14 +16548,23 @@ def __init__( """ :keyword description: Description for the output. :paramtype description: str - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :keyword uri: Output Asset URI. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__( + asset_name=asset_name, asset_version=asset_version, mode=mode, uri=uri, description=description, **kwargs + ) self.description = description self.job_output_type: str = "mltable" + self.asset_name = asset_name + self.asset_version = asset_version self.mode = mode self.uri = uri @@ -14404,11 +16633,16 @@ class ModelContainerProperties(AssetContainer): :vartype latest_version: str :ivar next_version: The next auto incremental version. :vartype next_version: str + :ivar provisioning_state: Provisioning state for the model container. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ _validation = { "latest_version": {"readonly": True}, "next_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { @@ -14418,6 +16652,7 @@ class ModelContainerProperties(AssetContainer): "is_archived": {"key": "isArchived", "type": "bool"}, "latest_version": {"key": "latestVersion", "type": "str"}, "next_version": {"key": "nextVersion", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -14440,6 +16675,7 @@ def __init__( :paramtype is_archived: bool """ super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None class ModelContainerResourceArmPaginatedResult(_serialization.Model): @@ -14522,6 +16758,8 @@ def __init__(self, *, properties: "_models.ModelVersionProperties", **kwargs): class ModelVersionProperties(AssetBase): """Model asset version details. + Variables are only populated by the server, and will be ignored when sending a request. + :ivar description: The asset description text. :vartype description: str :ivar properties: The asset property dictionary. @@ -14540,8 +16778,16 @@ class ModelVersionProperties(AssetBase): :vartype model_type: str :ivar model_uri: The URI path to the model contents. :vartype model_uri: str + :ivar provisioning_state: Provisioning state for the model version. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState """ + _validation = { + "provisioning_state": {"readonly": True}, + } + _attribute_map = { "description": {"key": "description", "type": "str"}, "properties": {"key": "properties", "type": "{str}"}, @@ -14552,6 +16798,7 @@ class ModelVersionProperties(AssetBase): "job_name": {"key": "jobName", "type": "str"}, "model_type": {"key": "modelType", "type": "str"}, "model_uri": {"key": "modelUri", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -14600,6 +16847,7 @@ def __init__( self.job_name = job_name self.model_type = model_type self.model_uri = model_uri + self.provisioning_state = None class ModelVersionResourceArmPaginatedResult(_serialization.Model): @@ -14663,6 +16911,222 @@ def __init__(self, *, process_count_per_instance: Optional[int] = None, **kwargs self.process_count_per_instance = process_count_per_instance +class NlpFixedParameters(_serialization.Model): + """Fixed training parameters that won't be swept over during AutoML NLP training. + + :ivar gradient_accumulation_steps: Number of steps to accumulate gradients over before running + a backward pass. + :vartype gradient_accumulation_steps: int + :ivar learning_rate: The learning rate for the training procedure. + :vartype learning_rate: float + :ivar learning_rate_scheduler: The type of learning rate schedule to use during the training + procedure. Known values are: "None", "Linear", "Cosine", "CosineWithRestarts", "Polynomial", + "Constant", and "ConstantWithWarmup". + :vartype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.NlpLearningRateScheduler + :ivar model_name: The name of the model to train. + :vartype model_name: str + :ivar number_of_epochs: Number of training epochs. + :vartype number_of_epochs: int + :ivar training_batch_size: The batch size for the training procedure. + :vartype training_batch_size: int + :ivar validation_batch_size: The batch size to be used during evaluation. + :vartype validation_batch_size: int + :ivar warmup_ratio: The warmup ratio, used alongside LrSchedulerType. + :vartype warmup_ratio: float + :ivar weight_decay: The weight decay for the training procedure. + :vartype weight_decay: float + """ + + _attribute_map = { + "gradient_accumulation_steps": {"key": "gradientAccumulationSteps", "type": "int"}, + "learning_rate": {"key": "learningRate", "type": "float"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "int"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "int"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "int"}, + "warmup_ratio": {"key": "warmupRatio", "type": "float"}, + "weight_decay": {"key": "weightDecay", "type": "float"}, + } + + def __init__( + self, + *, + gradient_accumulation_steps: Optional[int] = None, + learning_rate: Optional[float] = None, + learning_rate_scheduler: Optional[Union[str, "_models.NlpLearningRateScheduler"]] = None, + model_name: Optional[str] = None, + number_of_epochs: Optional[int] = None, + training_batch_size: Optional[int] = None, + validation_batch_size: Optional[int] = None, + warmup_ratio: Optional[float] = None, + weight_decay: Optional[float] = None, + **kwargs + ): + """ + :keyword gradient_accumulation_steps: Number of steps to accumulate gradients over before + running a backward pass. + :paramtype gradient_accumulation_steps: int + :keyword learning_rate: The learning rate for the training procedure. + :paramtype learning_rate: float + :keyword learning_rate_scheduler: The type of learning rate schedule to use during the training + procedure. Known values are: "None", "Linear", "Cosine", "CosineWithRestarts", "Polynomial", + "Constant", and "ConstantWithWarmup". + :paramtype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.NlpLearningRateScheduler + :keyword model_name: The name of the model to train. + :paramtype model_name: str + :keyword number_of_epochs: Number of training epochs. + :paramtype number_of_epochs: int + :keyword training_batch_size: The batch size for the training procedure. + :paramtype training_batch_size: int + :keyword validation_batch_size: The batch size to be used during evaluation. + :paramtype validation_batch_size: int + :keyword warmup_ratio: The warmup ratio, used alongside LrSchedulerType. + :paramtype warmup_ratio: float + :keyword weight_decay: The weight decay for the training procedure. + :paramtype weight_decay: float + """ + super().__init__(**kwargs) + self.gradient_accumulation_steps = gradient_accumulation_steps + self.learning_rate = learning_rate + self.learning_rate_scheduler = learning_rate_scheduler + self.model_name = model_name + self.number_of_epochs = number_of_epochs + self.training_batch_size = training_batch_size + self.validation_batch_size = validation_batch_size + self.warmup_ratio = warmup_ratio + self.weight_decay = weight_decay + + +class NlpParameterSubspace(_serialization.Model): + """Stringified search spaces for each parameter. See below examples. + + :ivar gradient_accumulation_steps: Number of steps to accumulate gradients over before running + a backward pass. + :vartype gradient_accumulation_steps: str + :ivar learning_rate: The learning rate for the training procedure. + :vartype learning_rate: str + :ivar learning_rate_scheduler: The type of learning rate schedule to use during the training + procedure. + :vartype learning_rate_scheduler: str + :ivar model_name: The name of the model to train. + :vartype model_name: str + :ivar number_of_epochs: Number of training epochs. + :vartype number_of_epochs: str + :ivar training_batch_size: The batch size for the training procedure. + :vartype training_batch_size: str + :ivar validation_batch_size: The batch size to be used during evaluation. + :vartype validation_batch_size: str + :ivar warmup_ratio: The warmup ratio, used alongside LrSchedulerType. + :vartype warmup_ratio: str + :ivar weight_decay: The weight decay for the training procedure. + :vartype weight_decay: str + """ + + _attribute_map = { + "gradient_accumulation_steps": {"key": "gradientAccumulationSteps", "type": "str"}, + "learning_rate": {"key": "learningRate", "type": "str"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "str"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "str"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "str"}, + "warmup_ratio": {"key": "warmupRatio", "type": "str"}, + "weight_decay": {"key": "weightDecay", "type": "str"}, + } + + def __init__( + self, + *, + gradient_accumulation_steps: Optional[str] = None, + learning_rate: Optional[str] = None, + learning_rate_scheduler: Optional[str] = None, + model_name: Optional[str] = None, + number_of_epochs: Optional[str] = None, + training_batch_size: Optional[str] = None, + validation_batch_size: Optional[str] = None, + warmup_ratio: Optional[str] = None, + weight_decay: Optional[str] = None, + **kwargs + ): + """ + :keyword gradient_accumulation_steps: Number of steps to accumulate gradients over before + running a backward pass. + :paramtype gradient_accumulation_steps: str + :keyword learning_rate: The learning rate for the training procedure. + :paramtype learning_rate: str + :keyword learning_rate_scheduler: The type of learning rate schedule to use during the training + procedure. + :paramtype learning_rate_scheduler: str + :keyword model_name: The name of the model to train. + :paramtype model_name: str + :keyword number_of_epochs: Number of training epochs. + :paramtype number_of_epochs: str + :keyword training_batch_size: The batch size for the training procedure. + :paramtype training_batch_size: str + :keyword validation_batch_size: The batch size to be used during evaluation. + :paramtype validation_batch_size: str + :keyword warmup_ratio: The warmup ratio, used alongside LrSchedulerType. + :paramtype warmup_ratio: str + :keyword weight_decay: The weight decay for the training procedure. + :paramtype weight_decay: str + """ + super().__init__(**kwargs) + self.gradient_accumulation_steps = gradient_accumulation_steps + self.learning_rate = learning_rate + self.learning_rate_scheduler = learning_rate_scheduler + self.model_name = model_name + self.number_of_epochs = number_of_epochs + self.training_batch_size = training_batch_size + self.validation_batch_size = validation_batch_size + self.warmup_ratio = warmup_ratio + self.weight_decay = weight_decay + + +class NlpSweepSettings(_serialization.Model): + """Model sweeping and hyperparameter tuning related settings. + + All required parameters must be populated in order to send to Azure. + + :ivar early_termination: Type of early termination policy for the sweeping job. + :vartype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :ivar sampling_algorithm: [Required] Type of sampling algorithm. Required. Known values are: + "Grid", "Random", and "Bayesian". + :vartype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + + _validation = { + "sampling_algorithm": {"required": True}, + } + + _attribute_map = { + "early_termination": {"key": "earlyTermination", "type": "EarlyTerminationPolicy"}, + "sampling_algorithm": {"key": "samplingAlgorithm", "type": "str"}, + } + + def __init__( + self, + *, + sampling_algorithm: Union[str, "_models.SamplingAlgorithmType"], + early_termination: Optional["_models.EarlyTerminationPolicy"] = None, + **kwargs + ): + """ + :keyword early_termination: Type of early termination policy for the sweeping job. + :paramtype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :keyword sampling_algorithm: [Required] Type of sampling algorithm. Required. Known values are: + "Grid", "Random", and "Bayesian". + :paramtype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + super().__init__(**kwargs) + self.early_termination = early_termination + self.sampling_algorithm = sampling_algorithm + + class NlpVertical(_serialization.Model): """Abstract class for NLP related AutoML tasks. NLP - Natural Language Processing. @@ -14670,15 +17134,26 @@ class NlpVertical(_serialization.Model): :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :ivar validation_data: Validation data inputs. :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ _attribute_map = { "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "NlpFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, + "search_space": {"key": "searchSpace", "type": "[NlpParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "NlpSweepSettings"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, } @@ -14686,7 +17161,10 @@ def __init__( self, *, featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.NlpFixedParameters"] = None, limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, + search_space: Optional[List["_models.NlpParameterSubspace"]] = None, + sweep_settings: Optional["_models.NlpSweepSettings"] = None, validation_data: Optional["_models.MLTableJobInput"] = None, **kwargs ): @@ -14694,14 +17172,25 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :keyword validation_data: Validation data inputs. :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ super().__init__(**kwargs) self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings + self.search_space = search_space + self.sweep_settings = sweep_settings self.validation_data = validation_data @@ -14729,38 +17218,52 @@ class NlpVerticalLimitSettings(_serialization.Model): :ivar max_concurrent_trials: Maximum Concurrent AutoML iterations. :vartype max_concurrent_trials: int + :ivar max_nodes: Maximum nodes to use for the experiment. + :vartype max_nodes: int :ivar max_trials: Number of AutoML iterations. :vartype max_trials: int :ivar timeout: AutoML job timeout. :vartype timeout: ~datetime.timedelta + :ivar trial_timeout: Timeout for individual HD trials. + :vartype trial_timeout: ~datetime.timedelta """ _attribute_map = { "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, + "max_nodes": {"key": "maxNodes", "type": "int"}, "max_trials": {"key": "maxTrials", "type": "int"}, "timeout": {"key": "timeout", "type": "duration"}, + "trial_timeout": {"key": "trialTimeout", "type": "duration"}, } def __init__( self, *, max_concurrent_trials: int = 1, + max_nodes: int = 1, max_trials: int = 1, - timeout: Optional[datetime.timedelta] = None, + timeout: datetime.timedelta = "P7D", + trial_timeout: Optional[datetime.timedelta] = None, **kwargs ): """ :keyword max_concurrent_trials: Maximum Concurrent AutoML iterations. :paramtype max_concurrent_trials: int + :keyword max_nodes: Maximum nodes to use for the experiment. + :paramtype max_nodes: int :keyword max_trials: Number of AutoML iterations. :paramtype max_trials: int :keyword timeout: AutoML job timeout. :paramtype timeout: ~datetime.timedelta + :keyword trial_timeout: Timeout for individual HD trials. + :paramtype trial_timeout: ~datetime.timedelta """ super().__init__(**kwargs) self.max_concurrent_trials = max_concurrent_trials + self.max_nodes = max_nodes self.max_trials = max_trials self.timeout = timeout + self.trial_timeout = trial_timeout class NodeStateCounts(_serialization.Model): @@ -14817,10 +17320,12 @@ class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2) All required parameters must be populated in order to send to Azure. :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "ServicePrincipal", and + "AccessKey". :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar target: :vartype target: str @@ -14853,7 +17358,8 @@ def __init__( ): """ :keyword category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :keyword target: :paramtype target: str @@ -14872,7 +17378,8 @@ class NoneDatastoreCredentials(DatastoreCredentials): All required parameters must be populated in order to send to Azure. :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType """ @@ -15256,7 +17763,7 @@ def __init__( self.sku = sku -class OnlineEndpointProperties(EndpointPropertiesBase): +class OnlineEndpointProperties(EndpointPropertiesBase): # pylint: disable=too-many-instance-attributes """Online endpoint configuration. Variables are only populated by the server, and will be ignored when sending a request. @@ -15282,6 +17789,9 @@ class OnlineEndpointProperties(EndpointPropertiesBase): :ivar compute: ARM resource ID of the compute if it exists. optional. :vartype compute: str + :ivar mirror_traffic: Percentage of traffic to be mirrored to each deployment without using + returned scoring. Traffic values need to sum to utmost 50. + :vartype mirror_traffic: dict[str, int] :ivar provisioning_state: Provisioning state for the endpoint. Known values are: "Creating", "Deleting", "Succeeded", "Failed", "Updating", and "Canceled". :vartype provisioning_state: str or @@ -15310,6 +17820,7 @@ class OnlineEndpointProperties(EndpointPropertiesBase): "scoring_uri": {"key": "scoringUri", "type": "str"}, "swagger_uri": {"key": "swaggerUri", "type": "str"}, "compute": {"key": "compute", "type": "str"}, + "mirror_traffic": {"key": "mirrorTraffic", "type": "{int}"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, "traffic": {"key": "traffic", "type": "{int}"}, @@ -15323,6 +17834,7 @@ def __init__( keys: Optional["_models.EndpointAuthKeys"] = None, properties: Optional[Dict[str, str]] = None, compute: Optional[str] = None, + mirror_traffic: Optional[Dict[str, int]] = None, public_network_access: Optional[Union[str, "_models.PublicNetworkAccessType"]] = None, traffic: Optional[Dict[str, int]] = None, **kwargs @@ -15343,6 +17855,9 @@ def __init__( :keyword compute: ARM resource ID of the compute if it exists. optional. :paramtype compute: str + :keyword mirror_traffic: Percentage of traffic to be mirrored to each deployment without using + returned scoring. Traffic values need to sum to utmost 50. + :paramtype mirror_traffic: dict[str, int] :keyword public_network_access: Set to "Enabled" for endpoints that should allow public access when Private Link is enabled. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or @@ -15353,6 +17868,7 @@ def __init__( """ super().__init__(auth_mode=auth_mode, description=description, keys=keys, properties=properties, **kwargs) self.compute = compute + self.mirror_traffic = mirror_traffic self.provisioning_state = None self.public_network_access = public_network_access self.traffic = traffic @@ -15664,8 +18180,63 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_mod :keyword sku: Sku details required for ARM contract for Autoscaling. :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - super().__init__(tags=tags, **kwargs) + super().__init__(tags=tags, **kwargs) + self.sku = sku + + +class PartialRegistryPartialTrackedResource(_serialization.Model): + """Strictly used in update requests. + + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: Additional attributes of the entity. + :vartype properties: JSON + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "PartialManagedServiceIdentity"}, + "kind": {"key": "kind", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + "sku": {"key": "sku", "type": "PartialSku"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + identity: Optional["_models.PartialManagedServiceIdentity"] = None, + kind: Optional[str] = None, + properties: Optional[JSON] = None, + sku: Optional["_models.PartialSku"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :paramtype kind: str + :keyword properties: Additional attributes of the entity. + :paramtype properties: JSON + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.identity = identity + self.kind = kind + self.properties = properties self.sku = sku + self.tags = tags class PartialSku(_serialization.Model): @@ -15765,10 +18336,12 @@ class PATAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): All required parameters must be populated in order to send to Azure. :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "ServicePrincipal", and + "AccessKey". :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar target: :vartype target: str @@ -15806,7 +18379,8 @@ def __init__( ): """ :keyword category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :keyword target: :paramtype target: str @@ -15872,14 +18446,14 @@ class PipelineJob(JobBaseProperties): # pylint: disable=too-many-instance-attri :ivar is_archived: Is the asset archived?. :vartype is_archived: bool :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", - "Command", "Sweep", and "Pipeline". + "Command", "Labeling", "Sweep", "Pipeline", and "Spark". :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType :ivar services: List of JobEndpoints. For local jobs, a job endpoint will have an endpoint value of FileStreamObject. :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", - "Canceled", "NotResponding", "Paused", and "Unknown". + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus :ivar inputs: Inputs for the pipeline job. :vartype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] @@ -16349,6 +18923,45 @@ def __init__( self.timeout = timeout +class ProgressMetrics(_serialization.Model): + """Progress metrics definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar completed_datapoint_count: The completed datapoint count. + :vartype completed_datapoint_count: int + :ivar incremental_data_last_refresh_date_time: The time of last successful incremental data + refresh in UTC. + :vartype incremental_data_last_refresh_date_time: ~datetime.datetime + :ivar skipped_datapoint_count: The skipped datapoint count. + :vartype skipped_datapoint_count: int + :ivar total_datapoint_count: The total datapoint count. + :vartype total_datapoint_count: int + """ + + _validation = { + "completed_datapoint_count": {"readonly": True}, + "incremental_data_last_refresh_date_time": {"readonly": True}, + "skipped_datapoint_count": {"readonly": True}, + "total_datapoint_count": {"readonly": True}, + } + + _attribute_map = { + "completed_datapoint_count": {"key": "completedDatapointCount", "type": "int"}, + "incremental_data_last_refresh_date_time": {"key": "incrementalDataLastRefreshDateTime", "type": "iso-8601"}, + "skipped_datapoint_count": {"key": "skippedDatapointCount", "type": "int"}, + "total_datapoint_count": {"key": "totalDatapointCount", "type": "int"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.completed_datapoint_count = None + self.incremental_data_last_refresh_date_time = None + self.skipped_datapoint_count = None + self.total_datapoint_count = None + + class PyTorch(DistributionConfiguration): """PyTorch distribution configuration. @@ -16464,6 +19077,9 @@ class RandomSamplingAlgorithm(SamplingAlgorithm): "Bayesian". :vartype sampling_algorithm_type: str or ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + :ivar logbase: An optional positive number or e in string format to be used as base for log + based random sampling. + :vartype logbase: str :ivar rule: The specific type of random algorithm. Known values are: "Random" and "Sobol". :vartype rule: str or ~azure.mgmt.machinelearningservices.models.RandomSamplingAlgorithmRule :ivar seed: An optional integer to use as the seed for random number generation. @@ -16476,6 +19092,7 @@ class RandomSamplingAlgorithm(SamplingAlgorithm): _attribute_map = { "sampling_algorithm_type": {"key": "samplingAlgorithmType", "type": "str"}, + "logbase": {"key": "logbase", "type": "str"}, "rule": {"key": "rule", "type": "str"}, "seed": {"key": "seed", "type": "int"}, } @@ -16483,11 +19100,15 @@ class RandomSamplingAlgorithm(SamplingAlgorithm): def __init__( self, *, + logbase: Optional[str] = None, rule: Optional[Union[str, "_models.RandomSamplingAlgorithmRule"]] = None, seed: Optional[int] = None, **kwargs ): """ + :keyword logbase: An optional positive number or e in string format to be used as base for log + based random sampling. + :paramtype logbase: str :keyword rule: The specific type of random algorithm. Known values are: "Random" and "Sobol". :paramtype rule: str or ~azure.mgmt.machinelearningservices.models.RandomSamplingAlgorithmRule :keyword seed: An optional integer to use as the seed for random number generation. @@ -16495,6 +19116,7 @@ def __init__( """ super().__init__(**kwargs) self.sampling_algorithm_type: str = "Random" + self.logbase = logbase self.rule = rule self.seed = seed @@ -16670,6 +19292,94 @@ def __init__(self, *, key_type: Union[str, "_models.KeyType"], key_value: Option self.key_value = key_value +class Registry(TrackedResource): + """Registry. + + 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: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :vartype kind: str + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RegistryProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "kind": {"key": "kind", "type": "str"}, + "properties": {"key": "properties", "type": "RegistryProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.RegistryProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + **kwargs + ): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type. + :paramtype kind: str + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RegistryProperties + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + """ + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.kind = kind + self.properties = properties + self.sku = sku + + class RegistryListCredentialsResult(_serialization.Model): """RegistryListCredentialsResult. @@ -16705,6 +19415,162 @@ def __init__(self, *, passwords: Optional[List["_models.Password"]] = None, **kw self.passwords = passwords +class RegistryProperties(ResourceBase): + """Details of the Registry. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar public_network_access: + :vartype public_network_access: str + :ivar discovery_url: + :vartype discovery_url: str + :ivar intellectual_property_publisher: + :vartype intellectual_property_publisher: str + :ivar managed_resource_group: Managed resource group created for the registry. + :vartype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :ivar ml_flow_registry_uri: + :vartype ml_flow_registry_uri: str + :ivar private_link_count: + :vartype private_link_count: int + :ivar region_details: Details of each region the registry is in. + :vartype region_details: + list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails] + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, + "discovery_url": {"key": "discoveryUrl", "type": "str"}, + "intellectual_property_publisher": {"key": "intellectualPropertyPublisher", "type": "str"}, + "managed_resource_group": {"key": "managedResourceGroup", "type": "ArmResourceId"}, + "ml_flow_registry_uri": {"key": "mlFlowRegistryUri", "type": "str"}, + "private_link_count": {"key": "privateLinkCount", "type": "int"}, + "region_details": {"key": "regionDetails", "type": "[RegistryRegionArmDetails]"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + public_network_access: Optional[str] = None, + discovery_url: Optional[str] = None, + intellectual_property_publisher: Optional[str] = None, + managed_resource_group: Optional["_models.ArmResourceId"] = None, + ml_flow_registry_uri: Optional[str] = None, + private_link_count: Optional[int] = None, + region_details: Optional[List["_models.RegistryRegionArmDetails"]] = None, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword public_network_access: + :paramtype public_network_access: str + :keyword discovery_url: + :paramtype discovery_url: str + :keyword intellectual_property_publisher: + :paramtype intellectual_property_publisher: str + :keyword managed_resource_group: Managed resource group created for the registry. + :paramtype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :keyword ml_flow_registry_uri: + :paramtype ml_flow_registry_uri: str + :keyword private_link_count: + :paramtype private_link_count: int + :keyword region_details: Details of each region the registry is in. + :paramtype region_details: + list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails] + """ + super().__init__(description=description, properties=properties, tags=tags, **kwargs) + self.public_network_access = public_network_access + self.discovery_url = discovery_url + self.intellectual_property_publisher = intellectual_property_publisher + self.managed_resource_group = managed_resource_group + self.ml_flow_registry_uri = ml_flow_registry_uri + self.private_link_count = private_link_count + self.region_details = region_details + + +class RegistryRegionArmDetails(_serialization.Model): + """Details for each region the registry is in. + + :ivar acr_details: List of ACR accounts. + :vartype acr_details: list[~azure.mgmt.machinelearningservices.models.AcrDetails] + :ivar location: The location where the registry exists. + :vartype location: str + :ivar storage_account_details: List of storage accounts. + :vartype storage_account_details: + list[~azure.mgmt.machinelearningservices.models.StorageAccountDetails] + """ + + _attribute_map = { + "acr_details": {"key": "acrDetails", "type": "[AcrDetails]"}, + "location": {"key": "location", "type": "str"}, + "storage_account_details": {"key": "storageAccountDetails", "type": "[StorageAccountDetails]"}, + } + + def __init__( + self, + *, + acr_details: Optional[List["_models.AcrDetails"]] = None, + location: Optional[str] = None, + storage_account_details: Optional[List["_models.StorageAccountDetails"]] = None, + **kwargs + ): + """ + :keyword acr_details: List of ACR accounts. + :paramtype acr_details: list[~azure.mgmt.machinelearningservices.models.AcrDetails] + :keyword location: The location where the registry exists. + :paramtype location: str + :keyword storage_account_details: List of storage accounts. + :paramtype storage_account_details: + list[~azure.mgmt.machinelearningservices.models.StorageAccountDetails] + """ + super().__init__(**kwargs) + self.acr_details = acr_details + self.location = location + self.storage_account_details = storage_account_details + + +class RegistryTrackedResourceArmPaginatedResult(_serialization.Model): + """A paginated list of Registry entities. + + :ivar next_link: The link to the next page of Registry objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type Registry. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Registry] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Registry]"}, + } + + def __init__(self, *, next_link: Optional[str] = None, value: Optional[List["_models.Registry"]] = None, **kwargs): + """ + :keyword next_link: The link to the next page of Registry objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type Registry. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.Registry] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + class Regression(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes """Regression task in AutoML Table vertical. @@ -16728,11 +19594,19 @@ class Regression(TableVertical, AutoMLVertical): # pylint: disable=too-many-ins :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings :ivar n_cross_validations: Number of cross validation folds to be applied on training dataset when validation dataset is not provided. :vartype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings :ivar test_data: Test data input. :vartype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar test_data_size: The fraction of test dataset that needs to be set aside for validation @@ -16772,8 +19646,11 @@ class Regression(TableVertical, AutoMLVertical): # pylint: disable=too-many-ins "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "TableFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "search_space": {"key": "searchSpace", "type": "[TableParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "TableSweepSettings"}, "test_data": {"key": "testData", "type": "MLTableJobInput"}, "test_data_size": {"key": "testDataSize", "type": "float"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, @@ -16791,8 +19668,11 @@ def __init__( target_column_name: Optional[str] = None, cv_split_column_names: Optional[List[str]] = None, featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.TableFixedParameters"] = None, limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, n_cross_validations: Optional["_models.NCrossValidations"] = None, + search_space: Optional[List["_models.TableParameterSubspace"]] = None, + sweep_settings: Optional["_models.TableSweepSettings"] = None, test_data: Optional["_models.MLTableJobInput"] = None, test_data_size: Optional[float] = None, validation_data: Optional["_models.MLTableJobInput"] = None, @@ -16816,6 +19696,9 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.TableFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings @@ -16823,6 +19706,12 @@ def __init__( dataset when validation dataset is not provided. :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.TableParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.TableSweepSettings :keyword test_data: Test data input. :paramtype test_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :keyword test_data_size: The fraction of test dataset that needs to be set aside for validation @@ -16852,8 +19741,11 @@ def __init__( super().__init__( cv_split_column_names=cv_split_column_names, featurization_settings=featurization_settings, + fixed_parameters=fixed_parameters, limit_settings=limit_settings, n_cross_validations=n_cross_validations, + search_space=search_space, + sweep_settings=sweep_settings, test_data=test_data, test_data_size=test_data_size, validation_data=validation_data, @@ -16872,8 +19764,11 @@ def __init__( self.training_settings = training_settings self.cv_split_column_names = cv_split_column_names self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings self.n_cross_validations = n_cross_validations + self.search_space = search_space + self.sweep_settings = sweep_settings self.test_data = test_data self.test_data_size = test_data_size self.validation_data = validation_data @@ -16901,6 +19796,14 @@ class RegressionTrainingSettings(TrainingSettings): :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. :vartype stack_ensemble_settings: ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :ivar training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :vartype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode :ivar allowed_training_algorithms: Allowed models for regression task. :vartype allowed_training_algorithms: list[str or ~azure.mgmt.machinelearningservices.models.RegressionModels] @@ -16917,6 +19820,7 @@ class RegressionTrainingSettings(TrainingSettings): "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, + "training_mode": {"key": "trainingMode", "type": "str"}, "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, } @@ -16931,6 +19835,7 @@ def __init__( enable_vote_ensemble: bool = True, ensemble_model_download_timeout: datetime.timedelta = "PT5M", stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, + training_mode: Optional[Union[str, "_models.TrainingMode"]] = None, allowed_training_algorithms: Optional[List[Union[str, "_models.RegressionModels"]]] = None, blocked_training_algorithms: Optional[List[Union[str, "_models.RegressionModels"]]] = None, **kwargs @@ -16953,6 +19858,14 @@ def __init__( :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. :paramtype stack_ensemble_settings: ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :keyword training_mode: TrainingMode mode - Setting to 'auto' is same as setting it to + 'non-distributed' for now, however in the future may result in mixed mode or heuristics based + mode selection. Default is 'auto'. + If 'Distributed' then only distributed featurization is used and distributed algorithms are + chosen. + If 'NonDistributed' then only non distributed algorithms are chosen. Known values are: "Auto", + "Distributed", and "NonDistributed". + :paramtype training_mode: str or ~azure.mgmt.machinelearningservices.models.TrainingMode :keyword allowed_training_algorithms: Allowed models for regression task. :paramtype allowed_training_algorithms: list[str or ~azure.mgmt.machinelearningservices.models.RegressionModels] @@ -16968,6 +19881,7 @@ def __init__( enable_vote_ensemble=enable_vote_ensemble, ensemble_model_download_timeout=ensemble_model_download_timeout, stack_ensemble_settings=stack_ensemble_settings, + training_mode=training_mode, **kwargs ) self.allowed_training_algorithms = allowed_training_algorithms @@ -17115,10 +20029,12 @@ class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): All required parameters must be populated in order to send to Azure. :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "ServicePrincipal", and + "AccessKey". :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar target: :vartype target: str @@ -17156,7 +20072,8 @@ def __init__( ): """ :keyword category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :keyword target: :paramtype target: str @@ -17179,7 +20096,8 @@ class SasDatastoreCredentials(DatastoreCredentials): All required parameters must be populated in order to send to Azure. :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType :ivar secrets: [Required] Storage container secrets. Required. :vartype secrets: ~azure.mgmt.machinelearningservices.models.SasDatastoreSecrets @@ -17211,7 +20129,8 @@ class SasDatastoreSecrets(DatastoreSecrets): All required parameters must be populated in order to send to Azure. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType :ivar sas_token: Storage container SAS token. :vartype sas_token: str @@ -17505,7 +20424,7 @@ def __init__(self, *, next_link: Optional[str] = None, value: Optional[List["_mo class ScriptReference(_serialization.Model): """Script reference. - :ivar script_source: The storage source of the script: workspace. + :ivar script_source: The storage source of the script: inline, workspace. :vartype script_source: str :ivar script_data: The location of scripts in the mounted volume. :vartype script_data: str @@ -17532,7 +20451,7 @@ def __init__( **kwargs ): """ - :keyword script_source: The storage source of the script: workspace. + :keyword script_source: The storage source of the script: inline, workspace. :paramtype script_source: str :keyword script_data: The location of scripts in the mounted volume. :paramtype script_data: str @@ -17600,13 +20519,81 @@ def __init__(self, *, cosmos_db: Optional["_models.CosmosDbSettings"] = None, ** self.cosmos_db = cosmos_db +class ServicePrincipalAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): + """ServicePrincipalAuthTypeWorkspaceConnectionProperties. + + All required parameters must be populated in order to send to Azure. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "ServicePrincipal", and + "AccessKey". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar target: + :vartype target: str + :ivar value: Value details of the workspace connection. + :vartype value: str + :ivar value_format: format for the workspace connection value. "JSON" + :vartype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal + """ + + _validation = { + "auth_type": {"required": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "value": {"key": "value", "type": "str"}, + "value_format": {"key": "valueFormat", "type": "str"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionServicePrincipal"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + target: Optional[str] = None, + value: Optional[str] = None, + value_format: Optional[Union[str, "_models.ValueFormat"]] = None, + credentials: Optional["_models.WorkspaceConnectionServicePrincipal"] = None, + **kwargs + ): + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword target: + :paramtype target: str + :keyword value: Value details of the workspace connection. + :paramtype value: str + :keyword value_format: format for the workspace connection value. "JSON" + :paramtype value_format: str or ~azure.mgmt.machinelearningservices.models.ValueFormat + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal + """ + super().__init__(category=category, target=target, value=value, value_format=value_format, **kwargs) + self.auth_type: str = "ServicePrincipal" + self.credentials = credentials + + class ServicePrincipalDatastoreCredentials(DatastoreCredentials): """Service Principal datastore credentials configuration. All required parameters must be populated in order to send to Azure. :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", "ServicePrincipal", + "KerberosKeytab", and "KerberosPassword". :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType :ivar authority_url: Authority URL used for authentication. :vartype authority_url: str @@ -17674,7 +20661,8 @@ class ServicePrincipalDatastoreSecrets(DatastoreSecrets): All required parameters must be populated in order to send to Azure. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". + Known values are: "AccountKey", "Certificate", "Sas", "ServicePrincipal", "KerberosPassword", + and "KerberosKeytab". :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType :ivar client_secret: Service principal secret. :vartype client_secret: str @@ -18001,6 +20989,336 @@ def __init__(self, *, name: str, tier: Optional[Union[str, "_models.SkuTier"]] = self.tier = tier +class SparkJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes + """Spark job 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 description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar component_id: ARM resource ID of the component resource. + :vartype component_id: str + :ivar compute_id: ARM resource ID of the compute resource. + :vartype compute_id: str + :ivar display_name: Display name of job. + :vartype display_name: str + :ivar experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :vartype experiment_name: str + :ivar identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", + "Command", "Labeling", "Sweep", "Pipeline", and "Spark". + :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", + "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar archives: Archive files used in the job. + :vartype archives: list[str] + :ivar args: Arguments for the job. + :vartype args: str + :ivar code_id: [Required] ARM resource ID of the code asset. Required. + :vartype code_id: str + :ivar conf: Spark configured properties. + :vartype conf: dict[str, str] + :ivar entry: [Required] The entry to execute on startup of the job. Required. + :vartype entry: ~azure.mgmt.machinelearningservices.models.SparkJobEntry + :ivar environment_id: The ARM resource ID of the Environment specification for the job. + :vartype environment_id: str + :ivar files: Files used in the job. + :vartype files: list[str] + :ivar inputs: Mapping of input data bindings used in the job. + :vartype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :ivar jars: Jar files used in the job. + :vartype jars: list[str] + :ivar outputs: Mapping of output data bindings used in the job. + :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :ivar py_files: Python files used in the job. + :vartype py_files: list[str] + :ivar resources: Compute Resource configuration for the job. + :vartype resources: ~azure.mgmt.machinelearningservices.models.SparkResourceConfiguration + """ + + _validation = { + "job_type": {"required": True}, + "status": {"readonly": True}, + "code_id": {"required": True, "pattern": r"[a-zA-Z0-9_]"}, + "entry": {"required": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "component_id": {"key": "componentId", "type": "str"}, + "compute_id": {"key": "computeId", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "experiment_name": {"key": "experimentName", "type": "str"}, + "identity": {"key": "identity", "type": "IdentityConfiguration"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "job_type": {"key": "jobType", "type": "str"}, + "services": {"key": "services", "type": "{JobService}"}, + "status": {"key": "status", "type": "str"}, + "archives": {"key": "archives", "type": "[str]"}, + "args": {"key": "args", "type": "str"}, + "code_id": {"key": "codeId", "type": "str"}, + "conf": {"key": "conf", "type": "{str}"}, + "entry": {"key": "entry", "type": "SparkJobEntry"}, + "environment_id": {"key": "environmentId", "type": "str"}, + "files": {"key": "files", "type": "[str]"}, + "inputs": {"key": "inputs", "type": "{JobInput}"}, + "jars": {"key": "jars", "type": "[str]"}, + "outputs": {"key": "outputs", "type": "{JobOutput}"}, + "py_files": {"key": "pyFiles", "type": "[str]"}, + "resources": {"key": "resources", "type": "SparkResourceConfiguration"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + code_id: str, + entry: "_models.SparkJobEntry", + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + component_id: Optional[str] = None, + compute_id: Optional[str] = None, + display_name: Optional[str] = None, + experiment_name: str = "Default", + identity: Optional["_models.IdentityConfiguration"] = None, + is_archived: bool = False, + services: Optional[Dict[str, "_models.JobService"]] = None, + archives: Optional[List[str]] = None, + args: Optional[str] = None, + conf: Optional[Dict[str, str]] = None, + environment_id: Optional[str] = None, + files: Optional[List[str]] = None, + inputs: Optional[Dict[str, "_models.JobInput"]] = None, + jars: Optional[List[str]] = None, + outputs: Optional[Dict[str, "_models.JobOutput"]] = None, + py_files: Optional[List[str]] = None, + resources: Optional["_models.SparkResourceConfiguration"] = None, + **kwargs + ): + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword properties: The asset property dictionary. + :paramtype properties: dict[str, str] + :keyword tags: Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword component_id: ARM resource ID of the component resource. + :paramtype component_id: str + :keyword compute_id: ARM resource ID of the compute resource. + :paramtype compute_id: str + :keyword display_name: Display name of job. + :paramtype display_name: str + :keyword experiment_name: The name of the experiment the job belongs to. If not set, the job is + placed in the "Default" experiment. + :paramtype experiment_name: str + :keyword identity: Identity configuration. If set, this should be one of AmlToken, + ManagedIdentity, UserIdentity or null. + Defaults to AmlToken if null. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword services: List of JobEndpoints. + For local jobs, a job endpoint will have an endpoint value of FileStreamObject. + :paramtype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] + :keyword archives: Archive files used in the job. + :paramtype archives: list[str] + :keyword args: Arguments for the job. + :paramtype args: str + :keyword code_id: [Required] ARM resource ID of the code asset. Required. + :paramtype code_id: str + :keyword conf: Spark configured properties. + :paramtype conf: dict[str, str] + :keyword entry: [Required] The entry to execute on startup of the job. Required. + :paramtype entry: ~azure.mgmt.machinelearningservices.models.SparkJobEntry + :keyword environment_id: The ARM resource ID of the Environment specification for the job. + :paramtype environment_id: str + :keyword files: Files used in the job. + :paramtype files: list[str] + :keyword inputs: Mapping of input data bindings used in the job. + :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :keyword jars: Jar files used in the job. + :paramtype jars: list[str] + :keyword outputs: Mapping of output data bindings used in the job. + :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :keyword py_files: Python files used in the job. + :paramtype py_files: list[str] + :keyword resources: Compute Resource configuration for the job. + :paramtype resources: ~azure.mgmt.machinelearningservices.models.SparkResourceConfiguration + """ + super().__init__( + description=description, + properties=properties, + tags=tags, + component_id=component_id, + compute_id=compute_id, + display_name=display_name, + experiment_name=experiment_name, + identity=identity, + is_archived=is_archived, + services=services, + **kwargs + ) + self.job_type: str = "Spark" + self.archives = archives + self.args = args + self.code_id = code_id + self.conf = conf + self.entry = entry + self.environment_id = environment_id + self.files = files + self.inputs = inputs + self.jars = jars + self.outputs = outputs + self.py_files = py_files + self.resources = resources + + +class SparkJobEntry(_serialization.Model): + """Spark job entry point definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SparkJobPythonEntry, SparkJobScalaEntry + + All required parameters must be populated in order to send to Azure. + + :ivar spark_job_entry_type: [Required] Type of the job's entry point. Required. Known values + are: "SparkJobPythonEntry" and "SparkJobScalaEntry". + :vartype spark_job_entry_type: str or + ~azure.mgmt.machinelearningservices.models.SparkJobEntryType + """ + + _validation = { + "spark_job_entry_type": {"required": True}, + } + + _attribute_map = { + "spark_job_entry_type": {"key": "sparkJobEntryType", "type": "str"}, + } + + _subtype_map = { + "spark_job_entry_type": { + "SparkJobPythonEntry": "SparkJobPythonEntry", + "SparkJobScalaEntry": "SparkJobScalaEntry", + } + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.spark_job_entry_type: Optional[str] = None + + +class SparkJobPythonEntry(SparkJobEntry): + """SparkJobPythonEntry. + + All required parameters must be populated in order to send to Azure. + + :ivar spark_job_entry_type: [Required] Type of the job's entry point. Required. Known values + are: "SparkJobPythonEntry" and "SparkJobScalaEntry". + :vartype spark_job_entry_type: str or + ~azure.mgmt.machinelearningservices.models.SparkJobEntryType + :ivar file: [Required] Relative python file path for job entry point. Required. + :vartype file: str + """ + + _validation = { + "spark_job_entry_type": {"required": True}, + "file": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "spark_job_entry_type": {"key": "sparkJobEntryType", "type": "str"}, + "file": {"key": "file", "type": "str"}, + } + + def __init__(self, *, file: str, **kwargs): + """ + :keyword file: [Required] Relative python file path for job entry point. Required. + :paramtype file: str + """ + super().__init__(**kwargs) + self.spark_job_entry_type: str = "SparkJobPythonEntry" + self.file = file + + +class SparkJobScalaEntry(SparkJobEntry): + """SparkJobScalaEntry. + + All required parameters must be populated in order to send to Azure. + + :ivar spark_job_entry_type: [Required] Type of the job's entry point. Required. Known values + are: "SparkJobPythonEntry" and "SparkJobScalaEntry". + :vartype spark_job_entry_type: str or + ~azure.mgmt.machinelearningservices.models.SparkJobEntryType + :ivar class_name: [Required] Scala class name used as entry point. Required. + :vartype class_name: str + """ + + _validation = { + "spark_job_entry_type": {"required": True}, + "class_name": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "spark_job_entry_type": {"key": "sparkJobEntryType", "type": "str"}, + "class_name": {"key": "className", "type": "str"}, + } + + def __init__(self, *, class_name: str, **kwargs): + """ + :keyword class_name: [Required] Scala class name used as entry point. Required. + :paramtype class_name: str + """ + super().__init__(**kwargs) + self.spark_job_entry_type: str = "SparkJobScalaEntry" + self.class_name = class_name + + +class SparkResourceConfiguration(_serialization.Model): + """SparkResourceConfiguration. + + :ivar instance_type: Optional type of VM used as supported by the compute target. + :vartype instance_type: str + :ivar runtime_version: Version of spark runtime used for the job. + :vartype runtime_version: str + """ + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + "runtime_version": {"key": "runtimeVersion", "type": "str"}, + } + + def __init__(self, *, instance_type: Optional[str] = None, runtime_version: str = "3.1", **kwargs): + """ + :keyword instance_type: Optional type of VM used as supported by the compute target. + :paramtype instance_type: str + :keyword runtime_version: Version of spark runtime used for the job. + :paramtype runtime_version: str + """ + super().__init__(**kwargs) + self.instance_type = instance_type + self.runtime_version = runtime_version + + class SslConfiguration(_serialization.Model): """The ssl configuration for scoring. @@ -18111,9 +21429,84 @@ def __init__( ~azure.mgmt.machinelearningservices.models.StackMetaLearnerType """ super().__init__(**kwargs) - self.stack_meta_learner_k_wargs = stack_meta_learner_k_wargs - self.stack_meta_learner_train_percentage = stack_meta_learner_train_percentage - self.stack_meta_learner_type = stack_meta_learner_type + self.stack_meta_learner_k_wargs = stack_meta_learner_k_wargs + self.stack_meta_learner_train_percentage = stack_meta_learner_train_percentage + self.stack_meta_learner_type = stack_meta_learner_type + + +class StatusMessage(_serialization.Model): + """Active message associated with project. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service-defined message code. + :vartype code: str + :ivar created_date_time: Time in UTC at which the message was created. + :vartype created_date_time: ~datetime.datetime + :ivar level: Severity level of message. Known values are: "Error", "Information", and + "Warning". + :vartype level: str or ~azure.mgmt.machinelearningservices.models.StatusMessageLevel + :ivar message: A human-readable representation of the message code. + :vartype message: str + """ + + _validation = { + "code": {"readonly": True}, + "created_date_time": {"readonly": True}, + "level": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "created_date_time": {"key": "createdDateTime", "type": "iso-8601"}, + "level": {"key": "level", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.code = None + self.created_date_time = None + self.level = None + self.message = None + + +class StorageAccountDetails(_serialization.Model): + """Details of storage account to be used for the Registry. + + :ivar system_created_storage_account: + :vartype system_created_storage_account: + ~azure.mgmt.machinelearningservices.models.SystemCreatedStorageAccount + :ivar user_created_storage_account: + :vartype user_created_storage_account: + ~azure.mgmt.machinelearningservices.models.UserCreatedStorageAccount + """ + + _attribute_map = { + "system_created_storage_account": {"key": "systemCreatedStorageAccount", "type": "SystemCreatedStorageAccount"}, + "user_created_storage_account": {"key": "userCreatedStorageAccount", "type": "UserCreatedStorageAccount"}, + } + + def __init__( + self, + *, + system_created_storage_account: Optional["_models.SystemCreatedStorageAccount"] = None, + user_created_storage_account: Optional["_models.UserCreatedStorageAccount"] = None, + **kwargs + ): + """ + :keyword system_created_storage_account: + :paramtype system_created_storage_account: + ~azure.mgmt.machinelearningservices.models.SystemCreatedStorageAccount + :keyword user_created_storage_account: + :paramtype user_created_storage_account: + ~azure.mgmt.machinelearningservices.models.UserCreatedStorageAccount + """ + super().__init__(**kwargs) + self.system_created_storage_account = system_created_storage_account + self.user_created_storage_account = user_created_storage_account class SweepJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes @@ -18145,14 +21538,14 @@ class SweepJob(JobBaseProperties): # pylint: disable=too-many-instance-attribut :ivar is_archived: Is the asset archived?. :vartype is_archived: bool :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", - "Command", "Sweep", and "Pipeline". + "Command", "Labeling", "Sweep", "Pipeline", and "Spark". :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType :ivar services: List of JobEndpoints. For local jobs, a job endpoint will have an endpoint value of FileStreamObject. :vartype services: dict[str, ~azure.mgmt.machinelearningservices.models.JobService] :ivar status: Status of the job. Known values are: "NotStarted", "Starting", "Provisioning", "Preparing", "Queued", "Running", "Finalizing", "CancelRequested", "Completed", "Failed", - "Canceled", "NotResponding", "Paused", and "Unknown". + "Canceled", "NotResponding", "Paused", "Unknown", and "Scheduled". :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus :ivar early_termination: Early termination policies enable canceling poor-performing runs before they complete. @@ -18370,7 +21763,7 @@ class SynapseSpark(Compute): # pylint: disable=too-many-instance-attributes :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -18540,6 +21933,100 @@ def __init__( self.pool_name = pool_name +class SystemCreatedAcrAccount(_serialization.Model): + """SystemCreatedAcrAccount. + + :ivar acr_account_sku: + :vartype acr_account_sku: str + :ivar arm_resource_id: ARM ResourceId of a resource. + :vartype arm_resource_id: ~azure.mgmt.machinelearningservices.models.ArmResourceId + """ + + _attribute_map = { + "acr_account_sku": {"key": "acrAccountSku", "type": "str"}, + "arm_resource_id": {"key": "armResourceId", "type": "ArmResourceId"}, + } + + def __init__( + self, + *, + acr_account_sku: Optional[str] = None, + arm_resource_id: Optional["_models.ArmResourceId"] = None, + **kwargs + ): + """ + :keyword acr_account_sku: + :paramtype acr_account_sku: str + :keyword arm_resource_id: ARM ResourceId of a resource. + :paramtype arm_resource_id: ~azure.mgmt.machinelearningservices.models.ArmResourceId + """ + super().__init__(**kwargs) + self.acr_account_sku = acr_account_sku + self.arm_resource_id = arm_resource_id + + +class SystemCreatedStorageAccount(_serialization.Model): + """SystemCreatedStorageAccount. + + :ivar arm_resource_id: ARM ResourceId of a resource. + :vartype arm_resource_id: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :ivar storage_account_hns_enabled: + :vartype storage_account_hns_enabled: bool + :ivar storage_account_type: Allowed values: + "Standard_LRS", + "Standard_GRS", + "Standard_RAGRS", + "Standard_ZRS", + "Standard_GZRS", + "Standard_RAGZRS", + "Premium_LRS", + "Premium_ZRS". + :vartype storage_account_type: str + :ivar allow_blob_public_access: + :vartype allow_blob_public_access: bool + """ + + _attribute_map = { + "arm_resource_id": {"key": "armResourceId", "type": "ArmResourceId"}, + "storage_account_hns_enabled": {"key": "storageAccountHnsEnabled", "type": "bool"}, + "storage_account_type": {"key": "storageAccountType", "type": "str"}, + "allow_blob_public_access": {"key": "allowBlobPublicAccess", "type": "bool"}, + } + + def __init__( + self, + *, + arm_resource_id: Optional["_models.ArmResourceId"] = None, + storage_account_hns_enabled: Optional[bool] = None, + storage_account_type: Optional[str] = None, + allow_blob_public_access: Optional[bool] = None, + **kwargs + ): + """ + :keyword arm_resource_id: ARM ResourceId of a resource. + :paramtype arm_resource_id: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :keyword storage_account_hns_enabled: + :paramtype storage_account_hns_enabled: bool + :keyword storage_account_type: Allowed values: + "Standard_LRS", + "Standard_GRS", + "Standard_RAGRS", + "Standard_ZRS", + "Standard_GZRS", + "Standard_RAGZRS", + "Premium_LRS", + "Premium_ZRS". + :paramtype storage_account_type: str + :keyword allow_blob_public_access: + :paramtype allow_blob_public_access: bool + """ + super().__init__(**kwargs) + self.arm_resource_id = arm_resource_id + self.storage_account_hns_enabled = storage_account_hns_enabled + self.storage_account_type = storage_account_type + self.allow_blob_public_access = allow_blob_public_access + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -18638,6 +22125,372 @@ def __init__(self, **kwargs): self.version = None +class TableFixedParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Fixed training parameters that won't be swept over during AutoML Table training. + + :ivar booster: Specify the boosting type, e.g gbdt for XGBoost. + :vartype booster: str + :ivar boosting_type: Specify the boosting type, e.g gbdt for LightGBM. + :vartype boosting_type: str + :ivar grow_policy: Specify the grow policy, which controls the way new nodes are added to the + tree. + :vartype grow_policy: str + :ivar learning_rate: The learning rate for the training procedure. + :vartype learning_rate: float + :ivar max_bin: Specify the Maximum number of discrete bins to bucket continuous features . + :vartype max_bin: int + :ivar max_depth: Specify the max depth to limit the tree depth explicitly. + :vartype max_depth: int + :ivar max_leaves: Specify the max leaves to limit the tree leaves explicitly. + :vartype max_leaves: int + :ivar min_data_in_leaf: The minimum number of data per leaf. + :vartype min_data_in_leaf: int + :ivar min_split_gain: Minimum loss reduction required to make a further partition on a leaf + node of the tree. + :vartype min_split_gain: float + :ivar model_name: The name of the model to train. + :vartype model_name: str + :ivar n_estimators: Specify the number of trees (or rounds) in an model. + :vartype n_estimators: int + :ivar num_leaves: Specify the number of leaves. + :vartype num_leaves: int + :ivar preprocessor_name: The name of the preprocessor to use. + :vartype preprocessor_name: str + :ivar reg_alpha: L1 regularization term on weights. + :vartype reg_alpha: float + :ivar reg_lambda: L2 regularization term on weights. + :vartype reg_lambda: float + :ivar subsample: Subsample ratio of the training instance. + :vartype subsample: float + :ivar subsample_freq: Frequency of subsample. + :vartype subsample_freq: float + :ivar tree_method: Specify the tree method. + :vartype tree_method: str + :ivar with_mean: If true, center before scaling the data with StandardScalar. + :vartype with_mean: bool + :ivar with_std: If true, scaling the data with Unit Variance with StandardScalar. + :vartype with_std: bool + """ + + _attribute_map = { + "booster": {"key": "booster", "type": "str"}, + "boosting_type": {"key": "boostingType", "type": "str"}, + "grow_policy": {"key": "growPolicy", "type": "str"}, + "learning_rate": {"key": "learningRate", "type": "float"}, + "max_bin": {"key": "maxBin", "type": "int"}, + "max_depth": {"key": "maxDepth", "type": "int"}, + "max_leaves": {"key": "maxLeaves", "type": "int"}, + "min_data_in_leaf": {"key": "minDataInLeaf", "type": "int"}, + "min_split_gain": {"key": "minSplitGain", "type": "float"}, + "model_name": {"key": "modelName", "type": "str"}, + "n_estimators": {"key": "nEstimators", "type": "int"}, + "num_leaves": {"key": "numLeaves", "type": "int"}, + "preprocessor_name": {"key": "preprocessorName", "type": "str"}, + "reg_alpha": {"key": "regAlpha", "type": "float"}, + "reg_lambda": {"key": "regLambda", "type": "float"}, + "subsample": {"key": "subsample", "type": "float"}, + "subsample_freq": {"key": "subsampleFreq", "type": "float"}, + "tree_method": {"key": "treeMethod", "type": "str"}, + "with_mean": {"key": "withMean", "type": "bool"}, + "with_std": {"key": "withStd", "type": "bool"}, + } + + def __init__( + self, + *, + booster: Optional[str] = None, + boosting_type: Optional[str] = None, + grow_policy: Optional[str] = None, + learning_rate: Optional[float] = None, + max_bin: Optional[int] = None, + max_depth: Optional[int] = None, + max_leaves: Optional[int] = None, + min_data_in_leaf: Optional[int] = None, + min_split_gain: Optional[float] = None, + model_name: Optional[str] = None, + n_estimators: Optional[int] = None, + num_leaves: Optional[int] = None, + preprocessor_name: Optional[str] = None, + reg_alpha: Optional[float] = None, + reg_lambda: Optional[float] = None, + subsample: Optional[float] = None, + subsample_freq: Optional[float] = None, + tree_method: Optional[str] = None, + with_mean: bool = False, + with_std: bool = False, + **kwargs + ): + """ + :keyword booster: Specify the boosting type, e.g gbdt for XGBoost. + :paramtype booster: str + :keyword boosting_type: Specify the boosting type, e.g gbdt for LightGBM. + :paramtype boosting_type: str + :keyword grow_policy: Specify the grow policy, which controls the way new nodes are added to + the tree. + :paramtype grow_policy: str + :keyword learning_rate: The learning rate for the training procedure. + :paramtype learning_rate: float + :keyword max_bin: Specify the Maximum number of discrete bins to bucket continuous features . + :paramtype max_bin: int + :keyword max_depth: Specify the max depth to limit the tree depth explicitly. + :paramtype max_depth: int + :keyword max_leaves: Specify the max leaves to limit the tree leaves explicitly. + :paramtype max_leaves: int + :keyword min_data_in_leaf: The minimum number of data per leaf. + :paramtype min_data_in_leaf: int + :keyword min_split_gain: Minimum loss reduction required to make a further partition on a leaf + node of the tree. + :paramtype min_split_gain: float + :keyword model_name: The name of the model to train. + :paramtype model_name: str + :keyword n_estimators: Specify the number of trees (or rounds) in an model. + :paramtype n_estimators: int + :keyword num_leaves: Specify the number of leaves. + :paramtype num_leaves: int + :keyword preprocessor_name: The name of the preprocessor to use. + :paramtype preprocessor_name: str + :keyword reg_alpha: L1 regularization term on weights. + :paramtype reg_alpha: float + :keyword reg_lambda: L2 regularization term on weights. + :paramtype reg_lambda: float + :keyword subsample: Subsample ratio of the training instance. + :paramtype subsample: float + :keyword subsample_freq: Frequency of subsample. + :paramtype subsample_freq: float + :keyword tree_method: Specify the tree method. + :paramtype tree_method: str + :keyword with_mean: If true, center before scaling the data with StandardScalar. + :paramtype with_mean: bool + :keyword with_std: If true, scaling the data with Unit Variance with StandardScalar. + :paramtype with_std: bool + """ + super().__init__(**kwargs) + self.booster = booster + self.boosting_type = boosting_type + self.grow_policy = grow_policy + self.learning_rate = learning_rate + self.max_bin = max_bin + self.max_depth = max_depth + self.max_leaves = max_leaves + self.min_data_in_leaf = min_data_in_leaf + self.min_split_gain = min_split_gain + self.model_name = model_name + self.n_estimators = n_estimators + self.num_leaves = num_leaves + self.preprocessor_name = preprocessor_name + self.reg_alpha = reg_alpha + self.reg_lambda = reg_lambda + self.subsample = subsample + self.subsample_freq = subsample_freq + self.tree_method = tree_method + self.with_mean = with_mean + self.with_std = with_std + + +class TableParameterSubspace(_serialization.Model): # pylint: disable=too-many-instance-attributes + """TableParameterSubspace. + + :ivar booster: Specify the boosting type, e.g gbdt for XGBoost. + :vartype booster: str + :ivar boosting_type: Specify the boosting type, e.g gbdt for LightGBM. + :vartype boosting_type: str + :ivar grow_policy: Specify the grow policy, which controls the way new nodes are added to the + tree. + :vartype grow_policy: str + :ivar learning_rate: The learning rate for the training procedure. + :vartype learning_rate: str + :ivar max_bin: Specify the Maximum number of discrete bins to bucket continuous features . + :vartype max_bin: str + :ivar max_depth: Specify the max depth to limit the tree depth explicitly. + :vartype max_depth: str + :ivar max_leaves: Specify the max leaves to limit the tree leaves explicitly. + :vartype max_leaves: str + :ivar min_data_in_leaf: The minimum number of data per leaf. + :vartype min_data_in_leaf: str + :ivar min_split_gain: Minimum loss reduction required to make a further partition on a leaf + node of the tree. + :vartype min_split_gain: str + :ivar model_name: The name of the model to train. + :vartype model_name: str + :ivar n_estimators: Specify the number of trees (or rounds) in an model. + :vartype n_estimators: str + :ivar num_leaves: Specify the number of leaves. + :vartype num_leaves: str + :ivar preprocessor_name: The name of the preprocessor to use. + :vartype preprocessor_name: str + :ivar reg_alpha: L1 regularization term on weights. + :vartype reg_alpha: str + :ivar reg_lambda: L2 regularization term on weights. + :vartype reg_lambda: str + :ivar subsample: Subsample ratio of the training instance. + :vartype subsample: str + :ivar subsample_freq: Frequency of subsample. + :vartype subsample_freq: str + :ivar tree_method: Specify the tree method. + :vartype tree_method: str + :ivar with_mean: If true, center before scaling the data with StandardScalar. + :vartype with_mean: str + :ivar with_std: If true, scaling the data with Unit Variance with StandardScalar. + :vartype with_std: str + """ + + _attribute_map = { + "booster": {"key": "booster", "type": "str"}, + "boosting_type": {"key": "boostingType", "type": "str"}, + "grow_policy": {"key": "growPolicy", "type": "str"}, + "learning_rate": {"key": "learningRate", "type": "str"}, + "max_bin": {"key": "maxBin", "type": "str"}, + "max_depth": {"key": "maxDepth", "type": "str"}, + "max_leaves": {"key": "maxLeaves", "type": "str"}, + "min_data_in_leaf": {"key": "minDataInLeaf", "type": "str"}, + "min_split_gain": {"key": "minSplitGain", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "n_estimators": {"key": "nEstimators", "type": "str"}, + "num_leaves": {"key": "numLeaves", "type": "str"}, + "preprocessor_name": {"key": "preprocessorName", "type": "str"}, + "reg_alpha": {"key": "regAlpha", "type": "str"}, + "reg_lambda": {"key": "regLambda", "type": "str"}, + "subsample": {"key": "subsample", "type": "str"}, + "subsample_freq": {"key": "subsampleFreq", "type": "str"}, + "tree_method": {"key": "treeMethod", "type": "str"}, + "with_mean": {"key": "withMean", "type": "str"}, + "with_std": {"key": "withStd", "type": "str"}, + } + + def __init__( + self, + *, + booster: Optional[str] = None, + boosting_type: Optional[str] = None, + grow_policy: Optional[str] = None, + learning_rate: Optional[str] = None, + max_bin: Optional[str] = None, + max_depth: Optional[str] = None, + max_leaves: Optional[str] = None, + min_data_in_leaf: Optional[str] = None, + min_split_gain: Optional[str] = None, + model_name: Optional[str] = None, + n_estimators: Optional[str] = None, + num_leaves: Optional[str] = None, + preprocessor_name: Optional[str] = None, + reg_alpha: Optional[str] = None, + reg_lambda: Optional[str] = None, + subsample: Optional[str] = None, + subsample_freq: Optional[str] = None, + tree_method: Optional[str] = None, + with_mean: Optional[str] = None, + with_std: Optional[str] = None, + **kwargs + ): + """ + :keyword booster: Specify the boosting type, e.g gbdt for XGBoost. + :paramtype booster: str + :keyword boosting_type: Specify the boosting type, e.g gbdt for LightGBM. + :paramtype boosting_type: str + :keyword grow_policy: Specify the grow policy, which controls the way new nodes are added to + the tree. + :paramtype grow_policy: str + :keyword learning_rate: The learning rate for the training procedure. + :paramtype learning_rate: str + :keyword max_bin: Specify the Maximum number of discrete bins to bucket continuous features . + :paramtype max_bin: str + :keyword max_depth: Specify the max depth to limit the tree depth explicitly. + :paramtype max_depth: str + :keyword max_leaves: Specify the max leaves to limit the tree leaves explicitly. + :paramtype max_leaves: str + :keyword min_data_in_leaf: The minimum number of data per leaf. + :paramtype min_data_in_leaf: str + :keyword min_split_gain: Minimum loss reduction required to make a further partition on a leaf + node of the tree. + :paramtype min_split_gain: str + :keyword model_name: The name of the model to train. + :paramtype model_name: str + :keyword n_estimators: Specify the number of trees (or rounds) in an model. + :paramtype n_estimators: str + :keyword num_leaves: Specify the number of leaves. + :paramtype num_leaves: str + :keyword preprocessor_name: The name of the preprocessor to use. + :paramtype preprocessor_name: str + :keyword reg_alpha: L1 regularization term on weights. + :paramtype reg_alpha: str + :keyword reg_lambda: L2 regularization term on weights. + :paramtype reg_lambda: str + :keyword subsample: Subsample ratio of the training instance. + :paramtype subsample: str + :keyword subsample_freq: Frequency of subsample. + :paramtype subsample_freq: str + :keyword tree_method: Specify the tree method. + :paramtype tree_method: str + :keyword with_mean: If true, center before scaling the data with StandardScalar. + :paramtype with_mean: str + :keyword with_std: If true, scaling the data with Unit Variance with StandardScalar. + :paramtype with_std: str + """ + super().__init__(**kwargs) + self.booster = booster + self.boosting_type = boosting_type + self.grow_policy = grow_policy + self.learning_rate = learning_rate + self.max_bin = max_bin + self.max_depth = max_depth + self.max_leaves = max_leaves + self.min_data_in_leaf = min_data_in_leaf + self.min_split_gain = min_split_gain + self.model_name = model_name + self.n_estimators = n_estimators + self.num_leaves = num_leaves + self.preprocessor_name = preprocessor_name + self.reg_alpha = reg_alpha + self.reg_lambda = reg_lambda + self.subsample = subsample + self.subsample_freq = subsample_freq + self.tree_method = tree_method + self.with_mean = with_mean + self.with_std = with_std + + +class TableSweepSettings(_serialization.Model): + """TableSweepSettings. + + All required parameters must be populated in order to send to Azure. + + :ivar early_termination: Type of early termination policy for the sweeping job. + :vartype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :ivar sampling_algorithm: [Required] Type of sampling algorithm. Required. Known values are: + "Grid", "Random", and "Bayesian". + :vartype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + + _validation = { + "sampling_algorithm": {"required": True}, + } + + _attribute_map = { + "early_termination": {"key": "earlyTermination", "type": "EarlyTerminationPolicy"}, + "sampling_algorithm": {"key": "samplingAlgorithm", "type": "str"}, + } + + def __init__( + self, + *, + sampling_algorithm: Union[str, "_models.SamplingAlgorithmType"], + early_termination: Optional["_models.EarlyTerminationPolicy"] = None, + **kwargs + ): + """ + :keyword early_termination: Type of early termination policy for the sweeping job. + :paramtype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :keyword sampling_algorithm: [Required] Type of sampling algorithm. Required. Known values are: + "Grid", "Random", and "Bayesian". + :paramtype sampling_algorithm: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + super().__init__(**kwargs) + self.early_termination = early_termination + self.sampling_algorithm = sampling_algorithm + + class TableVerticalFeaturizationSettings(FeaturizationSettings): """Featurization Configuration. @@ -18727,8 +22580,14 @@ class TableVerticalLimitSettings(_serialization.Model): :vartype max_concurrent_trials: int :ivar max_cores_per_trial: Max cores per iteration. :vartype max_cores_per_trial: int + :ivar max_nodes: Maximum nodes to use for the experiment. + :vartype max_nodes: int :ivar max_trials: Number of iterations. :vartype max_trials: int + :ivar sweep_concurrent_trials: Number of concurrent sweeping runs that user wants to trigger. + :vartype sweep_concurrent_trials: int + :ivar sweep_trials: Number of sweeping runs that user wants to trigger. + :vartype sweep_trials: int :ivar timeout: AutoML job timeout. :vartype timeout: ~datetime.timedelta :ivar trial_timeout: Iteration timeout. @@ -18740,7 +22599,10 @@ class TableVerticalLimitSettings(_serialization.Model): "exit_score": {"key": "exitScore", "type": "float"}, "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, "max_cores_per_trial": {"key": "maxCoresPerTrial", "type": "int"}, + "max_nodes": {"key": "maxNodes", "type": "int"}, "max_trials": {"key": "maxTrials", "type": "int"}, + "sweep_concurrent_trials": {"key": "sweepConcurrentTrials", "type": "int"}, + "sweep_trials": {"key": "sweepTrials", "type": "int"}, "timeout": {"key": "timeout", "type": "duration"}, "trial_timeout": {"key": "trialTimeout", "type": "duration"}, } @@ -18752,7 +22614,10 @@ def __init__( exit_score: Optional[float] = None, max_concurrent_trials: int = 1, max_cores_per_trial: int = -1, + max_nodes: int = 1, max_trials: int = 1000, + sweep_concurrent_trials: int = 0, + sweep_trials: int = 0, timeout: datetime.timedelta = "PT6H", trial_timeout: datetime.timedelta = "PT30M", **kwargs @@ -18767,8 +22632,15 @@ def __init__( :paramtype max_concurrent_trials: int :keyword max_cores_per_trial: Max cores per iteration. :paramtype max_cores_per_trial: int + :keyword max_nodes: Maximum nodes to use for the experiment. + :paramtype max_nodes: int :keyword max_trials: Number of iterations. :paramtype max_trials: int + :keyword sweep_concurrent_trials: Number of concurrent sweeping runs that user wants to + trigger. + :paramtype sweep_concurrent_trials: int + :keyword sweep_trials: Number of sweeping runs that user wants to trigger. + :paramtype sweep_trials: int :keyword timeout: AutoML job timeout. :paramtype timeout: ~datetime.timedelta :keyword trial_timeout: Iteration timeout. @@ -18779,7 +22651,10 @@ def __init__( self.exit_score = exit_score self.max_concurrent_trials = max_concurrent_trials self.max_cores_per_trial = max_cores_per_trial + self.max_nodes = max_nodes self.max_trials = max_trials + self.sweep_concurrent_trials = sweep_concurrent_trials + self.sweep_trials = sweep_trials self.timeout = timeout self.trial_timeout = trial_timeout @@ -18882,7 +22757,7 @@ def __init__(self, *, parameter_server_count: int = 0, worker_count: Optional[in self.worker_count = worker_count -class TextClassification(NlpVertical, AutoMLVertical): +class TextClassification(NlpVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes """Text Classification task in AutoML NLP vertical. NLP - Natural Language Processing. @@ -18904,8 +22779,16 @@ class TextClassification(NlpVertical, AutoMLVertical): :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :ivar validation_data: Validation data inputs. :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar primary_metric: Primary metric for Text-Classification task. Known values are: @@ -18926,7 +22809,10 @@ class TextClassification(NlpVertical, AutoMLVertical): "task_type": {"key": "taskType", "type": "str"}, "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "NlpFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, + "search_space": {"key": "searchSpace", "type": "[NlpParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "NlpSweepSettings"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, "primary_metric": {"key": "primaryMetric", "type": "str"}, } @@ -18938,7 +22824,10 @@ def __init__( log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, target_column_name: Optional[str] = None, featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.NlpFixedParameters"] = None, limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, + search_space: Optional[List["_models.NlpParameterSubspace"]] = None, + sweep_settings: Optional["_models.NlpSweepSettings"] = None, validation_data: Optional["_models.MLTableJobInput"] = None, primary_metric: Optional[Union[str, "_models.ClassificationPrimaryMetrics"]] = None, **kwargs @@ -18955,8 +22844,16 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :keyword validation_data: Validation data inputs. :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :keyword primary_metric: Primary metric for Text-Classification task. Known values are: @@ -18967,7 +22864,10 @@ def __init__( """ super().__init__( featurization_settings=featurization_settings, + fixed_parameters=fixed_parameters, limit_settings=limit_settings, + search_space=search_space, + sweep_settings=sweep_settings, validation_data=validation_data, log_verbosity=log_verbosity, target_column_name=target_column_name, @@ -18980,11 +22880,14 @@ def __init__( self.training_data = training_data self.primary_metric = primary_metric self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings + self.search_space = search_space + self.sweep_settings = sweep_settings self.validation_data = validation_data -class TextClassificationMultilabel(NlpVertical, AutoMLVertical): +class TextClassificationMultilabel(NlpVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes """Text Classification Multilabel task in AutoML NLP vertical. NLP - Natural Language Processing. @@ -19008,8 +22911,16 @@ class TextClassificationMultilabel(NlpVertical, AutoMLVertical): :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :ivar validation_data: Validation data inputs. :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar primary_metric: Primary metric for Text-Classification-Multilabel task. @@ -19032,7 +22943,10 @@ class TextClassificationMultilabel(NlpVertical, AutoMLVertical): "task_type": {"key": "taskType", "type": "str"}, "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "NlpFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, + "search_space": {"key": "searchSpace", "type": "[NlpParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "NlpSweepSettings"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, "primary_metric": {"key": "primaryMetric", "type": "str"}, } @@ -19044,7 +22958,10 @@ def __init__( log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, target_column_name: Optional[str] = None, featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.NlpFixedParameters"] = None, limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, + search_space: Optional[List["_models.NlpParameterSubspace"]] = None, + sweep_settings: Optional["_models.NlpSweepSettings"] = None, validation_data: Optional["_models.MLTableJobInput"] = None, **kwargs ): @@ -19060,14 +22977,25 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :keyword validation_data: Validation data inputs. :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ super().__init__( featurization_settings=featurization_settings, + fixed_parameters=fixed_parameters, limit_settings=limit_settings, + search_space=search_space, + sweep_settings=sweep_settings, validation_data=validation_data, log_verbosity=log_verbosity, target_column_name=target_column_name, @@ -19080,11 +23008,14 @@ def __init__( self.training_data = training_data self.primary_metric = None self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings + self.search_space = search_space + self.sweep_settings = sweep_settings self.validation_data = validation_data -class TextNer(NlpVertical, AutoMLVertical): +class TextNer(NlpVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes """Text-NER task in AutoML NLP vertical. NER - Named Entity Recognition. NLP - Natural Language Processing. @@ -19109,8 +23040,16 @@ class TextNer(NlpVertical, AutoMLVertical): :ivar featurization_settings: Featurization inputs needed for AutoML job. :vartype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar fixed_parameters: Model/training parameters that will remain constant throughout + training. + :vartype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :ivar limit_settings: Execution constraints for AutoMLJob. :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :ivar sweep_settings: Settings for model sweeping and hyperparameter tuning. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :ivar validation_data: Validation data inputs. :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput :ivar primary_metric: Primary metric for Text-NER task. @@ -19133,7 +23072,10 @@ class TextNer(NlpVertical, AutoMLVertical): "task_type": {"key": "taskType", "type": "str"}, "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, + "fixed_parameters": {"key": "fixedParameters", "type": "NlpFixedParameters"}, "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, + "search_space": {"key": "searchSpace", "type": "[NlpParameterSubspace]"}, + "sweep_settings": {"key": "sweepSettings", "type": "NlpSweepSettings"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, "primary_metric": {"key": "primaryMetric", "type": "str"}, } @@ -19145,7 +23087,10 @@ def __init__( log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, target_column_name: Optional[str] = None, featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, + fixed_parameters: Optional["_models.NlpFixedParameters"] = None, limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, + search_space: Optional[List["_models.NlpParameterSubspace"]] = None, + sweep_settings: Optional["_models.NlpSweepSettings"] = None, validation_data: Optional["_models.MLTableJobInput"] = None, **kwargs ): @@ -19161,14 +23106,25 @@ def __init__( :keyword featurization_settings: Featurization inputs needed for AutoML job. :paramtype featurization_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword fixed_parameters: Model/training parameters that will remain constant throughout + training. + :paramtype fixed_parameters: ~azure.mgmt.machinelearningservices.models.NlpFixedParameters :keyword limit_settings: Execution constraints for AutoMLJob. :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: list[~azure.mgmt.machinelearningservices.models.NlpParameterSubspace] + :keyword sweep_settings: Settings for model sweeping and hyperparameter tuning. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.NlpSweepSettings :keyword validation_data: Validation data inputs. :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput """ super().__init__( featurization_settings=featurization_settings, + fixed_parameters=fixed_parameters, limit_settings=limit_settings, + search_space=search_space, + sweep_settings=sweep_settings, validation_data=validation_data, log_verbosity=log_verbosity, target_column_name=target_column_name, @@ -19181,10 +23137,33 @@ def __init__( self.training_data = training_data self.primary_metric = None self.featurization_settings = featurization_settings + self.fixed_parameters = fixed_parameters self.limit_settings = limit_settings + self.search_space = search_space + self.sweep_settings = sweep_settings self.validation_data = validation_data +class TmpfsOptions(_serialization.Model): + """TmpfsOptions. + + :ivar size: Mention the Tmpfs size. + :vartype size: int + """ + + _attribute_map = { + "size": {"key": "size", "type": "int"}, + } + + def __init__(self, *, size: Optional[int] = None, **kwargs): + """ + :keyword size: Mention the Tmpfs size. + :paramtype size: int + """ + super().__init__(**kwargs) + self.size = size + + class TrialComponent(_serialization.Model): """Trial component definition. @@ -19322,7 +23301,12 @@ class TritonModelJobOutput(AssetJobOutput, JobOutput): :ivar job_output_type: [Required] Specifies the type of job. Required. Known values are: "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and "triton_model". :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :ivar uri: Output Asset URI. :vartype uri: str @@ -19335,6 +23319,8 @@ class TritonModelJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -19343,6 +23329,8 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs @@ -19350,14 +23338,23 @@ def __init__( """ :keyword description: Description for the output. :paramtype description: str - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :keyword uri: Output Asset URI. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__( + asset_name=asset_name, asset_version=asset_version, mode=mode, uri=uri, description=description, **kwargs + ) self.description = description self.job_output_type: str = "triton_model" + self.asset_name = asset_name + self.asset_version = asset_version self.mode = mode self.uri = uri @@ -19503,9 +23500,8 @@ class UriFileDataVersion(DataVersionBaseProperties): :ivar data_type: [Required] Specifies the type of data. Required. Known values are: "uri_file", "uri_folder", and "mltable". :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType - :ivar data_uri: [Required] Uri of the data. Usage/meaning depends on - Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType. - Required. + :ivar data_uri: [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. :vartype data_uri: str """ @@ -19546,9 +23542,8 @@ def __init__( :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool - :keyword data_uri: [Required] Uri of the data. Usage/meaning depends on - Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType. - Required. + :keyword data_uri: [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. :paramtype data_uri: str """ super().__init__( @@ -19627,7 +23622,12 @@ class UriFileJobOutput(AssetJobOutput, JobOutput): :ivar job_output_type: [Required] Specifies the type of job. Required. Known values are: "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and "triton_model". :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :ivar uri: Output Asset URI. :vartype uri: str @@ -19640,6 +23640,8 @@ class UriFileJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -19648,6 +23650,8 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs @@ -19655,14 +23659,23 @@ def __init__( """ :keyword description: Description for the output. :paramtype description: str - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :keyword uri: Output Asset URI. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__( + asset_name=asset_name, asset_version=asset_version, mode=mode, uri=uri, description=description, **kwargs + ) self.description = description self.job_output_type: str = "uri_file" + self.asset_name = asset_name + self.asset_version = asset_version self.mode = mode self.uri = uri @@ -19685,9 +23698,8 @@ class UriFolderDataVersion(DataVersionBaseProperties): :ivar data_type: [Required] Specifies the type of data. Required. Known values are: "uri_file", "uri_folder", and "mltable". :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType - :ivar data_uri: [Required] Uri of the data. Usage/meaning depends on - Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType. - Required. + :ivar data_uri: [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. :vartype data_uri: str """ @@ -19728,9 +23740,8 @@ def __init__( :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool - :keyword data_uri: [Required] Uri of the data. Usage/meaning depends on - Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType. - Required. + :keyword data_uri: [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. :paramtype data_uri: str """ super().__init__( @@ -19809,7 +23820,12 @@ class UriFolderJobOutput(AssetJobOutput, JobOutput): :ivar job_output_type: [Required] Specifies the type of job. Required. Known values are: "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and "triton_model". :vartype job_output_type: str or ~azure.mgmt.machinelearningservices.models.JobOutputType - :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :ivar asset_name: Output Asset Name. + :vartype asset_name: str + :ivar asset_version: Output Asset Version. + :vartype asset_version: str + :ivar mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :ivar uri: Output Asset URI. :vartype uri: str @@ -19822,6 +23838,8 @@ class UriFolderJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "asset_version": {"key": "assetVersion", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -19830,6 +23848,8 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, + asset_version: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs @@ -19837,14 +23857,23 @@ def __init__( """ :keyword description: Description for the output. :paramtype description: str - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: str + :keyword asset_version: Output Asset Version. + :paramtype asset_version: str + :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount", "Upload", and + "Direct". :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode :keyword uri: Output Asset URI. :paramtype uri: str """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) + super().__init__( + asset_name=asset_name, asset_version=asset_version, mode=mode, uri=uri, description=description, **kwargs + ) self.description = description self.job_output_type: str = "uri_folder" + self.asset_name = asset_name + self.asset_version = asset_version self.mode = mode self.uri = uri @@ -20005,6 +24034,46 @@ def __init__(self, **kwargs): self.client_id = None +class UserCreatedAcrAccount(_serialization.Model): + """UserCreatedAcrAccount. + + :ivar arm_resource_id: ARM ResourceId of a resource. + :vartype arm_resource_id: ~azure.mgmt.machinelearningservices.models.ArmResourceId + """ + + _attribute_map = { + "arm_resource_id": {"key": "armResourceId", "type": "ArmResourceId"}, + } + + def __init__(self, *, arm_resource_id: Optional["_models.ArmResourceId"] = None, **kwargs): + """ + :keyword arm_resource_id: ARM ResourceId of a resource. + :paramtype arm_resource_id: ~azure.mgmt.machinelearningservices.models.ArmResourceId + """ + super().__init__(**kwargs) + self.arm_resource_id = arm_resource_id + + +class UserCreatedStorageAccount(_serialization.Model): + """UserCreatedStorageAccount. + + :ivar arm_resource_id: ARM ResourceId of a resource. + :vartype arm_resource_id: ~azure.mgmt.machinelearningservices.models.ArmResourceId + """ + + _attribute_map = { + "arm_resource_id": {"key": "armResourceId", "type": "ArmResourceId"}, + } + + def __init__(self, *, arm_resource_id: Optional["_models.ArmResourceId"] = None, **kwargs): + """ + :keyword arm_resource_id: ARM ResourceId of a resource. + :paramtype arm_resource_id: ~azure.mgmt.machinelearningservices.models.ArmResourceId + """ + super().__init__(**kwargs) + self.arm_resource_id = arm_resource_id + + class UserIdentity(IdentityConfiguration): """User identity configuration. @@ -20036,10 +24105,12 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP All required parameters must be populated in order to send to Azure. :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "ServicePrincipal", and + "AccessKey". :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType :ivar category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :ivar target: :vartype target: str @@ -20077,7 +24148,8 @@ def __init__( ): """ :keyword category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "FeatureStore", "S3", "Snowflake", "AzureSqlDb", and + "AzureSynapseAnalytics". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory :keyword target: :paramtype target: str @@ -20132,7 +24204,7 @@ class VirtualMachine(Compute, VirtualMachineSchema): # pylint: disable=too-many :vartype compute_location: str :ivar provisioning_state: The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, Succeeded, and Failed. Known values are: "Unknown", "Updating", - "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar description: The description of the Machine Learning compute. @@ -20518,6 +24590,103 @@ def __init__( self.private_key_data = private_key_data +class VolumeDefinition(_serialization.Model): + """VolumeDefinition. + + :ivar type: Type of Volume Definition. Possible Values: bind,volume,tmpfs,npipe. Known values + are: "bind", "volume", "tmpfs", and "npipe". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.VolumeDefinitionType + :ivar read_only: Indicate whether to mount volume as readOnly. Default value for this is false. + :vartype read_only: bool + :ivar source: Source of the mount. For bind mounts this is the host path. + :vartype source: str + :ivar target: Target of the mount. For bind mounts this is the path in the container. + :vartype target: str + :ivar consistency: Consistency of the volume. + :vartype consistency: str + :ivar bind: Bind Options of the mount. + :vartype bind: ~azure.mgmt.machinelearningservices.models.BindOptions + :ivar volume: Volume Options of the mount. + :vartype volume: ~azure.mgmt.machinelearningservices.models.VolumeOptions + :ivar tmpfs: tmpfs option of the mount. + :vartype tmpfs: ~azure.mgmt.machinelearningservices.models.TmpfsOptions + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "read_only": {"key": "readOnly", "type": "bool"}, + "source": {"key": "source", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "consistency": {"key": "consistency", "type": "str"}, + "bind": {"key": "bind", "type": "BindOptions"}, + "volume": {"key": "volume", "type": "VolumeOptions"}, + "tmpfs": {"key": "tmpfs", "type": "TmpfsOptions"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.VolumeDefinitionType"] = "bind", + read_only: Optional[bool] = None, + source: Optional[str] = None, + target: Optional[str] = None, + consistency: Optional[str] = None, + bind: Optional["_models.BindOptions"] = None, + volume: Optional["_models.VolumeOptions"] = None, + tmpfs: Optional["_models.TmpfsOptions"] = None, + **kwargs + ): + """ + :keyword type: Type of Volume Definition. Possible Values: bind,volume,tmpfs,npipe. Known + values are: "bind", "volume", "tmpfs", and "npipe". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.VolumeDefinitionType + :keyword read_only: Indicate whether to mount volume as readOnly. Default value for this is + false. + :paramtype read_only: bool + :keyword source: Source of the mount. For bind mounts this is the host path. + :paramtype source: str + :keyword target: Target of the mount. For bind mounts this is the path in the container. + :paramtype target: str + :keyword consistency: Consistency of the volume. + :paramtype consistency: str + :keyword bind: Bind Options of the mount. + :paramtype bind: ~azure.mgmt.machinelearningservices.models.BindOptions + :keyword volume: Volume Options of the mount. + :paramtype volume: ~azure.mgmt.machinelearningservices.models.VolumeOptions + :keyword tmpfs: tmpfs option of the mount. + :paramtype tmpfs: ~azure.mgmt.machinelearningservices.models.TmpfsOptions + """ + super().__init__(**kwargs) + self.type = type + self.read_only = read_only + self.source = source + self.target = target + self.consistency = consistency + self.bind = bind + self.volume = volume + self.tmpfs = tmpfs + + +class VolumeOptions(_serialization.Model): + """VolumeOptions. + + :ivar nocopy: Indicate whether volume is nocopy. + :vartype nocopy: bool + """ + + _attribute_map = { + "nocopy": {"key": "nocopy", "type": "bool"}, + } + + def __init__(self, *, nocopy: Optional[bool] = None, **kwargs): + """ + :keyword nocopy: Indicate whether volume is nocopy. + :paramtype nocopy: bool + """ + super().__init__(**kwargs) + self.nocopy = nocopy + + class Workspace(Resource): # pylint: disable=too-many-instance-attributes """An object that represents a machine learning workspace. @@ -20563,7 +24732,7 @@ class Workspace(Resource): # pylint: disable=too-many-instance-attributes :vartype discovery_url: str :ivar provisioning_state: The current deployment state of workspace resource. The provisioningState is to indicate states for resource provisioning. Known values are: "Unknown", - "Updating", "Creating", "Deleting", "Succeeded", "Failed", and "Canceled". + "Updating", "Creating", "Deleting", "Succeeded", "Failed", "Canceled", and "SoftDeleted". :vartype provisioning_state: str or ~azure.mgmt.machinelearningservices.models.ProvisioningState :ivar encryption: The encryption settings of Azure ML workspace. @@ -20611,6 +24780,14 @@ class Workspace(Resource): # pylint: disable=too-many-instance-attributes :ivar v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :vartype v1_legacy_mode: bool + :ivar soft_deleted_at: The timestamp when the workspace was soft deleted. + :vartype soft_deleted_at: str + :ivar scheduled_purge_date: The timestamp when the soft deleted workspace is going to be + purged. + :vartype scheduled_purge_date: str + :ivar system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. + :vartype system_datastores_auth_mode: str """ _validation = { @@ -20627,6 +24804,8 @@ class Workspace(Resource): # pylint: disable=too-many-instance-attributes "tenant_id": {"readonly": True}, "storage_hns_enabled": {"readonly": True}, "ml_flow_tracking_uri": {"readonly": True}, + "soft_deleted_at": {"readonly": True}, + "scheduled_purge_date": {"readonly": True}, } _attribute_map = { @@ -20672,6 +24851,9 @@ class Workspace(Resource): # pylint: disable=too-many-instance-attributes "storage_hns_enabled": {"key": "properties.storageHnsEnabled", "type": "bool"}, "ml_flow_tracking_uri": {"key": "properties.mlFlowTrackingUri", "type": "str"}, "v1_legacy_mode": {"key": "properties.v1LegacyMode", "type": "bool"}, + "soft_deleted_at": {"key": "properties.softDeletedAt", "type": "str"}, + "scheduled_purge_date": {"key": "properties.scheduledPurgeDate", "type": "str"}, + "system_datastores_auth_mode": {"key": "properties.systemDatastoresAuthMode", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -20697,6 +24879,7 @@ def __init__( # pylint: disable=too-many-locals service_managed_resources_settings: Optional["_models.ServiceManagedResourcesSettings"] = None, primary_user_assigned_identity: Optional[str] = None, v1_legacy_mode: bool = False, + system_datastores_auth_mode: Optional[str] = None, **kwargs ): """ @@ -20753,6 +24936,9 @@ def __init__( # pylint: disable=too-many-locals :keyword v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API. :paramtype v1_legacy_mode: bool + :keyword system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. + :paramtype system_datastores_auth_mode: str """ super().__init__(**kwargs) self.identity = identity @@ -20784,6 +24970,35 @@ def __init__( # pylint: disable=too-many-locals self.storage_hns_enabled = None self.ml_flow_tracking_uri = None self.v1_legacy_mode = v1_legacy_mode + self.soft_deleted_at = None + self.scheduled_purge_date = None + self.system_datastores_auth_mode = system_datastores_auth_mode + + +class WorkspaceConnectionAccessKey(_serialization.Model): + """WorkspaceConnectionAccessKey. + + :ivar access_key_id: + :vartype access_key_id: str + :ivar secret_access_key: + :vartype secret_access_key: str + """ + + _attribute_map = { + "access_key_id": {"key": "accessKeyId", "type": "str"}, + "secret_access_key": {"key": "secretAccessKey", "type": "str"}, + } + + def __init__(self, *, access_key_id: Optional[str] = None, secret_access_key: Optional[str] = None, **kwargs): + """ + :keyword access_key_id: + :paramtype access_key_id: str + :keyword secret_access_key: + :paramtype secret_access_key: str + """ + super().__init__(**kwargs) + self.access_key_id = access_key_id + self.secret_access_key = secret_access_key class WorkspaceConnectionManagedIdentity(_serialization.Model): @@ -20914,6 +25129,45 @@ def __init__( self.next_link = None +class WorkspaceConnectionServicePrincipal(_serialization.Model): + """WorkspaceConnectionServicePrincipal. + + :ivar client_id: + :vartype client_id: str + :ivar client_secret: + :vartype client_secret: str + :ivar tenant_id: + :vartype tenant_id: str + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + """ + :keyword client_id: + :paramtype client_id: str + :keyword client_secret: + :paramtype client_secret: str + :keyword tenant_id: + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.client_id = client_id + self.client_secret = client_secret + self.tenant_id = tenant_id + + class WorkspaceConnectionSharedAccessSignature(_serialization.Model): """WorkspaceConnectionSharedAccessSignature. @@ -21019,6 +25273,8 @@ class WorkspaceUpdateParameters(_serialization.Model): # pylint: disable=too-ma :vartype application_insights: str :ivar container_registry: ARM id of the container registry associated with this workspace. :vartype container_registry: str + :ivar encryption: The encryption settings of the workspace. + :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties """ _attribute_map = { @@ -21036,6 +25292,7 @@ class WorkspaceUpdateParameters(_serialization.Model): # pylint: disable=too-ma "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, "application_insights": {"key": "properties.applicationInsights", "type": "str"}, "container_registry": {"key": "properties.containerRegistry", "type": "str"}, + "encryption": {"key": "properties.encryption", "type": "EncryptionUpdateProperties"}, } def __init__( @@ -21052,6 +25309,7 @@ def __init__( public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, application_insights: Optional[str] = None, container_registry: Optional[str] = None, + encryption: Optional["_models.EncryptionUpdateProperties"] = None, **kwargs ): """ @@ -21082,6 +25340,8 @@ def __init__( :paramtype application_insights: str :keyword container_registry: ARM id of the container registry associated with this workspace. :paramtype container_registry: str + :keyword encryption: The encryption settings of the workspace. + :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties """ super().__init__(**kwargs) self.tags = tags @@ -21095,3 +25355,4 @@ def __init__( self.public_network_access = public_network_access self.application_insights = application_insights self.container_registry = container_registry + self.encryption = encryption diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/__init__.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/__init__.py index 0065485916d9..60c27f074b69 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/__init__.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/__init__.py @@ -15,6 +15,14 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._workspace_connections_operations import WorkspaceConnectionsOperations +from ._registry_code_containers_operations import RegistryCodeContainersOperations +from ._registry_code_versions_operations import RegistryCodeVersionsOperations +from ._registry_component_containers_operations import RegistryComponentContainersOperations +from ._registry_component_versions_operations import RegistryComponentVersionsOperations +from ._registry_environment_containers_operations import RegistryEnvironmentContainersOperations +from ._registry_environment_versions_operations import RegistryEnvironmentVersionsOperations +from ._registry_model_containers_operations import RegistryModelContainersOperations +from ._registry_model_versions_operations import RegistryModelVersionsOperations from ._batch_endpoints_operations import BatchEndpointsOperations from ._batch_deployments_operations import BatchDeploymentsOperations from ._code_containers_operations import CodeContainersOperations @@ -27,11 +35,13 @@ from ._environment_containers_operations import EnvironmentContainersOperations from ._environment_versions_operations import EnvironmentVersionsOperations from ._jobs_operations import JobsOperations +from ._labeling_jobs_operations import LabelingJobsOperations from ._model_containers_operations import ModelContainersOperations from ._model_versions_operations import ModelVersionsOperations from ._online_endpoints_operations import OnlineEndpointsOperations from ._online_deployments_operations import OnlineDeploymentsOperations from ._schedules_operations import SchedulesOperations +from ._registries_operations import RegistriesOperations from ._workspace_features_operations import WorkspaceFeaturesOperations from ._patch import __all__ as _patch_all @@ -48,6 +58,14 @@ "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", "WorkspaceConnectionsOperations", + "RegistryCodeContainersOperations", + "RegistryCodeVersionsOperations", + "RegistryComponentContainersOperations", + "RegistryComponentVersionsOperations", + "RegistryEnvironmentContainersOperations", + "RegistryEnvironmentVersionsOperations", + "RegistryModelContainersOperations", + "RegistryModelVersionsOperations", "BatchEndpointsOperations", "BatchDeploymentsOperations", "CodeContainersOperations", @@ -60,11 +78,13 @@ "EnvironmentContainersOperations", "EnvironmentVersionsOperations", "JobsOperations", + "LabelingJobsOperations", "ModelContainersOperations", "ModelVersionsOperations", "OnlineEndpointsOperations", "OnlineDeploymentsOperations", "SchedulesOperations", + "RegistriesOperations", "WorkspaceFeaturesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_batch_deployments_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_batch_deployments_operations.py index 944b8300d2f5..e26471601574 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_batch_deployments_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_batch_deployments_operations.py @@ -57,7 +57,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +104,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +146,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +188,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -229,7 +237,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -321,7 +331,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.BatchDeploymentTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -413,7 +423,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -490,7 +500,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -567,7 +577,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.BatchDeployment] = kwargs.pop("cls", None) @@ -628,7 +638,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -830,7 +840,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -899,7 +909,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1100,7 +1110,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_batch_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_batch_endpoints_operations.py index 5813ab488a03..9ba6ac125e07 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_batch_endpoints_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_batch_endpoints_operations.py @@ -55,7 +55,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +94,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +130,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +166,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -199,7 +207,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -238,7 +248,9 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -315,7 +327,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.BatchEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -405,7 +417,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -479,7 +491,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -553,7 +565,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.BatchEndpoint] = kwargs.pop("cls", None) @@ -612,7 +624,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -800,7 +812,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -867,7 +879,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1055,7 +1067,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1134,7 +1146,7 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_code_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_code_containers_operations.py index 637d9072c910..4e790963f464 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_code_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_code_containers_operations.py @@ -47,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +84,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +120,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +156,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -223,7 +231,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CodeContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -329,7 +337,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -394,7 +402,7 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) @@ -542,7 +550,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_code_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_code_versions_operations.py index 561baa83676c..e94ccffa3ebd 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_code_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_code_versions_operations.py @@ -55,7 +55,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -95,7 +97,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +134,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +171,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -252,7 +260,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CodeVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -363,7 +371,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -433,7 +441,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) @@ -590,7 +598,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_component_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_component_containers_operations.py index 4b9361f4a37c..0ce597767ec4 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_component_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_component_containers_operations.py @@ -53,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +92,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +128,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +164,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -240,7 +248,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComponentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -347,7 +355,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -414,7 +422,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) @@ -562,7 +570,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_component_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_component_versions_operations.py index 5e99740483db..4d560d02dbc3 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_component_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_component_versions_operations.py @@ -56,7 +56,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +100,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +137,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +174,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -260,7 +268,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComponentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -372,7 +380,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -442,7 +450,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) @@ -599,7 +607,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_compute_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_compute_operations.py index 51927e5687de..31077fb07eeb 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_compute_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_compute_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -49,7 +49,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +86,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +122,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -155,7 +161,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -198,7 +206,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -229,13 +239,54 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) +def build_update_custom_services_request( + resource_group_name: str, workspace_name: str, compute_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/customServices", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_nodes_request( resource_group_name: str, workspace_name: str, compute_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -269,7 +320,9 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,7 +356,9 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -337,7 +392,9 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -371,7 +428,9 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -399,6 +458,45 @@ def build_restart_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_update_idle_shutdown_setting_request( + resource_group_name: str, workspace_name: str, compute_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateIdleShutdownSetting", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class ComputeOperations: """ .. warning:: @@ -440,7 +538,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PaginatedComputeResourcesList] = kwargs.pop("cls", None) @@ -545,7 +643,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComputeResource] = kwargs.pop("cls", None) @@ -604,7 +702,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -792,7 +890,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -859,7 +957,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1035,7 +1133,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1102,7 +1200,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1184,7 +1282,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1228,6 +1326,156 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" } + @overload + def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: List[_models.CustomService], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Required. + :type custom_services: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: Union[List[_models.CustomService], IO], + **kwargs: Any + ) -> None: + """Updates the custom services list. The list of custom services provided shall be overwritten. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param custom_services: New list of Custom Services. Is either a list type or a IO type. + Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(custom_services, (IO, bytes)): + _content = custom_services + else: + _json = self._serialize.body(custom_services, "[CustomService]") + + request = build_update_custom_services_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_custom_services.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_custom_services.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/customServices" + } + @distributed_trace def list_nodes( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any @@ -1251,7 +1499,7 @@ def list_nodes( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AmlComputeNodesInformation] = kwargs.pop("cls", None) @@ -1355,7 +1603,7 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ComputeSecrets] = kwargs.pop("cls", None) @@ -1409,7 +1657,7 @@ def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1473,7 +1721,7 @@ def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1530,7 +1778,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1594,7 +1842,7 @@ def begin_stop( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1651,7 +1899,7 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1715,7 +1963,7 @@ def begin_restart( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1757,3 +2005,155 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- begin_restart.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart" } + + @overload + def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: _models.IdleShutdownSetting, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @overload + def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: 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: + """ + + @distributed_trace + def update_idle_shutdown_setting( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.IdleShutdownSetting, IO], + **kwargs: Any + ) -> None: + """Updates the idle shutdown setting of a compute instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param compute_name: Name of the Azure Machine Learning compute. Required. + :type compute_name: str + :param parameters: The object for updating idle shutdown setting of specified ComputeInstance. + Is either a model type or a IO type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: 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: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "IdleShutdownSetting") + + request = build_update_idle_shutdown_setting_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update_idle_shutdown_setting.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + update_idle_shutdown_setting.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/updateIdleShutdownSetting" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_data_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_data_containers_operations.py index 3b5d3acc38c6..27fcd9c53d1e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_data_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_data_containers_operations.py @@ -53,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +92,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +128,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +164,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -239,7 +247,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -346,7 +354,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -411,7 +419,7 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataContainer] = kwargs.pop("cls", None) @@ -559,7 +567,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_data_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_data_versions_operations.py index 092363a5e2f3..f79d99d2d557 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_data_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_data_versions_operations.py @@ -57,7 +57,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +103,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +140,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +177,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -271,7 +279,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataVersionBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -384,7 +392,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -454,7 +462,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataVersionBase] = kwargs.pop("cls", None) @@ -611,7 +619,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_datastores_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_datastores_operations.py index bc01c32a0983..e565cacfeab4 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_datastores_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_datastores_operations.py @@ -58,7 +58,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +107,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +143,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -179,7 +185,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -218,7 +226,9 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,7 +320,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatastoreResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -422,7 +432,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -487,7 +497,7 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) @@ -644,7 +654,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -732,7 +742,7 @@ def list_secrets( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DatastoreSecrets] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_environment_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_environment_containers_operations.py index d80de1f2b3c7..eb642cf1293c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_environment_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_environment_containers_operations.py @@ -53,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +92,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +128,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +164,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -241,7 +249,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EnvironmentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -348,7 +356,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -415,7 +423,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) @@ -563,7 +571,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_environment_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_environment_versions_operations.py index d898cb3c67dd..55aa97234462 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_environment_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_environment_versions_operations.py @@ -56,7 +56,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +100,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -133,7 +137,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +174,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -260,7 +268,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EnvironmentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -372,7 +380,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -442,7 +450,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) @@ -599,7 +607,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_jobs_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_jobs_operations.py index cd8bd0bd0c47..b60639625a2d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_jobs_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_jobs_operations.py @@ -52,12 +52,16 @@ def build_list_request( job_type: Optional[str] = None, tag: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + scheduled: Optional[bool] = None, + schedule_id: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,6 +89,10 @@ def build_list_request( _params["tag"] = _SERIALIZER.query("tag", tag, "str") if list_view_type is not None: _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if scheduled is not None: + _params["scheduled"] = _SERIALIZER.query("scheduled", scheduled, "bool") + if schedule_id is not None: + _params["scheduleId"] = _SERIALIZER.query("schedule_id", schedule_id, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -98,7 +106,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +142,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +178,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -203,7 +217,9 @@ def build_cancel_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -259,6 +275,8 @@ def list( job_type: Optional[str] = None, tag: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + scheduled: Optional[bool] = None, + schedule_id: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.JobBase"]: """Lists Jobs in the workspace. @@ -279,6 +297,10 @@ def list( :param list_view_type: View type for including/excluding (for example) archived entities. Known values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :param scheduled: Indicator whether the job is scheduled job. Default value is None. + :type scheduled: bool + :param schedule_id: The scheduled id for listing the job triggered from. Default value is None. + :type schedule_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobBase or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.JobBase] @@ -287,7 +309,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.JobBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -311,6 +333,8 @@ def prepare_request(next_link=None): job_type=job_type, tag=tag, list_view_type=list_view_type, + scheduled=scheduled, + schedule_id=schedule_id, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -379,7 +403,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -451,7 +475,7 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, id: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -523,7 +547,7 @@ def get(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.JobBase] = kwargs.pop("cls", None) @@ -665,7 +689,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -735,7 +759,7 @@ def _cancel_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -804,7 +828,7 @@ def begin_cancel(self, resource_group_name: str, workspace_name: str, id: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_labeling_jobs_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_labeling_jobs_operations.py new file mode 100644 index 000000000000..a98ce92e571d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_labeling_jobs_operations.py @@ -0,0 +1,1303 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + *, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + workspace_name: str, + id: str, + subscription_id: str, + *, + include_job_instructions: bool = False, + include_label_categories: bool = False, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_job_instructions is not None: + _params["includeJobInstructions"] = _SERIALIZER.query( + "include_job_instructions", include_job_instructions, "bool" + ) + if include_label_categories is not None: + _params["includeLabelCategories"] = _SERIALIZER.query( + "include_label_categories", include_label_categories, "bool" + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "id": _SERIALIZER.url("id", id, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_export_labels_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_pause_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/pause", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resume_request( + resource_group_name: str, workspace_name: str, id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "id": _SERIALIZER.url("id", id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class LabelingJobsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`labeling_jobs` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + workspace_name: str, + skip: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.LabelingJob"]: + """Lists labeling jobs in the workspace. + + Lists labeling jobs in the workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param top: Number of labeling jobs to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LabelingJob or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.LabelingJobResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + skip=skip, + top=top, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("LabelingJobResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> None: + """Delete a labeling job. + + Delete a labeling job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + workspace_name: str, + id: str, + include_job_instructions: bool = False, + include_label_categories: bool = False, + **kwargs: Any + ) -> _models.LabelingJob: + """Gets a labeling job by name/id. + + Gets a labeling job by name/id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param include_job_instructions: Boolean value to indicate whether to include JobInstructions + in response. Default value is False. + :type include_job_instructions: bool + :param include_label_categories: Boolean value to indicate Whether to include LabelCategories + in response. Default value is False. + :type include_label_categories: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LabelingJob or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.LabelingJob + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.LabelingJob] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + include_job_instructions=include_job_instructions, + include_label_categories=include_label_categories, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.LabelingJob, IO], + **kwargs: Any + ) -> _models.LabelingJob: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabelingJob] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "LabelingJob") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("LabelingJob", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.LabelingJob, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Required. + :type body: ~azure.mgmt.machinelearningservices.models.LabelingJob + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.LabelingJob, IO], + **kwargs: Any + ) -> LROPoller[_models.LabelingJob]: + """Creates or updates a labeling job (asynchronous). + + Creates or updates a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: LabelingJob definition object. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.LabelingJob or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LabelingJob or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.LabelingJob] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LabelingJob] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("LabelingJob", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}" + } + + def _export_labels_initial( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.ExportSummary, IO], + **kwargs: Any + ) -> Optional[_models.ExportSummary]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ExportSummary]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ExportSummary") + + request = build_export_labels_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._export_labels_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ExportSummary", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _export_labels_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels" + } + + @overload + def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: _models.ExportSummary, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). + + Export labels from a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ExportSummary + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). + + Export labels from a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_export_labels( + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.ExportSummary, IO], + **kwargs: Any + ) -> LROPoller[_models.ExportSummary]: + """Export labels from a labeling job (asynchronous). + + Export labels from a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :param body: The export summary. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ExportSummary or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExportSummary or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ExportSummary] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ExportSummary] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._export_labels_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ExportSummary", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_export_labels.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/exportLabels" + } + + @distributed_trace + def pause( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> None: + """Pause a labeling job. + + Pause a labeling job. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_pause_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.pause.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + pause.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/pause" + } + + def _resume_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_resume_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._resume_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _resume_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume" + } + + @distributed_trace + def begin_resume(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any) -> LROPoller[None]: + """Resume a labeling job (asynchronous). + + Resume a labeling job (asynchronous). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param id: The name and identifier for the LabelingJob. Required. + :type id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._resume_initial( # type: ignore + resource_group_name=resource_group_name, + workspace_name=workspace_name, + id=id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_resume.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/labelingJobs/{id}/resume" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_model_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_model_containers_operations.py index 2c416fba2772..bd1f00ee4e53 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_model_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_model_containers_operations.py @@ -54,7 +54,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +95,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +131,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -161,7 +167,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -245,7 +253,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ModelContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -353,7 +361,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -418,7 +426,7 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) @@ -566,7 +574,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_model_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_model_versions_operations.py index 775841fe3ae4..ac27b0d0b551 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_model_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_model_versions_operations.py @@ -62,7 +62,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +118,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +155,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -186,7 +192,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -297,7 +305,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ModelVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -415,7 +423,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -485,7 +493,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) @@ -642,7 +650,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_online_deployments_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_online_deployments_operations.py index cf048b3e2993..8c85ffe32dcd 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_online_deployments_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_online_deployments_operations.py @@ -57,7 +57,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +104,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +146,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -182,7 +188,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -229,7 +237,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -276,7 +286,9 @@ def build_get_logs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -322,7 +334,9 @@ def build_list_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -411,7 +425,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OnlineDeploymentTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -503,7 +517,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -580,7 +594,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -657,7 +671,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OnlineDeployment] = kwargs.pop("cls", None) @@ -718,7 +732,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -918,7 +932,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -987,7 +1001,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1188,7 +1202,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1354,7 +1368,7 @@ def get_logs( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1443,7 +1457,7 @@ def list_skus( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SkuResourceArmPaginatedResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_online_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_online_endpoints_operations.py index 9d9051dce1f7..e9094b4ddbfa 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_online_endpoints_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_online_endpoints_operations.py @@ -60,7 +60,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +109,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +145,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -175,7 +181,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -212,7 +220,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -251,7 +261,9 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -285,7 +297,9 @@ def build_regenerate_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -322,7 +336,9 @@ def build_get_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -420,7 +436,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OnlineEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -515,7 +531,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -589,7 +605,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -663,7 +679,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OnlineEndpoint] = kwargs.pop("cls", None) @@ -722,7 +738,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -913,7 +929,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -980,7 +996,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1171,7 +1187,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1250,7 +1266,7 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) @@ -1309,7 +1325,7 @@ def _regenerate_keys_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1482,7 +1498,7 @@ def begin_regenerate_keys( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1561,7 +1577,7 @@ def get_token( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EndpointAuthToken] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_operations.py index 369a4a8166c9..e2dd286f1f7b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_operations.py @@ -45,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +83,7 @@ def __init__(self, *args, **kwargs): @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.AmlOperation"]: - """Lists all of the available Azure Machine Learning Workspaces REST API operations. + """Lists all of the available Azure Machine Learning Services REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AmlOperation or the result of cls(response) @@ -91,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.AmlOperation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.AmlOperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_private_endpoint_connections_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_private_endpoint_connections_operations.py index 6be9a15c5c60..72fe910a28e8 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_private_endpoint_connections_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_private_endpoint_connections_operations.py @@ -47,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +86,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +128,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -167,7 +173,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,7 +245,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) @@ -341,7 +349,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -486,7 +494,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -568,7 +576,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_private_link_resources_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_private_link_resources_operations.py index 330afa1b8940..2eadc84452b7 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_private_link_resources_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_private_link_resources_operations.py @@ -45,7 +45,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +120,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_quotas_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_quotas_operations.py index 926e7f8d9baa..8b8a0b613f16 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_quotas_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_quotas_operations.py @@ -45,7 +45,9 @@ def build_update_request(location: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -76,7 +78,9 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -191,7 +195,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -255,7 +259,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ResourceQuota" _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListWorkspaceQuotas] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registries_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registries_operations.py new file mode 100644 index 000000000000..d0d793132721 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registries_operations.py @@ -0,0 +1,1122 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request( + subscription_id: str, *, skip: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/registries" + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, subscription_id: str, *, skip: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url( + "registry_name", registry_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url( + "registry_name", registry_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url( + "registry_name", registry_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class RegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registries` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription(self, skip: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Registry"]: + """List registries by subscription. + + List registries by subscription. + + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Registry or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RegistryTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RegistryTrackedResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/registries" + } + + @distributed_trace + def list(self, resource_group_name: str, skip: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Registry"]: + """List registries. + + List registries. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Registry or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RegistryTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RegistryTrackedResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + @distributed_trace + def begin_delete(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete registry. + + Delete registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + @distributed_trace + def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> _models.Registry: + """Get registry. + + Get registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Registry or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Registry + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Registry", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + body: Union[_models.PartialRegistryPartialTrackedResource, IO], + **kwargs: Any + ) -> _models.Registry: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PartialRegistryPartialTrackedResource") + + request = build_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Registry", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = self._deserialize("Registry", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + body: _models.PartialRegistryPartialTrackedResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Update tags. + + Update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialRegistryPartialTrackedResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Update tags. + + Update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + body: Union[_models.PartialRegistryPartialTrackedResource, IO], + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Update tags. + + Update tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialRegistryPartialTrackedResource or + IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Registry", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + def _create_or_update_initial( + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any + ) -> Optional[_models.Registry]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.Registry]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "Registry") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("Registry", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Registry", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + body: _models.Registry, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Create or update registry. + + Create or update registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Registry + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Create or update registry. + + Create or update registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Create or update registry. + + Create or update registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of registry. This is case-insensitive. Required. + :type registry_name: str + :param body: Details required to create the registry. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.Registry or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Registry or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Registry", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_code_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_code_containers_operations.py new file mode 100644 index 000000000000..ace30d21cd2b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_code_containers_operations.py @@ -0,0 +1,768 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, registry_name: str, subscription_id: str, *, skip: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, registry_name: str, code_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "codeName": _SERIALIZER.url("code_name", code_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, registry_name: str, code_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "codeName": _SERIALIZER.url("code_name", code_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, registry_name: str, code_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "codeName": _SERIALIZER.url("code_name", code_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class RegistryCodeContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registry_code_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, skip: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.CodeContainer"]: + """List containers. + + List containers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeContainer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.CodeContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CodeContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CodeContainerResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, code_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, code_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete container. + + Delete container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } + + @distributed_trace + def get(self, resource_group_name: str, registry_name: str, code_name: str, **kwargs: Any) -> _models.CodeContainer: + """Get container. + + Get container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CodeContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CodeContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + body: Union[_models.CodeContainer, IO], + **kwargs: Any + ) -> _models.CodeContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CodeContainer") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CodeContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("CodeContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + body: _models.CodeContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CodeContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CodeContainer or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.CodeContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CodeContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param body: Container entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CodeContainer or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.CodeContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + body: Union[_models.CodeContainer, IO], + **kwargs: Any + ) -> LROPoller[_models.CodeContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param body: Container entity to create or update. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CodeContainer or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.CodeContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CodeContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_code_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_code_versions_operations.py new file mode 100644 index 000000000000..cc0d2cf6c334 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_code_versions_operations.py @@ -0,0 +1,820 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + registry_name: str, + code_name: str, + subscription_id: str, + *, + order_by: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "codeName": _SERIALIZER.url("code_name", code_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if order_by is not None: + _params["$orderBy"] = _SERIALIZER.query("order_by", order_by, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, registry_name: str, code_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "codeName": _SERIALIZER.url("code_name", code_name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, registry_name: str, code_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "codeName": _SERIALIZER.url("code_name", code_name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, registry_name: str, code_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "codeName": _SERIALIZER.url("code_name", code_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class RegistryCodeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registry_code_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + order_by: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.CodeVersion"]: + """List versions. + + List versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param order_by: Ordering of list. Default value is None. + :type order_by: str + :param top: Maximum number of records to return. Default value is None. + :type top: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CodeVersion or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.CodeVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CodeVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + subscription_id=self._config.subscription_id, + order_by=order_by, + top=top, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CodeVersionResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, code_name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, code_name: str, version: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete version. + + Delete version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } + + @distributed_trace + def get( + self, resource_group_name: str, registry_name: str, code_name: str, version: str, **kwargs: Any + ) -> _models.CodeVersion: + """Get version. + + Get version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CodeVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CodeVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + version: str, + body: Union[_models.CodeVersion, IO], + **kwargs: Any + ) -> _models.CodeVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CodeVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("CodeVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("CodeVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + version: str, + body: _models.CodeVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CodeVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CodeVersion or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.CodeVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CodeVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CodeVersion or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.CodeVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + code_name: str, + version: str, + body: Union[_models.CodeVersion, IO], + **kwargs: Any + ) -> LROPoller[_models.CodeVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param code_name: Container name. Required. + :type code_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CodeVersion or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.CodeVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + code_name=code_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CodeVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_component_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_component_containers_operations.py new file mode 100644 index 000000000000..8a9481039686 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_component_containers_operations.py @@ -0,0 +1,776 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, registry_name: str, subscription_id: str, *, skip: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, registry_name: str, component_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "componentName": _SERIALIZER.url("component_name", component_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, registry_name: str, component_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "componentName": _SERIALIZER.url("component_name", component_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, registry_name: str, component_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "componentName": _SERIALIZER.url( + "component_name", component_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class RegistryComponentContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registry_component_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, skip: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.ComponentContainer"]: + """List containers. + + List containers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComponentContainer or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ComponentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ComponentContainerResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, component_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, component_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete container. + + Delete container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, registry_name: str, component_name: str, **kwargs: Any + ) -> _models.ComponentContainer: + """Get container. + + Get container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComponentContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ComponentContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + body: Union[_models.ComponentContainer, IO], + **kwargs: Any + ) -> _models.ComponentContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentContainer") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ComponentContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ComponentContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + body: _models.ComponentContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ComponentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ComponentContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ComponentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param body: Container entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ComponentContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + body: Union[_models.ComponentContainer, IO], + **kwargs: Any + ) -> LROPoller[_models.ComponentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param body: Container entity to create or update. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ComponentContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ComponentContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_component_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_component_versions_operations.py new file mode 100644 index 000000000000..68332d69f687 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_component_versions_operations.py @@ -0,0 +1,826 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + registry_name: str, + component_name: str, + subscription_id: str, + *, + order_by: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "componentName": _SERIALIZER.url("component_name", component_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if order_by is not None: + _params["$orderBy"] = _SERIALIZER.query("order_by", order_by, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, registry_name: str, component_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "componentName": _SERIALIZER.url("component_name", component_name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, registry_name: str, component_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "componentName": _SERIALIZER.url("component_name", component_name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, registry_name: str, component_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "componentName": _SERIALIZER.url( + "component_name", component_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class RegistryComponentVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registry_component_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + order_by: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ComponentVersion"]: + """List versions. + + List versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param order_by: Ordering of list. Default value is None. + :type order_by: str + :param top: Maximum number of records to return. Default value is None. + :type top: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComponentVersion or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ComponentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + order_by=order_by, + top=top, + skip=skip, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ComponentVersionResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, component_name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, component_name: str, version: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete version. + + Delete version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } + + @distributed_trace + def get( + self, resource_group_name: str, registry_name: str, component_name: str, version: str, **kwargs: Any + ) -> _models.ComponentVersion: + """Get version. + + Get version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ComponentVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ComponentVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + version: str, + body: Union[_models.ComponentVersion, IO], + **kwargs: Any + ) -> _models.ComponentVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ComponentVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ComponentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + version: str, + body: _models.ComponentVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ComponentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ComponentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ComponentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ComponentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + component_name: str, + version: str, + body: Union[_models.ComponentVersion, IO], + **kwargs: Any + ) -> LROPoller[_models.ComponentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param component_name: Container name. Required. + :type component_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ComponentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + component_name=component_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ComponentVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_environment_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_environment_containers_operations.py new file mode 100644 index 000000000000..5f5f09b9d3f9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_environment_containers_operations.py @@ -0,0 +1,794 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + registry_name: str, + subscription_id: str, + *, + skip: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if list_view_type is not None: + _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, registry_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, registry_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, registry_name: str, environment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "environmentName": _SERIALIZER.url( + "environment_name", environment_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class RegistryEnvironmentContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registry_environment_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + skip: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any + ) -> Iterable["_models.EnvironmentContainer"]: + """List environment containers. + + List environment containers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param list_view_type: View type for including/excluding (for example) archived entities. Known + values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. + :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EnvironmentContainer or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.EnvironmentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + skip=skip, + list_view_type=list_view_type, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EnvironmentContainerResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, environment_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, environment_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete container. + + Delete container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, registry_name: str, environment_name: str, **kwargs: Any + ) -> _models.EnvironmentContainer: + """Get container. + + Get container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. This is case-sensitive. Required. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EnvironmentContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + body: Union[_models.EnvironmentContainer, IO], + **kwargs: Any + ) -> _models.EnvironmentContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnvironmentContainer") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + body: _models.EnvironmentContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EnvironmentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EnvironmentContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EnvironmentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param body: Container entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EnvironmentContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + body: Union[_models.EnvironmentContainer, IO], + **kwargs: Any + ) -> LROPoller[_models.EnvironmentContainer]: + """Create or update container. + + Create or update container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param body: Container entity to create or update. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EnvironmentContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_environment_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_environment_versions_operations.py new file mode 100644 index 000000000000..51ea7fbf62d5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_environment_versions_operations.py @@ -0,0 +1,849 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + registry_name: str, + environment_name: str, + subscription_id: str, + *, + order_by: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if order_by is not None: + _params["$orderBy"] = _SERIALIZER.query("order_by", order_by, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if list_view_type is not None: + _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "environmentName": _SERIALIZER.url("environment_name", environment_name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "environmentName": _SERIALIZER.url( + "environment_name", environment_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class RegistryEnvironmentVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registry_environment_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + order_by: Optional[str] = None, + top: Optional[int] = None, + skip: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any + ) -> Iterable["_models.EnvironmentVersion"]: + """List versions. + + List versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. This is case-sensitive. Required. + :type environment_name: str + :param order_by: Ordering of list. Default value is None. + :type order_by: str + :param top: Maximum number of records to return. Default value is None. + :type top: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param list_view_type: View type for including/excluding (for example) archived entities. Known + values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. + :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EnvironmentVersion or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.EnvironmentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + subscription_id=self._config.subscription_id, + order_by=order_by, + top=top, + skip=skip, + list_view_type=list_view_type, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EnvironmentVersionResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, environment_name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, environment_name: str, version: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete version. + + Delete version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } + + @distributed_trace + def get( + self, resource_group_name: str, registry_name: str, environment_name: str, version: str, **kwargs: Any + ) -> _models.EnvironmentVersion: + """Get version. + + Get version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. This is case-sensitive. Required. + :type environment_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EnvironmentVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + body: Union[_models.EnvironmentVersion, IO], + **kwargs: Any + ) -> _models.EnvironmentVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EnvironmentVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + body: _models.EnvironmentVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EnvironmentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EnvironmentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EnvironmentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EnvironmentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + environment_name: str, + version: str, + body: Union[_models.EnvironmentVersion, IO], + **kwargs: Any + ) -> LROPoller[_models.EnvironmentVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param environment_name: Container name. Required. + :type environment_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EnvironmentVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + environment_name=environment_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_model_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_model_containers_operations.py new file mode 100644 index 000000000000..dc85a3c7ce70 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_model_containers_operations.py @@ -0,0 +1,790 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + registry_name: str, + subscription_id: str, + *, + skip: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if list_view_type is not None: + _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, registry_name: str, model_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "modelName": _SERIALIZER.url("model_name", model_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, registry_name: str, model_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "modelName": _SERIALIZER.url("model_name", model_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, registry_name: str, model_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "modelName": _SERIALIZER.url("model_name", model_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class RegistryModelContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registry_model_containers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + skip: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any + ) -> Iterable["_models.ModelContainer"]: + """List model containers. + + List model containers. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param list_view_type: View type for including/excluding (for example) archived entities. Known + values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. + :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ModelContainer or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.ModelContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ModelContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + skip=skip, + list_view_type=list_view_type, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ModelContainerResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, model_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, model_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete container. + + Delete container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, registry_name: str, model_name: str, **kwargs: Any + ) -> _models.ModelContainer: + """Get container. + + Get container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ModelContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ModelContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ModelContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + body: Union[_models.ModelContainer, IO], + **kwargs: Any + ) -> _models.ModelContainer: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ModelContainer") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ModelContainer", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ModelContainer", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + body: _models.ModelContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ModelContainer]: + """Create or update model container. + + Create or update model container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ModelContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ModelContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ModelContainer]: + """Create or update model container. + + Create or update model container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param body: Container entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ModelContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ModelContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + body: Union[_models.ModelContainer, IO], + **kwargs: Any + ) -> LROPoller[_models.ModelContainer]: + """Create or update model container. + + Create or update model container. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param body: Container entity to create or update. Is either a model type or a IO type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelContainer or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ModelContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ModelContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ModelContainer", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_model_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_model_versions_operations.py new file mode 100644 index 000000000000..ddff22e50176 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_model_versions_operations.py @@ -0,0 +1,858 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, + registry_name: str, + model_name: str, + subscription_id: str, + *, + skip: Optional[str] = None, + order_by: Optional[str] = None, + top: Optional[int] = None, + version: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "modelName": _SERIALIZER.url("model_name", model_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if order_by is not None: + _params["$orderBy"] = _SERIALIZER.query("order_by", order_by, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if version is not None: + _params["version"] = _SERIALIZER.query("version", version, "str") + if description is not None: + _params["description"] = _SERIALIZER.query("description", description, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "str") + if properties is not None: + _params["properties"] = _SERIALIZER.query("properties", properties, "str") + if list_view_type is not None: + _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, registry_name: str, model_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "modelName": _SERIALIZER.url("model_name", model_name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, registry_name: str, model_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "modelName": _SERIALIZER.url("model_name", model_name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, registry_name: str, model_name: str, version: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "modelName": _SERIALIZER.url("model_name", model_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class RegistryModelVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registry_model_versions` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + skip: Optional[str] = None, + order_by: Optional[str] = None, + top: Optional[int] = None, + version: Optional[str] = None, + description: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + **kwargs: Any + ) -> Iterable["_models.ModelVersion"]: + """List versions. + + List versions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param order_by: Ordering of list. Default value is None. + :type order_by: str + :param top: Maximum number of records to return. Default value is None. + :type top: int + :param version: Version identifier. Default value is None. + :type version: str + :param description: Model description. Default value is None. + :type description: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param properties: Comma-separated list of property names (and optionally values). Example: + prop1,prop2=value2. Default value is None. + :type properties: str + :param list_view_type: View type for including/excluding (for example) archived entities. Known + values are: "ActiveOnly", "ArchivedOnly", and "All". Default value is None. + :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ListViewType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ModelVersion or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.ModelVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ModelVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + subscription_id=self._config.subscription_id, + skip=skip, + order_by=order_by, + top=top, + version=version, + description=description, + tags=tags, + properties=properties, + list_view_type=list_view_type, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ModelVersionResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, registry_name: str, model_name: str, version: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, model_name: str, version: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete version. + + Delete version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param version: Version identifier. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } + + @distributed_trace + def get( + self, resource_group_name: str, registry_name: str, model_name: str, version: str, **kwargs: Any + ) -> _models.ModelVersion: + """Get version. + + Get version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. This is case-sensitive. Required. + :type model_name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ModelVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ModelVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ModelVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: Union[_models.ModelVersion, IO], + **kwargs: Any + ) -> _models.ModelVersion: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IO, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ModelVersion") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("ModelVersion", pipeline_response) + + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("ModelVersion", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: _models.ModelVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ModelVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ModelVersion or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ModelVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ModelVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ModelVersion or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ModelVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + model_name: str, + version: str, + body: Union[_models.ModelVersion, IO], + **kwargs: Any + ) -> LROPoller[_models.ModelVersion]: + """Create or update version. + + Create or update version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: Name of Azure Machine Learning registry. Required. + :type registry_name: str + :param model_name: Container name. Required. + :type model_name: str + :param version: Version identifier. Required. + :type version: str + :param body: Version entity to create or update. Is either a model type or a IO type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelVersion or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ModelVersion or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ModelVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + model_name=model_name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ModelVersion", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" + } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_schedules_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_schedules_operations.py index ccf22fb3aed1..2c8ab3341b5c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_schedules_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_schedules_operations.py @@ -55,7 +55,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +94,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +130,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +166,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -241,7 +249,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ScheduleResourceArmPaginatedResult] = kwargs.pop("cls", None) @@ -331,7 +339,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -403,7 +411,7 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -475,7 +483,7 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) @@ -529,7 +537,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -708,7 +716,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_usages_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_usages_operations.py index 87b60742ab08..2b82aae13553 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_usages_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_usages_operations.py @@ -45,7 +45,9 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +105,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_virtual_machine_sizes_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_virtual_machine_sizes_operations.py index 4928f81dcedf..dfdc25770fa8 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_virtual_machine_sizes_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_virtual_machine_sizes_operations.py @@ -43,7 +43,9 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +110,7 @@ def list(self, location: str, **kwargs: Any) -> _models.VirtualMachineSizeListRe _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspace_connections_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspace_connections_operations.py index c85caf24b6e8..d5076c50ca1e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspace_connections_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspace_connections_operations.py @@ -47,7 +47,9 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -84,7 +86,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -118,7 +122,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +164,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -312,7 +320,7 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -393,7 +401,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) @@ -462,7 +470,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -528,7 +536,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspace_features_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspace_features_operations.py index 00c72c0a8b82..bc4b5c028713 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspace_features_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspace_features_operations.py @@ -47,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +112,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListAmlUserFeatureResult] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspaces_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspaces_operations.py index 3d8220b5fefa..0469501e6ea8 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspaces_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_workspaces_operations.py @@ -49,7 +49,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +84,9 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -118,7 +122,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +157,9 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -187,7 +195,9 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -221,7 +231,9 @@ def build_diagnose_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -257,7 +269,9 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -290,7 +304,9 @@ def build_resync_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -323,7 +339,9 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -353,7 +371,9 @@ def build_list_notebook_access_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -386,7 +406,9 @@ def build_prepare_notebook_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -419,7 +441,9 @@ def build_list_storage_account_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -452,7 +476,9 @@ def build_list_notebook_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -485,7 +511,9 @@ def build_list_outbound_network_dependencies_endpoints_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-10-01")) + api_version: Literal["2022-12-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-12-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -556,7 +584,7 @@ def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) @@ -609,7 +637,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -766,7 +794,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -827,7 +855,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -886,7 +914,7 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -946,7 +974,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1105,7 +1133,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1171,7 +1199,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) @@ -1263,7 +1291,7 @@ def _diagnose_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1442,7 +1470,7 @@ def begin_diagnose( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1519,7 +1547,7 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListWorkspaceKeysResult] = kwargs.pop("cls", None) @@ -1572,7 +1600,7 @@ def _resync_keys_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1632,7 +1660,7 @@ def begin_resync_keys(self, resource_group_name: str, workspace_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1688,7 +1716,7 @@ def list_by_subscription(self, skip: Optional[str] = None, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) @@ -1788,7 +1816,7 @@ def list_notebook_access_token( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.NotebookAccessTokenResult] = kwargs.pop("cls", None) @@ -1841,7 +1869,7 @@ def _prepare_notebook_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[Optional[_models.NotebookResourceInfo]] = kwargs.pop("cls", None) @@ -1910,7 +1938,7 @@ def begin_prepare_notebook( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.NotebookResourceInfo] = kwargs.pop("cls", None) @@ -1983,7 +2011,7 @@ def list_storage_account_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListStorageAccountKeysResult] = kwargs.pop("cls", None) @@ -2049,7 +2077,7 @@ def list_notebook_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ListNotebookKeysResult] = kwargs.pop("cls", None) @@ -2119,7 +2147,7 @@ def list_outbound_network_dependencies_endpoints( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-10-01"] = kwargs.pop( + api_version: Literal["2022-12-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ExternalFQDNResponse] = kwargs.pop("cls", None) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/aks_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/aks_compute.py index 4154ad04114e..4076cc618bc5 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/aks_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/aks_compute.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/get/AKSCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/get/AKSCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/aml_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/aml_compute.py index 9b60010544b5..0667d985728b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/aml_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/aml_compute.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/get/AmlCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/get/AmlCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_aks_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_aks_compute.py index 7bf0144d06dc..6407a4e58b43 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_aks_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_aks_compute.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/createOrUpdate/BasicAKSCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/createOrUpdate/BasicAKSCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_aml_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_aml_compute.py index d6cfcd909034..67289ff39e1c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_aml_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_aml_compute.py @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/createOrUpdate/BasicAmlCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/createOrUpdate/BasicAmlCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_data_factory_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_data_factory_compute.py index c7256aaa7266..b4cf67db7061 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_data_factory_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/basic_data_factory_compute.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/createOrUpdate/BasicDataFactoryCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/createOrUpdate/BasicDataFactoryCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/cancel.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/cancel.py index 14832bc92a6c..d554f8c0d794 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/cancel.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/cancel.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Job/cancel.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Job/cancel.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance.py index 8be35ceb91e4..3400e69d4707 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/get/ComputeInstance.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/get/ComputeInstance.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance_minimal.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance_minimal.py index f67029c8ca3c..0153e7dd60a5 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance_minimal.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance_minimal.py @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/createOrUpdate/ComputeInstanceMinimal.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/createOrUpdate/ComputeInstanceMinimal.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance_with_schedules.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance_with_schedules.py index c5ef7c03d6b9..8f75730ba693 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance_with_schedules.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute_instance_with_schedules.py @@ -69,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create.py index 0d7e657dba30..80a6f24f6a98 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create.py @@ -76,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/create.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/create.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update.py index d69a53bd684c..be4ba37711cd 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/PrivateEndpointConnection/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/PrivateEndpointConnection/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update_system_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update_system_created.py new file mode 100644 index 000000000000..30906e902b1c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update_system_created.py @@ -0,0 +1,76 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python create_or_update_system_created.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.registries.begin_create_or_update( + resource_group_name="test-rg", + registry_name="string", + body={ + "identity": {"type": "None", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "location": "string", + "properties": { + "description": "string", + "properties": {"string": "string"}, + "regionDetails": [ + { + "acrDetails": [ + { + "systemCreatedAcrAccount": { + "acrAccountSku": "string", + "armResourceId": {"resourceId": "string"}, + } + } + ], + "location": "string", + "storageAccountDetails": [ + { + "systemCreatedStorageAccount": { + "allowBlobPublicAccess": False, + "armResourceId": {"resourceId": "string"}, + "storageAccountHnsEnabled": False, + "storageAccountType": "string", + } + } + ], + } + ], + "tags": {"string": "string"}, + }, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Basic"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Registries/createOrUpdate-SystemCreated.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update_user_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update_user_created.py new file mode 100644 index 000000000000..8aeaea152eeb --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/create_or_update_user_created.py @@ -0,0 +1,62 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python create_or_update_user_created.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.registries.begin_create_or_update( + resource_group_name="test-rg", + registry_name="string", + body={ + "identity": {"type": "None", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "location": "string", + "properties": { + "description": "string", + "properties": {"string": "string"}, + "regionDetails": [ + { + "acrDetails": [{"userCreatedAcrAccount": {"armResourceId": {"resourceId": "string"}}}], + "location": "string", + "storageAccountDetails": [ + {"userCreatedStorageAccount": {"armResourceId": {"resourceId": "string"}}} + ], + } + ], + "tags": {"string": "string"}, + }, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Basic"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Registries/createOrUpdate-UserCreated.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/delete.py index 1ab7cceee3e0..f62d5399a4f1 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/diagnose.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/diagnose.py index e7d53be6b011..e20a29c71565 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/diagnose.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/diagnose.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/diagnose.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/diagnose.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/export_labels.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/export_labels.py new file mode 100644 index 000000000000..d559887fb46c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/export_labels.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python export_labels.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.labeling_jobs.begin_export_labels( + resource_group_name="workspace-1234", + workspace_name="testworkspace", + id="testLabelingJob", + body={"format": "Dataset"}, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/LabelingJob/exportLabels.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get.py index ae2325915702..41a3291a2229 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_logs.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_logs.py index 08ca1c985e42..a12ca17ec737 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_logs.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_logs.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/OnlineDeployment/getLogs.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/OnlineDeployment/getLogs.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_system_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_system_created.py new file mode 100644 index 000000000000..7ee1a016ee6a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_system_created.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python get_system_created.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.registries.get( + resource_group_name="test-rg", + registry_name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Registries/get-SystemCreated.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_token.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_token.py index ce3165223bbc..7459f16a28be 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_token.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_token.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/OnlineEndpoint/getToken.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/OnlineEndpoint/getToken.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_user_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_user_created.py new file mode 100644 index 000000000000..aff5df16b4f0 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/get_user_created.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python get_user_created.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.registries.get( + resource_group_name="test-rg", + registry_name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Registries/get-UserCreated.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/kubernetes_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/kubernetes_compute.py index 1c4abcb9c998..8fee0582bf85 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/kubernetes_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/kubernetes_compute.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/get/KubernetesCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/get/KubernetesCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list.py index 803939df104d..39f5756eea01 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Usage/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Usage/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_by_resource_group.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_by_resource_group.py index ab77ccf41bcb..59fef105c3c3 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_by_resource_group.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/listByResourceGroup.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/listByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_by_subscription.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_by_subscription.py index 021a94dc65b3..6937bf4bcb2b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_by_subscription.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/listBySubscription.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/listBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_keys.py index 4329788bf08c..bf49d5dc5047 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/listKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/listKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_nodes.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_nodes.py index 08a92686eed7..757c6f3c20c6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_nodes.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_nodes.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/listNodes.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/listNodes.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_notebook_access_token.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_notebook_access_token.py index 2231f08361b1..3906ab4cb675 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_notebook_access_token.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_notebook_access_token.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/listNotebookAccessToken.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/listNotebookAccessToken.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_secrets.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_secrets.py index 6c9f9145642c..7beeb4d8a994 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_secrets.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_secrets.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Datastore/listSecrets.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Datastore/listSecrets.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_skus.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_skus.py index a1cd89f08c22..1c16b81ebfeb 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_skus.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_skus.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/OnlineDeployment/KubernetesOnlineDeployment/listSkus.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/OnlineDeployment/KubernetesOnlineDeployment/listSkus.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_storage_account_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_storage_account_keys.py index 84b7f19567c0..2014f9dadafb 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_storage_account_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_storage_account_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/listStorageAccountKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/listStorageAccountKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_system_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_system_created.py new file mode 100644 index 000000000000..aca172abd048 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_system_created.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python list_system_created.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.registries.list( + resource_group_name="test-rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Registries/list-SystemCreated.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_user_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_user_created.py new file mode 100644 index 000000000000..e2a73bfe5720 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/list_user_created.py @@ -0,0 +1,41 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python list_user_created.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.registries.list( + resource_group_name="test-rg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Registries/list-UserCreated.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/operations_list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/operations_list.py index 1ed3dd9d1da4..4c18849aa879 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/operations_list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/operationsList.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/operationsList.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/patch.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/patch.py index 88d3d61b0099..5eccaa8aa804 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/patch.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/patch.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/patch.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/patch.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/pause.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/pause.py new file mode 100644 index 000000000000..e7d5e72aad05 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/pause.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python pause.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.labeling_jobs.pause( + resource_group_name="workspace-1234", + workspace_name="testworkspace", + id="testLabelingJob", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/LabelingJob/pause.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/prepare.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/prepare.py index c6038615acb6..d7e7e6bbb283 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/prepare.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/prepare.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Notebook/prepare.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Notebook/prepare.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/regenerate_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/regenerate_keys.py index 7e4eb60a2634..d6a072205d5e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/regenerate_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/regenerate_keys.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/OnlineEndpoint/regenerateKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/OnlineEndpoint/regenerateKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/restart.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/restart.py index df42109f655d..75055ebb57db 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/restart.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/restart.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/restart.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/restart.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/resume.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/resume.py new file mode 100644 index 000000000000..e269d6c66b0c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/resume.py @@ -0,0 +1,42 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python resume.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.labeling_jobs.begin_resume( + resource_group_name="workspace-1234", + workspace_name="testworkspace", + id="testLabelingJob", + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/LabelingJob/resume.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/resync_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/resync_keys.py index 02b711c19636..939d3e9e5626 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/resync_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/resync_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/resyncKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/resyncKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/start.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/start.py index b2754e281b74..7f493b567b24 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/start.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/start.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/start.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/start.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/stop.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/stop.py index 4337f64aa158..c6c37a8b975f 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/stop.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/stop.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Compute/stop.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/stop.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update.py index 482c71b07c8c..712efbfac662 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2022-10-01/examples/Workspace/update.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Workspace/update.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_custom_services.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_custom_services.py new file mode 100644 index 000000000000..b8c726b64bce --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_custom_services.py @@ -0,0 +1,58 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python update_custom_services.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.compute.update_custom_services( + resource_group_name="testrg123", + workspace_name="workspaces123", + compute_name="compute123", + custom_services=[ + { + "docker": {"privileged": True}, + "endpoints": [ + {"hostIp": None, "name": "connect", "protocol": "http", "published": 4444, "target": 8787} + ], + "environmentVariables": { + "RSP_LICENSE": {"type": "local", "value": "XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX"} + }, + "image": {"reference": "ghcr.io/azure/rstudio-workbench:latest", "type": "docker"}, + "name": "rstudio-workbench", + "volumes": [ + {"readOnly": True, "source": "/mnt/azureuser/", "target": "/home/testuser/", "type": "bind"} + ], + } + ], + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/updateCustomServices.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_idle_shutdown_setting.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_idle_shutdown_setting.py new file mode 100644 index 000000000000..678a012a40b4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_idle_shutdown_setting.py @@ -0,0 +1,43 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python update_idle_shutdown_setting.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", + ) + + response = client.compute.update_idle_shutdown_setting( + resource_group_name="testrg123", + workspace_name="workspaces123", + compute_name="compute123", + parameters={"idleTimeBeforeShutdown": "PT120M"}, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Compute/updateIdleShutdownSetting.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_system_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_system_created.py new file mode 100644 index 000000000000..5908d28493b2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_system_created.py @@ -0,0 +1,48 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python update_system_created.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.registries.begin_update( + resource_group_name="test-rg", + registry_name="string", + body={ + "identity": {"type": "UserAssigned", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "properties": {}, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Premium"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Registries/update-SystemCreated.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_user_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_user_created.py new file mode 100644 index 000000000000..7a432c8f9010 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/update_user_created.py @@ -0,0 +1,48 @@ +# 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.identity import DefaultAzureCredential +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-machinelearningservices +# USAGE + python update_user_created.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MachineLearningServicesMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.registries.begin_update( + resource_group_name="test-rg", + registry_name="string", + body={ + "identity": {"type": "UserAssigned", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "properties": {}, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Premium"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2022-12-01-preview/examples/Registries/update-UserCreated.json +if __name__ == "__main__": + main()